Skip to content

Commit

Permalink
fixed error on posting cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronald-pro committed Jan 17, 2024
1 parent 891b0dc commit 9be6533
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions routes/processes/case.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const { date } = require("joi");
const { caseAssign } = require("../../models/case_assign");
const { Client } = require("../../models/client");
const { User } = require("../../models/user");
const { masterFacility } = require("../../models/master_facility");

router.post("/assign", async (req, res) => {
let phone_no = req.body.phone_no;
Expand All @@ -30,6 +31,11 @@ router.post("/assign", async (req, res) => {
},
attributes: ["code", "name"]
});
let check_user = await User.findOne({
where: {
phone_no
}
});

if (!check_client)
return res.json({
Expand All @@ -42,11 +48,7 @@ router.post("/assign", async (req, res) => {
message: `Client ${clinic_number} does not belong to your facility, the client belongs to ${get_facility.name}`
});

let check_user = await User.findOne({
where: {
phone_no
}
});


if (!check_user)
return res.json({
Expand Down

0 comments on commit 9be6533

Please sign in to comment.