locations list in admin

master^2
Bhaskar 8 months ago
parent 32e4c36069
commit 7d6c1a5544

@ -446,6 +446,17 @@ exports.addDepartment = async (request, reply) => {
throw boom.boomify(err);
}
};
exports.getallLocationData = async (req, reply) => {
try {
console.log("Fetching all zones..."); // Debug log
const locations = await Deparments.distinct('location');
reply.send({ status_code: 200, data: locations, count: locations.length });
} catch (err) {
console.error("Error fetching cities:", err); // Log the error for debugging
throw boom.boomify(err);
}
};
exports.deletedepartmentInfo = async (req, reply) => {
try {

@ -266,6 +266,23 @@ module.exports = function (fastify, opts, next) {
//preHandler: fastify.auth([fastify.authenticate]),
handler: departmentController.getallZonesData,
});
fastify.get("/api/getalllocationsdata", {
schema: {
tags: ["Department"],
description: "This is for Get all Locations Data",
summary: "This is for to Get all Locations Data",
security: [
{
basicAuth: [],
},
],
},
//preHandler: fastify.auth([fastify.authenticate]),
handler: departmentController.getallLocationData,
});
fastify.delete("/api/deletedepartment/:departmentId", {
schema: {
description: "Delete a Department by departmentId",

Loading…
Cancel
Save