GWM
This commit is contained in:
parent
e472682224
commit
1382f9bb5b
@ -11,6 +11,12 @@ exports.createUser = async (req, res) => {
|
|||||||
const { establishment_id, name, email, password , gender} = req.body;
|
const { establishment_id, name, email, password , gender} = req.body;
|
||||||
const hashed = await bcrypt.hash(password, 10);
|
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({
|
const user = await EstablishmentUser.create({
|
||||||
establishment_id,
|
establishment_id,
|
||||||
name,
|
name,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user