ashok 1 month ago
commit 7038e7fecf

@ -1854,4 +1854,16 @@ exports.getCitiesBasedState = async (request, reply) => {
};
exports.getStaffDepartmentDetails = async (request, reply) => {
try {
const officeName = request.params.officeName;
const city = request.params.city;
const department = await Deparments.find({ officeName, city });
if (!department) {
return reply.status(404).send({ message: 'Department not found' });
}
reply.send({ department });
} catch (err) {
reply.status(500).send({ message: err.message });
}
};

@ -822,5 +822,24 @@ fastify.route({
},
handler:departmentController.getCitiesBasedState
});
fastify.route({
method: "GET",
url: "/api/staffdepartments/:officeName/:city",
schema: {
tags: ["Department"],
description: "This is for fetching department details based on officeName and city",
summary: "This is for fetching department details based on officeName and city",
params: {
type: "object",
properties: {
officeName: { type: "string" },
city: { type: "string" }
}
}
},
handler: departmentController.getStaffDepartmentDetails
});
next();
};
Loading…
Cancel
Save