Closed ValerianClerc closed 4 years ago
Username should be unique in DB, but the checks should also be performed like we do with emails (we check if a user exists with the given email and send a 400 "User already exists") e.g.
const foundUserByEmail: IUserModel = await userDBInteractions.findByEmail(req.body.email);
const foundUserByUsername: IUserModel = await userDBInteractions.findByUsername(req.body.username);
if (foundUserByEmail || foundUserByUsername) res.status(statusCodes.BAD_REQUEST).send({ status: statusCodes.BAD_REQUEST, message: "User already exists" });
else {}
Title