MADE CHANGES IN TANKERS

master
varun 3 years ago
parent 6a328549ec
commit 98f4e8c752

@ -24,7 +24,6 @@ console.log(req.params);
// const updateData = req.body; // const updateData = req.body;
// console.log("This is the reply in the handler after the validations", reply); // console.log("This is the reply in the handler after the validations", reply);
tankersData = { tankersData = {
customerId:customerId, customerId:customerId,
@ -33,7 +32,7 @@ console.log(req.params);
typeofwater: req.body.typeofwater, typeofwater: req.body.typeofwater,
capacity: req.body.capacity, capacity: req.body.capacity,
}; };
console.log(req.body.typeofwater,req.body.capacity)
var tanker_Name = req.body.tankerName var tanker_Name = req.body.tankerName
var i_tank = await Tanker.findOne({ tankerName: tanker_Name,customerId:customerId}) var i_tank = await Tanker.findOne({ tankerName: tanker_Name,customerId:customerId})
@ -55,9 +54,9 @@ console.log(req.params);
tankers.customerId = usertobeInserted.customerId; tankers.customerId = usertobeInserted.customerId;
} }
} }
const insertedTank = await tankers.save(); const insertedTanker = await tankers.save();
return insertedTank; return insertedTanker;
} catch (err) { } catch (err) {

@ -14,8 +14,8 @@ const tankersSchema = new mongoose.Schema({
customerId: { type: String, default: null }, customerId: { type: String, default: null },
tankerName: { type: String, default: null }, tankerName: { type: String, default: null },
phoneNumber: { type: String, default: null }, phoneNumber: { type: String, default: null },
typeofwater: [{ type: String, default: null }], typeofwater: [{ typeofwater: String}],
capacity: [{ type: String, default: null }], capacity: [{ capacity: String}],
}); });

@ -38,6 +38,7 @@ module.exports = function (fastify, opts, next) {
}, },
}, },
}, },
capacity: { capacity: {
type: "array", type: "array",
maxItems: 2500, maxItems: 2500,
@ -49,6 +50,8 @@ module.exports = function (fastify, opts, next) {
}, },
}, },
}, },
}, },
security: [ security: [
@ -93,10 +96,30 @@ module.exports = function (fastify, opts, next) {
properties: { properties: {
tankerName: { type: "string", default: null }, tankerName: { type: "string", default: null },
phoneNumber: { type: "string", default: null }, phoneNumber: { type: "string", default: null },
capacity: { type: "number" }, typeofwater: {
type: "array",
maxItems: 2500,
items: {
type: "object",
properties: {
typeofwater: { type: "string", default: null }, typeofwater: { type: "string", default: null },
}, },
}, },
},
capacity: {
type: "array",
maxItems: 2500,
items: {
type: "object",
properties: {
capacity: { type: "string", default: null },
},
},
},
},
},
security: [ security: [
{ {
basicAuth: [], basicAuth: [],

Loading…
Cancel
Save