ashok 2 years ago
commit a8da1c205f

@ -638,69 +638,69 @@ module.exports = function (fastify, opts, next) {
fastify.post('/api/motor/write', { // fastify.post('/api/motor/write', {
schema: { // schema: {
tags: ["Tank"], // tags: ["Tank"],
description: "This is to Write the motor status", // description: "This is to Write the motor status",
summary: "This is to Write the motor status", // summary: "This is to Write the motor status",
body: { // body: {
type: 'object', // type: 'object',
required: ['motor_id', 'status'], // required: ['motor_id', 'status'],
properties: { // properties: {
motor_id: { type: 'string' }, // motor_id: { type: 'string' },
status: { type: 'string', enum: ['on', 'off'] }, // status: { type: 'string', enum: ['on', 'off'] },
current: { type: 'string' }, // current: { type: 'string' },
temp: { type: 'string' }, // temp: { type: 'string' },
}, // },
}, // },
// response: { // // response: {
// 200: { // // 200: {
// type: 'object', // // type: 'object',
// properties: { // // properties: {
// // Define your response properties here // // // Define your response properties here
// motor_id: { type: 'string' }, // // motor_id: { type: 'string' },
// status: { type: 'string' }, // // status: { type: 'string' },
// current: { type: 'string' }, // // current: { type: 'string' },
// temp: { type: 'string' }, // // temp: { type: 'string' },
// // Add other properties as needed // // // Add other properties as needed
// }, // // },
// }, // // },
// }, // // },
}, // },
handler: tanksController.writeMotorStatus // handler: tanksController.writeMotorStatus
}); // });
fastify.get('/api/motor/read', { // fastify.get('/api/motor/read', {
schema: { // schema: {
tags: ["Tank"], // tags: ["Tank"],
description: "This is to Read the motor status", // description: "This is to Read the motor status",
summary: "This is to Read the motor status", // summary: "This is to Read the motor status",
querystring: { // querystring: {
type: 'object', // type: 'object',
properties: { // properties: {
motor_id: { type: 'string' }, // motor_id: { type: 'string' },
action: { type: 'string', enum: ['1', '2'] }, // action: { type: 'string', enum: ['1', '2'] },
}, // },
required: ['motor_id', 'action'], // required: ['motor_id', 'action'],
}, // },
// response: { // // response: {
// 200: { // // 200: {
// type: 'object', // // type: 'object',
// properties: { // // properties: {
// // Define your response properties here // // // Define your response properties here
// motor_id: { type: 'string' }, // // motor_id: { type: 'string' },
// motor_status: { type: 'string' }, // // motor_status: { type: 'string' },
// motor_speed: { type: 'string' }, // // motor_speed: { type: 'string' },
// motor_temperature: { type: 'string' }, // // motor_temperature: { type: 'string' },
// // Add other properties as needed // // // Add other properties as needed
// }, // // },
// }, // // },
// }, // // },
}, // },
handler: tanksController.readMotorStatus // handler: tanksController.readMotorStatus
}); // });

Loading…
Cancel
Save