@@ -15,7 +15,7 @@ const router = express.Router();
1515router . get ( '/public/id/:id' , validator ( schema . userId , ValidationSource . PARAM ) ,
1616 asyncHandler ( async ( req : ProtectedRequest , res , next ) => {
1717 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' ) ;
1919 return new SuccessResponse ( 'success' , _ . pick ( user , [ 'name' , 'profilePicUrl' ] ) ) . send ( res ) ;
2020 } ) ) ;
2121
@@ -27,14 +27,14 @@ router.use('/', authentication);
2727router . get ( '/my' ,
2828 asyncHandler ( async ( req : ProtectedRequest , res , next ) => {
2929 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' ) ;
3131 return new SuccessResponse ( 'success' , _ . pick ( user , [ 'name' , 'profilePicUrl' , 'roles' ] ) ) . send ( res ) ;
3232 } ) ) ;
3333
3434router . put ( '/' , validator ( schema . profile ) ,
3535 asyncHandler ( async ( req : ProtectedRequest , res , next ) => {
3636 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' ) ;
3838
3939 if ( req . body . name ) user . name = req . body . name ;
4040 if ( req . body . profilePicUrl ) user . profilePicUrl = req . body . profilePicUrl ;
0 commit comments