This commit is contained in:
Gowtham M 2025-11-06 18:30:49 +05:30
parent e472682224
commit 1382f9bb5b

View File

@ -11,6 +11,12 @@ exports.createUser = async (req, res) => {
const { establishment_id, name, email, password , gender} = req.body;
const hashed = await bcrypt.hash(password, 10);
// Check if establishment user already exists
const existingEstablishmentUser = await EstablishmentUser.findOne({where: { email }, });
if (existingEstablishmentUser) {
return res.status(400).send({status: "failed",message: "Email already exists", });
}
const user = await EstablishmentUser.create({
establishment_id,
name,