|
1 | 1 | import { IdentityLifecycle } from './../_enums/lifecycle.enum'; |
2 | 2 | import { inetOrgPerson, inetOrgPersonSchema } from './_parts/inetOrgPerson.part'; |
3 | 3 | import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'; |
4 | | -import {Document, Types} from 'mongoose'; |
| 4 | +import { Document, Types } from 'mongoose'; |
5 | 5 | import { AbstractSchema } from '~/_common/abstracts/schemas/abstract.schema'; |
6 | 6 | import { IdentityState } from '../_enums/states.enum'; |
7 | 7 | import { AdditionalFieldsPart, AdditionalFieldsPartSchema } from './_parts/additionalFields.part.schema'; |
@@ -53,11 +53,16 @@ export class Identities extends AbstractSchema { |
53 | 53 | public destFusionId: Types.ObjectId; |
54 | 54 | } |
55 | 55 |
|
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 | + ); |
0 commit comments