Skip to content

Commit 7bbf62f

Browse files
committed
add code suger in profile
1 parent 53139f0 commit 7bbf62f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/routes/v1/profile/user.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const router = express.Router();
1515
router.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);
2727
router.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

3434
router.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

Comments
 (0)