|
|
|
@ -6455,21 +6455,21 @@ exports.updatetankstatus = async (req, reply) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exports.listofactiveandinactivetankstatus = async (req, reply) => {
|
|
|
|
|
try {
|
|
|
|
|
const { customerId } = req.params;
|
|
|
|
|
const status = req.query.status.toLowerCase();
|
|
|
|
|
// exports.listofactiveandinactivetankstatus = async (req, reply) => {
|
|
|
|
|
// try {
|
|
|
|
|
// const { customerId } = req.params;
|
|
|
|
|
// const status = req.query.status.toLowerCase();
|
|
|
|
|
|
|
|
|
|
if (!["active", "inactive"].includes(status)) {
|
|
|
|
|
return reply.code(400).send({ message: "Invalid status value" });
|
|
|
|
|
}
|
|
|
|
|
// if (!["active", "inactive"].includes(status)) {
|
|
|
|
|
// return reply.code(400).send({ message: "Invalid status value" });
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// Find tanks based on customerId and status
|
|
|
|
|
const tanks = await Tank.find({ customerId, status });
|
|
|
|
|
// // Find tanks based on customerId and status
|
|
|
|
|
// const tanks = await Tank.find({ customerId, status });
|
|
|
|
|
|
|
|
|
|
return reply.send({ tanks });
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error("Error fetching tank list:", error);
|
|
|
|
|
return reply.code(500).send({ message: "Internal Server Error" });
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
// return reply.send({ tanks });
|
|
|
|
|
// } catch (error) {
|
|
|
|
|
// console.error("Error fetching tank list:", error);
|
|
|
|
|
// return reply.code(500).send({ message: "Internal Server Error" });
|
|
|
|
|
// }
|
|
|
|
|
// };
|
|
|
|
|