waterlevel sensors

master
varun 1 year ago
parent 3af54baf9e
commit 6306ca9917

@ -14,9 +14,9 @@ exports.options = {
}, },
// We have to change this beacause this is running on local // We have to change this beacause this is running on local
// we have to run on this on swagger // we have to run on this on swagger
//host: "localhost:3000", //Devlopemnt host on lcoal host: "localhost:3000", //Devlopemnt host on lcoal
host: "35.207.198.4:3000", //Production for swagger //host: "35.207.198.4:3000", //Production for swagger
schemes: ["http"], schemes: ["http"],
consumes: ["application/json"], consumes: ["application/json"],
produces: ["application/json"], produces: ["application/json"],

@ -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