|
|
|
@ -445,7 +445,7 @@ module.exports = function (fastify, opts, next) {
|
|
|
|
|
properties: {
|
|
|
|
|
work_status: {
|
|
|
|
|
type: 'string',
|
|
|
|
|
enum: ['active', 'pending', 'complete','waiting'], // update enum based on what your Orders schema allows
|
|
|
|
|
enum: ['active', 'pending', 'complete','waiting','reject'], // update enum based on what your Orders schema allows
|
|
|
|
|
description: 'New work status to set in master_connections'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -482,6 +482,34 @@ module.exports = function (fastify, opts, next) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
fastify.put('/api/tanks/:customerId/:teamMemberId/:hardwareId/:tankHardwareId', {
|
|
|
|
|
schema: {
|
|
|
|
|
tags: ['Installation'],
|
|
|
|
|
summary: 'Update tank dimensions',
|
|
|
|
|
description: 'Edit tank details (height, width, length) by customerId, teamMemberId, hardwareId and tankHardwareId.',
|
|
|
|
|
params: {
|
|
|
|
|
type: 'object',
|
|
|
|
|
required: ['customerId', 'teamMemberId', 'hardwareId', 'tankHardwareId'],
|
|
|
|
|
properties: {
|
|
|
|
|
customerId: { type: 'string', description: 'Customer ID' },
|
|
|
|
|
teamMemberId: { type: 'string', description: 'Team member ID' },
|
|
|
|
|
hardwareId: { type: 'string', description: 'Master hardwareId' },
|
|
|
|
|
tankHardwareId: { type: 'string', description: 'Tank hardwareId' }
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
body: {
|
|
|
|
|
type: 'object',
|
|
|
|
|
//required: ['height', 'width', 'length'],
|
|
|
|
|
properties: {
|
|
|
|
|
height: { type: 'string', description: 'New tank height' },
|
|
|
|
|
width: { type: 'string', description: 'New tank width' },
|
|
|
|
|
length: { type: 'string', description: 'New tank length' }
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
handler : installationController.editTankDimensions
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fastify.post(
|
|
|
|
@ -593,6 +621,81 @@ fastify.post(
|
|
|
|
|
handler: installationController.getMasterSlaveSummary,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
fastify.get('/api/master-with-slaves/:installationId/:customerId/:hardwareId', {
|
|
|
|
|
schema: {
|
|
|
|
|
tags: ['Installation'],
|
|
|
|
|
summary: 'Get Individual master device and its connected slaves',
|
|
|
|
|
description: 'Fetch a master device from Insensors by hardwareId and list all connected slave devices for the same customer and installation.',
|
|
|
|
|
params: {
|
|
|
|
|
type: 'object',
|
|
|
|
|
required: ['installationId', 'customerId', 'hardwareId'],
|
|
|
|
|
properties: {
|
|
|
|
|
installationId: { type: 'string', description: 'Installation ID from Order' },
|
|
|
|
|
customerId: { type: 'string', description: 'Customer ID' },
|
|
|
|
|
hardwareId: { type: 'string', description: 'Master hardwareId' },
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// response: {
|
|
|
|
|
// 200: {
|
|
|
|
|
// type: 'object',
|
|
|
|
|
// properties: {
|
|
|
|
|
// success: { type: 'boolean' },
|
|
|
|
|
// master: {
|
|
|
|
|
// type: 'object',
|
|
|
|
|
// description: 'Master device details',
|
|
|
|
|
// properties: {
|
|
|
|
|
// _id: { type: 'string' },
|
|
|
|
|
// hardwareId: { type: 'string' },
|
|
|
|
|
// customerId: { type: 'string' },
|
|
|
|
|
// type: { type: 'string' },
|
|
|
|
|
// // Add other master fields as needed...
|
|
|
|
|
// }
|
|
|
|
|
// },
|
|
|
|
|
// slaves: {
|
|
|
|
|
// type: 'array',
|
|
|
|
|
// description: 'List of connected slave devices',
|
|
|
|
|
// items: {
|
|
|
|
|
// type: 'object',
|
|
|
|
|
// properties: {
|
|
|
|
|
// _id: { type: 'string' },
|
|
|
|
|
// hardwareId: { type: 'string' },
|
|
|
|
|
// connected_to: { type: 'string' },
|
|
|
|
|
// customerId: { type: 'string' },
|
|
|
|
|
// type: { type: 'string' },
|
|
|
|
|
// // Add other slave fields as needed...
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// },
|
|
|
|
|
// 400: {
|
|
|
|
|
// type: 'object',
|
|
|
|
|
// properties: {
|
|
|
|
|
// success: { type: 'boolean' },
|
|
|
|
|
// message: { type: 'string' }
|
|
|
|
|
// }
|
|
|
|
|
// },
|
|
|
|
|
// 404: {
|
|
|
|
|
// type: 'object',
|
|
|
|
|
// properties: {
|
|
|
|
|
// success: { type: 'boolean' },
|
|
|
|
|
// message: { type: 'string' }
|
|
|
|
|
// }
|
|
|
|
|
// },
|
|
|
|
|
// 500: {
|
|
|
|
|
// type: 'object',
|
|
|
|
|
// properties: {
|
|
|
|
|
// success: { type: 'boolean' },
|
|
|
|
|
// message: { type: 'string' }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
},
|
|
|
|
|
handler: installationController.getMasterWithSlaves,
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fastify.get("/api/getwaitingmasterlistwithslaves/:customerId", {
|
|
|
|
|
schema: {
|
|
|
|
|
description: "Get waiting manager masrter connected slave data with full info",
|
|
|
|
|