From 1382f9bb5bf884f116bb662d11ff69210cfd25aa Mon Sep 17 00:00:00 2001 From: Gowtham M Date: Thu, 6 Nov 2025 18:30:49 +0530 Subject: [PATCH] GWM --- app/controllers/establishment_user.controller.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/controllers/establishment_user.controller.js b/app/controllers/establishment_user.controller.js index e178259..644e834 100644 --- a/app/controllers/establishment_user.controller.js +++ b/app/controllers/establishment_user.controller.js @@ -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,