@@ -15,7 +15,7 @@ const router = express.Router();
15
15
router . get ( '/public/id/:id' , validator ( schema . userId , ValidationSource . PARAM ) ,
16
16
asyncHandler ( async ( req : ProtectedRequest , res , next ) => {
17
17
const user = await UserRepo . findPublicProfileById ( new Types . ObjectId ( req . params . id ) ) ;
18
- if ( user == null ) throw new BadRequestError ( 'User not registered' ) ;
18
+ if ( ! user ) throw new BadRequestError ( 'User not registered' ) ;
19
19
return new SuccessResponse ( 'success' , _ . pick ( user , [ 'name' , 'profilePicUrl' ] ) ) . send ( res ) ;
20
20
} ) ) ;
21
21
@@ -27,14 +27,14 @@ router.use('/', authentication);
27
27
router . get ( '/my' ,
28
28
asyncHandler ( async ( req : ProtectedRequest , res , next ) => {
29
29
const user = await UserRepo . findProfileById ( req . user . _id ) ;
30
- if ( user == null ) throw new BadRequestError ( 'User not registered' ) ;
30
+ if ( ! user ) throw new BadRequestError ( 'User not registered' ) ;
31
31
return new SuccessResponse ( 'success' , _ . pick ( user , [ 'name' , 'profilePicUrl' , 'roles' ] ) ) . send ( res ) ;
32
32
} ) ) ;
33
33
34
34
router . put ( '/' , validator ( schema . profile ) ,
35
35
asyncHandler ( async ( req : ProtectedRequest , res , next ) => {
36
36
const user = await UserRepo . findProfileById ( req . user . _id ) ;
37
- if ( user == null ) throw new BadRequestError ( 'User not registered' ) ;
37
+ if ( ! user ) throw new BadRequestError ( 'User not registered' ) ;
38
38
39
39
if ( req . body . name ) user . name = req . body . name ;
40
40
if ( req . body . profilePicUrl ) user . profilePicUrl = req . body . profilePicUrl ;
0 commit comments