changes in starta and stop

master^2
Varun 5 months ago
parent 644630e53a
commit ec82d9281a

@ -2880,7 +2880,34 @@ exports.motoractiontest = async (req, reply) => {
}
};
exports.motoractiontestbeforeqc = async (req, reply) => {
try {
if (action === "start") {
await this.publishMotorStopStatus(motor_id, "2");
} else if (action === "stop") {
await this.publishMotorStopStatus(motor_id, "1");
} else {
return reply.status(400).send({ success: false, message: "Invalid action" });
}
return reply.send({ success: true, message: `Motor ${action} command sent.` });
} catch (error) {
console.error("Error fetching data:", error);
return reply.status(500).send({ success: false, message: "Internal Server Error" });
}
};
const motorIntervals = {};

@ -415,6 +415,41 @@ module.exports = function (fastify, opts, next) {
});
fastify.route({
method: "PUT",
url: "/api/motoractiontestbeforeqc",
schema: {
tags: ["Install"],
summary: "This is for start and stop test before qc",
body: {
type: "object",
// required: ['phone'],
properties: {
motor_id:{type:"string"},
action:{type:"string"},
},
},
security: [
{
basicAuth: [],
},
],
},
// preHandler: [
// fastify.auth([fastify.operatorAuthenticate]),
// validationHandler.validatePhoneFormat,
// ],
//preHandler: fastify.auth([fastify.authenticate]),
handler: tanksController.motoractiontestbeforeqc,
});
// fastify.route({
// method: "PUT",
// url: "/api/consumption/:customerId",

Loading…
Cancel
Save