ashok 2 months ago
commit dc6c8ac556

@ -6,7 +6,7 @@ const bcrypt = require('bcrypt')
const fastify = require("fastify");
const { Tank, MotorData, IotData } = require('../models/tanks');
const { Deparments } = require('../models/Department');
const { Deparments, City } = require('../models/Department');
const JWT_SECRET = 'your-secret-key';
async function generateCustomerId(role) {
@ -422,3 +422,20 @@ exports.createUser = async (request, reply) => {
});
}
};
exports.getAllCompanys = async (req, reply) => {
try {
const pendingOrders = await City.find();
return reply.send({
status_code: 200,
message: "Pending orders fetched successfully",
data: pendingOrders,
});
} catch (err) {
console.error("Error fetching pending orders:", err);
return reply.status(500).send({ error: "Internal server error" });
}
};

@ -278,6 +278,16 @@ fastify.post("/api/getDepartmentDetails/:adminId", {
handler: adminController.getDepartmentDetailsByAdminAndName
});
fastify.get("/api/getAllCompanies", {
schema: {
tags: ["Admin"],
description: "Get all Companies List",
summary: "Get all Companies List",
},
handler: adminController.getAllCompanys,
});
next();
};

Loading…
Cancel
Save