|
|
|
@ -201,21 +201,24 @@ const generateDepartmentId = async (city, departmentName) => {
|
|
|
|
|
// }
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
// exports.getallcities = async (req, reply) => {
|
|
|
|
|
// try {
|
|
|
|
|
// await City.find()
|
|
|
|
|
// .exec()
|
|
|
|
|
// .then((docs) => {
|
|
|
|
|
// reply.send({ status_code: 200, data: docs, count: docs.length });
|
|
|
|
|
// })
|
|
|
|
|
// .catch((err) => {
|
|
|
|
|
// console.log(err);
|
|
|
|
|
// reply.send({ error: err });
|
|
|
|
|
// });
|
|
|
|
|
// } catch (err) {
|
|
|
|
|
// throw boom.boomify(err);
|
|
|
|
|
// }
|
|
|
|
|
// };
|
|
|
|
|
exports.getallCompanyNames = async (req, reply) => {
|
|
|
|
|
try {
|
|
|
|
|
await City.find()
|
|
|
|
|
.select("officeName -_id") // Select only officeName and exclude _id
|
|
|
|
|
.exec()
|
|
|
|
|
.then((docs) => {
|
|
|
|
|
const officeNames = docs.map((doc) => doc.officeName); // Extract only officeName values
|
|
|
|
|
reply.send({ status_code: 200, data: officeNames, count: officeNames.length });
|
|
|
|
|
})
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
console.log(err);
|
|
|
|
|
reply.send({ error: err });
|
|
|
|
|
});
|
|
|
|
|
} catch (err) {
|
|
|
|
|
throw boom.boomify(err);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// exports.getAllDepartmentsParticularFields = async (req, reply) => {
|
|
|
|
|