File tree Expand file tree Collapse file tree 1 file changed +14
-9
lines changed
src/management/identities/_schemas Expand file tree Collapse file tree 1 file changed +14
-9
lines changed Original file line number Diff line number Diff line change 11import { IdentityLifecycle } from './../_enums/lifecycle.enum' ;
22import { inetOrgPerson , inetOrgPersonSchema } from './_parts/inetOrgPerson.part' ;
33import { Prop , Schema , SchemaFactory } from '@nestjs/mongoose' ;
4- import { Document , Types } from 'mongoose' ;
4+ import { Document , Types } from 'mongoose' ;
55import { AbstractSchema } from '~/_common/abstracts/schemas/abstract.schema' ;
66import { IdentityState } from '../_enums/states.enum' ;
77import { AdditionalFieldsPart , AdditionalFieldsPartSchema } from './_parts/additionalFields.part.schema' ;
@@ -53,11 +53,16 @@ export class Identities extends AbstractSchema {
5353 public destFusionId : Types . ObjectId ;
5454}
5555
56- export const IdentitiesSchema = SchemaFactory . createForClass ( Identities ) . plugin ( AutoIncrementPlugin , < AutoIncrementPluginOptions > {
57- incrementBy : 1 ,
58- field : 'inetOrgPerson.employeeNumber' ,
59- startAt : 1 ,
60- rules : ( ctx ) => {
61- return ctx . inetOrgPerson . employeeType === 'LOCAL' ;
62- } ,
63- } ) ;
56+ export const IdentitiesSchema = SchemaFactory . createForClass ( Identities )
57+ . plugin ( AutoIncrementPlugin , < AutoIncrementPluginOptions > {
58+ incrementBy : 1 ,
59+ field : 'inetOrgPerson.employeeNumber' ,
60+ startAt : 1 ,
61+ rules : ( ctx ) => {
62+ return ctx . inetOrgPerson . employeeType === 'LOCAL' ;
63+ } ,
64+ } )
65+ . index (
66+ { 'inetOrgPerson.employeeNumber' : 1 , 'inetOrgPerson.employeeType' : 1 } ,
67+ { unique : true } ,
68+ ) ;
You can’t perform that action at this time.
0 commit comments