ashok 1 year ago
commit af36698c79

@ -500,7 +500,8 @@ exports.addStore = async (request, reply) => {
const moment = require('moment'); const moment = require('moment');
exports.createwaterlevelSensor = async (req, reply) => { exports.createwaterlevelSensor = async (req, reply) => {
try { try {
const { hardwareId,hardwareId_company, type, indate,storeId } = req.body; const storeId = req.params.storeId
const { hardwareId,hardwareId_company, type, indate } = req.body;
var mater_seq_id = await generatewaterlevelsensorId(); var mater_seq_id = await generatewaterlevelsensorId();
const date = moment().format('MM-DD'); const date = moment().format('MM-DD');
const prefix = 'AS-' + date + '--MALOV1-'; const prefix = 'AS-' + date + '--MALOV1-';

@ -165,7 +165,7 @@ const installationschema = new mongoose.Schema({
const waterLeverSensorInSchema = new mongoose.Schema({ const waterLeverSensorInSchema = new mongoose.Schema({
storeeId:{ type: String }, storeId:{ type: String },
hardwareId: { type: String }, hardwareId: { type: String },
masterId: { type: String, default: null }, masterId: { type: String, default: null },
type: { type: String }, type: { type: String },

@ -123,17 +123,27 @@ fastify.post('/api/stores', {
fastify.post("/api/createwaterlevelSensor", { fastify.post("/api/createwaterlevelSensor/:storeId", {
schema: { schema: {
description: "This is for creating waterlevel Sensor", description: "This is for creating waterlevel Sensor",
tags: ["Store-Data"], tags: ["Store-Data"],
summary: "This is for creating waterlevel Sensor", summary: "This is for creating waterlevel Sensor",
params: {
required: ["storeId"],
type: "object",
properties: {
storeId: {
type: "string",
description: "storeId",
},
},
},
body: { body: {
type: "object", type: "object",
properties: { properties: {
storeId: { type: "string" },
hardwareId: { type: "string" }, hardwareId: { type: "string" },
type: { type: "string" }, type: { type: "string" },
indate: { type: "string" }, indate: { type: "string" },

Loading…
Cancel
Save