File tree Expand file tree Collapse file tree 3 files changed +31
-7
lines changed
Expand file tree Collapse file tree 3 files changed +31
-7
lines changed Original file line number Diff line number Diff line change 11services :
22 mongodb :
3- image : mongo
3+ image : mongo:8
44 ports :
55 - 27017:27017
66 redis :
Original file line number Diff line number Diff line change 11{
2- "hash" : " 9c7b53ed249543d1b5994078e776a3a52c540309332df65c188b206f250d095f " ,
2+ "hash" : " 3585f972f863d385615370bca5855850c404d7b5d1e8aff5b58464e237b49f00 " ,
33 "openapi" : " 3.0.0" ,
44 "paths" : {
55 "/hello" : {
38183818 "in" : " query" ,
38193819 "description" : " 邮箱" ,
38203820 "schema" : {
3821+ "nullable" : true ,
38213822 "type" : " string"
38223823 }
38233824 },
41074108 "in" : " query" ,
41084109 "description" : " 邮箱" ,
41094110 "schema" : {
4111+ "nullable" : true ,
41104112 "type" : " string"
41114113 }
41124114 },
47654767 "in" : " query" ,
47664768 "description" : " 邮箱" ,
47674769 "schema" : {
4770+ "nullable" : true ,
47684771 "type" : " string"
47694772 }
47704773 },
56545657 },
56555658 "email" : {
56565659 "type" : " string" ,
5660+ "nullable" : true ,
56575661 "description" : " 邮箱"
56585662 },
56595663 "name" : {
57385742 },
57395743 "employeeId" : {
57405744 "type" : " string" ,
5745+ "nullable" : true ,
57415746 "description" : " 员工编号"
57425747 },
57435748 "permissions" : {
71777182 },
71787183 "email" : {
71797184 "type" : " string" ,
7185+ "nullable" : true ,
71807186 "description" : " 邮箱"
71817187 },
71827188 "name" : {
72387244 },
72397245 "employeeId" : {
72407246 "type" : " string" ,
7247+ "nullable" : true ,
72417248 "description" : " 员工编号"
72427249 },
72437250 "active" : {
72827289 },
72837290 "email" : {
72847291 "type" : " string" ,
7292+ "nullable" : true ,
72857293 "description" : " 邮箱"
72867294 },
72877295 "name" : {
73667374 },
73677375 "employeeId" : {
73687376 "type" : " string" ,
7377+ "nullable" : true ,
73697378 "description" : " 员工编号"
73707379 },
73717380 "permissions" : {
77487757 },
77497758 "email" : {
77507759 "type" : " string" ,
7760+ "nullable" : true ,
77517761 "description" : " 邮箱"
77527762 },
77537763 "groups" : {
Original file line number Diff line number Diff line change @@ -51,8 +51,8 @@ export class UserDoc {
5151 @IsOptional ( )
5252 @IsString ( )
5353 @IsEmail ( )
54- @Prop ( { unique : true , sparse : true } )
55- email ?: string ;
54+ @Prop ( )
55+ email ?: string | null ;
5656
5757 /**
5858 * 姓名
@@ -173,7 +173,7 @@ export class UserDoc {
173173 @IsOptional ( )
174174 @IsString ( )
175175 @IsMobilePhone ( 'zh-CN' ) // 中国大陆地区手机号
176- @Prop ( { unique : true , sparse : true } )
176+ @Prop ( )
177177 phone ?: string | null ;
178178
179179 /**
@@ -220,8 +220,8 @@ export class UserDoc {
220220 */
221221 @IsOptional ( )
222222 @IsString ( )
223- @Prop ( { unique : true , sparse : true } )
224- employeeId ?: string ;
223+ @Prop ( )
224+ employeeId ?: string | null ;
225225
226226 /**
227227 * 权限
@@ -289,3 +289,17 @@ export type UserDocument = User & Document;
289289UserSchema . virtual ( 'hasPassword' ) . get ( function ( ) : boolean {
290290 return ! ! this . password ;
291291} ) ;
292+
293+ // add partial unique indexes to allow multiple nulls
294+ UserSchema . index (
295+ { email : 1 } ,
296+ { unique : true , partialFilterExpression : { email : { $type : 'string' } } }
297+ ) ;
298+ UserSchema . index (
299+ { phone : 1 } ,
300+ { unique : true , partialFilterExpression : { phone : { $type : 'string' } } }
301+ ) ;
302+ UserSchema . index (
303+ { employeeId : 1 } ,
304+ { unique : true , partialFilterExpression : { employeeId : { $type : 'string' } } }
305+ ) ;
You can’t perform that action at this time.
0 commit comments