ashok 2 months ago
commit 26ee41ce9b

@ -605,6 +605,31 @@ exports.addDepartment = async (request, reply) => {
}
};
exports.getCityDetails = async (request, reply) => {
try {
const cityId = request.params.cityId;
const data = await City.findOne({ cityId });
if (!data) {
return reply.status(404).send({ message: 'City not found' });
}
reply.send({ data });
} catch (err) {
reply.status(500).send({ message: err.message });
}
};
exports.getBranchDetails = async (request, reply) => {
try {
const branchId = request.params.branchId;
const data = await Branch.findOne({ branchId });
if (!data) {
return reply.status(404).send({ message: 'Branch not found' });
}
reply.send({ data });
} catch (err) {
reply.status(500).send({ message: err.message });
}
};
exports.getSinledepartmentData = async (req, reply) => {
try {
const { departmentId } = req.params;

@ -175,8 +175,38 @@ module.exports = function (fastify, opts, next) {
},
handler: departmentController.editcity,
});
fastify.route({
method: "GET",
url: "/api/city/:cityId",
schema: {
tags: ["Department"],
description: "This is for fetching a City details",
summary: "This is for fetching a City details",
params: {
type: "object",
properties: {
cityId: { type: "string" }
}
}
},
handler: departmentController.getCityDetails
});
fastify.route({
method: "GET",
url: "/api/branch/:branchId",
schema: {
tags: ["Department"],
description: "This is for fetching a Branch details",
summary: "This is for fetching a Branch details",
params: {
type: "object",
properties: {
branchId: { type: "string" }
}
}
},
handler: departmentController.getBranchDetails
});
fastify.route({
method: "POST",
url: "/api/departmentSignup",

Loading…
Cancel
Save