This is for integrating hardwareId with tank along with hardwareId type and company

master
varun 2 years ago
parent 76b3bf9836
commit c7639331b4

@ -74,8 +74,8 @@ exports.adminSignUp = async (request, reply) => {
exports.integratingHardwareidToTank = async (request, reply) => {
try {
const { customerId, tankName,tankLocation,hardwareId } = request.body
const tank = await Tank.findOneAndUpdate({customerId, tankName:tankName ,tankLocation:tankLocation.toLowerCase()}, { $set: { hardwareId: hardwareId } });
const { customerId, tankName,tankLocation,hardwareId,hardwareId_company,hardwareId_type } = request.body
const tank = await Tank.findOneAndUpdate({customerId, tankName:tankName ,tankLocation:tankLocation.toLowerCase()}, { $set: { hardwareId: hardwareId,hardwareId_company:hardwareId_company,hardwareId_type:hardwareId_type } });
reply.send({ status_code: 200, message:`${hardwareId} set to ${tankName}` });
} catch (err) {

@ -210,6 +210,8 @@ exports.deliveryboystartandstop = async (req, reply) => {
const receiver_tank = bookingdata.tankName
// console.log(receiver_tank,"5")
const receiver_tank_info = await Tank.findOne({ customerId ,tankName:receiver_tank,tankLocation:"sump"});
// console.log(receiver_tank_info,"1")
const receiver_capacity = parseInt((receiver_tank_info.capacity).replace(/,/g, ''), 10)

@ -11,6 +11,8 @@ const code = Math.floor(100000 + Math.random() * 900000);
const RoleSchema = new Schema({ name: String });
const tanksSchema = new mongoose.Schema({
hardwareId: { type: String },
hardwareId_type: { type: String },
hardwareId_company: { type: String },
customerId: { type: String, default: null },
tankName: { type: String, default: null },
blockName: { type: String, default: null },

@ -56,6 +56,8 @@ fastify.post("/api/integratingHardwareidToTank", {
type: "object",
properties: {
hardwareId_company:{ type: "string" },
hardwareId_type:{ type: "string" },
customerId: { type: "string" },
tankName: { type: "string" },
tankLocation: { type: "string" },

Loading…
Cancel
Save