varun 2 years ago
commit a7a6fc7868

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

@ -201,22 +201,33 @@ exports.getTanklevels = async (req, reply) => {
try { try {
const customerId = req.params.customerId; const customerId = req.params.customerId;
const updated_data = await Tank.find({ customerId: 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); throw boom.boomify(err);
} }
}; };
exports.motorAction = async (req, reply) => { exports.motorAction = async (req, reply) => {
try { try {
//let start_time,stop_time //let start_time,stop_time

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

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

Loading…
Cancel
Save