changes reverted list of tanks

master^2
Varun 9 months ago
parent 1a4a35bb38
commit abe8f01233

@ -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" });
// }
// };

@ -1270,29 +1270,29 @@ module.exports = function (fastify, opts, next) {
});
fastify.route({
method: "GET",
url: "/api/listofactiveandinactivetankstatus/:customerId",
schema: {
tags: ["Tank"],
summary: "Get list of active or inactive tanks",
params: {
required: ["customerId"],
type: "object",
properties: {
customerId: { type: "string", description: "Customer ID" },
},
},
querystring: {
type: "object",
properties: {
status: { type: "string"},
},
},
security: [{ basicAuth: [] }],
},
handler: tanksController.listofactiveandinactivetankstatus,
});
// fastify.route({
// method: "GET",
// url: "/api/listofactiveandinactivetankstatus/:customerId",
// schema: {
// tags: ["Tank"],
// summary: "Get list of active or inactive tanks",
// params: {
// required: ["customerId"],
// type: "object",
// properties: {
// customerId: { type: "string", description: "Customer ID" },
// },
// },
// querystring: {
// type: "object",
// properties: {
// status: { type: "string"},
// },
// },
// security: [{ basicAuth: [] }],
// },
// handler: tanksController.listofactiveandinactivetankstatus,
// });
next();

Loading…
Cancel
Save