File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -38,12 +38,10 @@ export function isCreateUserDto(obj: unknown): obj is CreateUserDto {
3838 // Check for extra fields
3939 const objKeys = Object . keys ( obj ) ;
4040 if ( ! objKeys . every ( ( key ) => allowedKeys . includes ( key ) ) ) return false ;
41- if ( ! allowedKeys . slice ( 0 , 2 ) . every ( ( key ) => objKeys . includes ( key ) ) )
42- return false ; // username & email required
4341
4442 // Type checks
45- if ( typeof obj . username !== "string" ) return false ;
46- if ( typeof obj . email !== "string" ) return false ;
43+ if ( ! ( "username" in obj ) || typeof obj . username !== "string" ) return false ;
44+ if ( ! ( "email" in obj ) || typeof obj . email !== "string" ) return false ;
4745 if ( "password" in obj && typeof obj . password !== "string" ) return false ;
4846 if ( "role" in obj && typeof obj . role !== "string" ) return false ;
4947 if ( "global" in obj && typeof obj . global !== "boolean" ) return false ;
You can’t perform that action at this time.
0 commit comments