|
|
@ -135,6 +135,9 @@ exports.getAllDepartmentsParticularFields = async (req, reply) => {
|
|
|
|
cities: [...new Set(departments.map((doc) => doc.city))],
|
|
|
|
cities: [...new Set(departments.map((doc) => doc.city))],
|
|
|
|
zones: [...new Set(departments.map((doc) => doc.zone))],
|
|
|
|
zones: [...new Set(departments.map((doc) => doc.zone))],
|
|
|
|
pincodes: [...new Set(departments.map((doc) => doc.pincode))],
|
|
|
|
pincodes: [...new Set(departments.map((doc) => doc.pincode))],
|
|
|
|
|
|
|
|
departments: [...new Set(departments.map((doc) => doc.departmentName))],
|
|
|
|
|
|
|
|
states: [...new Set(departments.map((doc) => doc.state))],
|
|
|
|
|
|
|
|
countries: [...new Set(departments.map((doc) => doc.country))],
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Sending the response
|
|
|
|
// Sending the response
|
|
|
@ -393,3 +396,31 @@ exports.getAllDepartmentsParticularFields = async (req, reply) => {
|
|
|
|
reply.status(500).send({ message: err.message });
|
|
|
|
reply.status(500).send({ message: err.message });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.getAllDesignationsParticularFields = async (req, reply) => {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
const departments = await Desgination.find().exec();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Grouping the data
|
|
|
|
|
|
|
|
const result = {
|
|
|
|
|
|
|
|
cities: [...new Set(departments.map((doc) => doc.city))],
|
|
|
|
|
|
|
|
zones: [...new Set(departments.map((doc) => doc.zone))],
|
|
|
|
|
|
|
|
pincodes: [...new Set(departments.map((doc) => doc.pincode))],
|
|
|
|
|
|
|
|
departments: [...new Set(departments.map((doc) => doc.departmentName))],
|
|
|
|
|
|
|
|
states: [...new Set(departments.map((doc) => doc.state))],
|
|
|
|
|
|
|
|
countries: [...new Set(departments.map((doc) => doc.country))],
|
|
|
|
|
|
|
|
designations: [...new Set(departments.map((doc) => doc.desginationName))],
|
|
|
|
|
|
|
|
reportingMangers: [...new Set(departments.map((doc) => doc.reportingManager))],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Sending the response
|
|
|
|
|
|
|
|
reply.send({
|
|
|
|
|
|
|
|
status_code: 200,
|
|
|
|
|
|
|
|
data: result,
|
|
|
|
|
|
|
|
count: departments.length,
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
} catch (err) {
|
|
|
|
|
|
|
|
console.error(err);
|
|
|
|
|
|
|
|
reply.send({ error: err.message });
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|