varun 2 years ago
commit a7a6fc7868

@ -625,9 +625,9 @@ exports.getAllOrderreject = async (req, reply) => {
const limit = parseInt(req.query.limit) || 100;
const page = parseInt(req.query.page) || 1;
const startindex = (page - 1) * limit;
const customerId = req.params.customerId
//const customerId = req.params.customerId
try {
await Tankerbooking.find({ customerId: customerId, orderStatus: ["rejected"]})
await Tankerbooking.find({ orderStatus: ["rejected"]})
.limit(limit)
.skip(startindex)
.exec()

@ -201,22 +201,33 @@ exports.getTanklevels = async (req, reply) => {
try {
const customerId = req.params.customerId;
const updated_data = await Tank.find({ customerId: customerId });
reply.send({ status_code: 200, data: updated_data});
let sumSumpDrinkingWater = 0;
let sumOverheadDrinkingWater = 0;
return { message: 'success' };
}
updated_data.forEach((tank) => {
if (tank.tankLocation === 'sump' && tank.typeOfWater === 'Drinking Water') {
sumSumpDrinkingWater += parseInt(tank.waterlevel);
} else if (tank.tankLocation === 'overhead' && tank.typeOfWater === 'Drinking Water') {
sumOverheadDrinkingWater += parseInt(tank.waterlevel);
}
});
catch (err) {
reply.send({
status_code: 200,
data: updated_data,
totalDrinkingWaterInSump: sumSumpDrinkingWater,
totalDrinkingWaterInOverhead: sumOverheadDrinkingWater
});
return { message: 'success' };
} catch (err) {
throw boom.boomify(err);
}
};
exports.motorAction = async (req, reply) => {
try {
//let start_time,stop_time

@ -506,16 +506,16 @@ module.exports = function (fastify, opts, next) {
tags: ["Supplier-Order"],
description:"This is for Get All order cancelled",
summary: "This is for Get All order cancelled",
params: {
required: ["customerId"],
type: "object",
properties: {
customerId: {
type: "string",
description: "customerId",
},
},
},
// params: {
// required: ["customerId"],
// type: "object",
// properties: {
// customerId: {
// type: "string",
// description: "customerId",
// },
// },
// },
security: [
{

@ -31,30 +31,32 @@ module.exports = function (fastify, opts, next) {
tankerName: { type: "string" },
phoneNumber: { type: "string"},
alternative_phoneNumber: { type: "string"},
typeofwater: {
type: "array",
maxItems: 2500,
items: {
type: "object",
properties: {
typeofwater: { type: "string", default: null },
},
},
},
// typeofwater: {
// type: "array",
// maxItems: 2500,
// items: {
// type: "object",
// properties: {
// typeofwater: { type: "string", default: null },
// },
// },
// },
price: {
type: "array",
maxItems: 2500,
items: {
type: "object",
properties: {
price: { type: "string", default: null },
},
},
},
// price: {
// type: "array",
// maxItems: 2500,
// items: {
// type: "object",
// properties: {
// price: { type: "string", default: null },
// },
// },
// },
typeofwater: { type: "string"},
price: { type: "string"},
capacity: { type: "string"},
// price: {type : "string"},
// status: {type: "string"}
// status: {type: "string"}
@ -104,27 +106,29 @@ module.exports = function (fastify, opts, next) {
tankerName: { type: "string" },
phoneNumber: { type: "string"},
alternative_phoneNumber: { type: "string"},
typeofwater: {
type: "array",
maxItems: 2500,
items: {
type: "object",
properties: {
typeofwater: { type: "string", default: null },
},
},
},
// typeofwater: {
// type: "array",
// maxItems: 2500,
// items: {
// type: "object",
// properties: {
// typeofwater: { type: "string", default: null },
// },
// },
// },
price: {
type: "array",
maxItems: 2500,
items: {
type: "object",
properties: {
price: { type: "string", default: null },
},
},
},
// price: {
// type: "array",
// maxItems: 2500,
// items: {
// type: "object",
// properties: {
// price: { type: "string", default: null },
// },
// },
// },
typeofwater: { type: "string"},
price: { type: "string"},
capacity: { type: "string"},

Loading…
Cancel
Save