Skip to content

Commit

Permalink
changed pass phone no on case search
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronald-pro committed Jan 17, 2024
1 parent 9be6533 commit e252311
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions routes/processes/case.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ router.post("/assign", async (req, res) => {
message: `Client ${clinic_number} does not belong to your facility, the client belongs to ${get_facility.name}`
});



if (!check_user)
return res.json({
success: false,
Expand Down Expand Up @@ -202,19 +200,37 @@ router.put("/assign/update/:clinicNumber", async (req, res) => {
router.get("/search", async (req, res) => {
try {
let clinicNumber = req.query.clinic_number;
let phone_no = req.query.phone_no;

let client = await Client.findOne({
where: {
clinic_number: clinicNumber
}
});

let get_facility = await masterFacility.findOne({
where: {
code: client.mfl_code
},
attributes: ["code", "name"]
});
let check_user = await User.findOne({
where: {
phone_no
}
});

if (!client) {
return res.status(404).json({
success: false,
message: `Clinic number ${clinicNumber} does not exist in the system`
});
}
if (client.mfl_code != check_user.facility_id)
return res.json({
success: false,
message: `Client ${clinicNumber} does not belong to your facility, the client belongs to ${get_facility.name}`
});

const cases = await caseAssign.findOne({
where: {
Expand Down

0 comments on commit e252311

Please sign in to comment.