Merge branch 'master' of bitbucket.org:jubilian/fcsc_ipi_backend
This commit is contained in:
commit
67ec8f6214
@ -139,6 +139,16 @@ exports.createEstablishment = async (req, res) => {
|
|||||||
if (existingEstablishment) {
|
if (existingEstablishment) {
|
||||||
return res.status(400).send({status: "failed",message: "Establishment code already exists", });
|
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
|
// Create establishment record
|
||||||
const establishment = await Establishment.create({
|
const establishment = await Establishment.create({
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user