|
|
@ -328,42 +328,43 @@ module.exports = function (fastify, opts, next) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fastify.route({
|
|
|
|
fastify.route({
|
|
|
|
method: "POST",
|
|
|
|
method: "POST",
|
|
|
|
url: "/api/APIWrite",
|
|
|
|
url: "/api/APIWrite",
|
|
|
|
schema: {
|
|
|
|
schema: {
|
|
|
|
tags: ["Tank"],
|
|
|
|
tags: ["Tank"],
|
|
|
|
description: "This is for cretae IOT Device",
|
|
|
|
description: "This is for creating an IOT Device",
|
|
|
|
summary: "This is for Create IOT Device.",
|
|
|
|
summary: "Create IOT Device",
|
|
|
|
|
|
|
|
body: {
|
|
|
|
body: {
|
|
|
|
type: "object",
|
|
|
|
type: "object",
|
|
|
|
properties: {
|
|
|
|
properties: {
|
|
|
|
hardwareId: { type: "string" },
|
|
|
|
hardwareId: { type: "string" },
|
|
|
|
mode: { type: "string" },
|
|
|
|
tankHeight: { type: "string"},
|
|
|
|
tanks: {
|
|
|
|
maxLevel: { type: "string" },
|
|
|
|
type: "array",
|
|
|
|
minLevel: { type: "string" },
|
|
|
|
items: {
|
|
|
|
tankhardwareId:{ type: "string" },
|
|
|
|
type: "object",
|
|
|
|
mode: { type: "string" },
|
|
|
|
properties: {
|
|
|
|
|
|
|
|
tankhardwareId: { type: "string" },
|
|
|
|
|
|
|
|
tankHeight: { type: "string" },
|
|
|
|
|
|
|
|
maxLevel: { type: "string" },
|
|
|
|
|
|
|
|
minLevel: { type: "string" }
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
required: ["tankhardwareId", "tankHeight", "maxLevel", "minLevel"]
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
required: ["hardwareId", "mode", "tanks"]
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
security: [
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
basicAuth: []
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
]
|
|
|
|
},
|
|
|
|
},
|
|
|
|
security: [
|
|
|
|
handler: tanksController.IotDevice
|
|
|
|
{
|
|
|
|
});
|
|
|
|
basicAuth: [],
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
// preHandler: [
|
|
|
|
|
|
|
|
// fastify.auth([fastify.operatorAuthenticate]),
|
|
|
|
|
|
|
|
// validationHandler.validatePhoneFormat,
|
|
|
|
|
|
|
|
// ],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
handler: tanksController.IotDevice,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fastify.get("/api/APIRead", {
|
|
|
|
fastify.get("/api/APIRead", {
|
|
|
|
schema: {
|
|
|
|
schema: {
|
|
|
|