User email duplication issue fixed

This commit is contained in:
unknown 2025-12-19 17:34:18 +05:30
parent 149cb00503
commit c4a3dc92eb

View File

@ -139,6 +139,16 @@ exports.createEstablishment = async (req, res) => {
if (existingEstablishment) {
return res.status(400).send({status: "failed",message: "Establishment code already exists", });
}
const existingUser = await EstablishmentUser.findOne({
where: { email: establishment_user.email }
});
if (existingUser) {
return res.status(400).send({
status: "failed",
message: "User email already exists"
});
}
// Create establishment record
const establishment = await Establishment.create({