for the below code inorder for branch statistician role to see their approved quotations…
- User
for the below code inorder for branch statistician role to see their approved quotations with status QuotationStatus.Statistician_Approved what change must i make
- Assistant
As an AI language model, I can only provide you the answer based on assumptions. However, if you provide me with the code snippet, I can provide you with the required changes to fetch approved quotations with QuotationStatus.Statistician_Approved for the branch statisticians role.
- User
else if (req.user?.role === rolesNum["BRANCH STATISTICIAN"]) { const supervisors = await prisma.user.findMany({ where: { supervisorId: req.user?.id, }, }); regionCodeOrCodes = supervisors.map((el) => el.id); query.status = QuotationStatus.SUPERVISOR_APPROVED; }
- Assistant
To fetch approved quotations with the status QuotationStatus.Statistician_Approved for the Branch Statistician role, you'll need to make the below changes:
else if (req.user?.role === rolesNum["BRANCH STATISTICIAN"]) { query.status = QuotationStatus.STATISTICIAN_APPROVED; const supervisors = await prisma.user.findMany({ where: { supervisorId: req.user?.id, }, }); regionCodeOrCodes = supervisors.map((el) => el.id); }Here, we have changed the value of query.status to QuotationStatus.STATISTICIAN_APPROVED to filter and fetch quotations with approved status QuotationStatus.Statistician_Approved. This query will fetch quotations that are approved by Statistician.