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

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

@ -29,15 +29,16 @@ module.exports = function (fastify, opts, next) {
tankerName: { type: "string" },
phoneNumber: { type: "string"},
typeofwater: {
type: "array",
type: "array",
maxItems: 2500,
items: {
type: "object",
properties: {
typeofwater: { type: "string", default: null },
typeofwater: { type: "string", default: null },
},
},
},
},
capacity: {
type: "array",
maxItems: 2500,
@ -45,10 +46,12 @@ module.exports = function (fastify, opts, next) {
type: "object",
properties: {
capacity: { type: "string", default: null },
},
},
},
},
},
},
security: [
@ -58,7 +61,7 @@ module.exports = function (fastify, opts, next) {
],
},
preHandler: fastify.auth([fastify.authenticate]),
preHandler: fastify.auth([fastify.authenticate]),
handler: tankersController.addTankers,
// onResponse: (request, reply) => {
// validationHandler.sendPhoneVerificationCode(request, reply);
@ -93,8 +96,28 @@ module.exports = function (fastify, opts, next) {
properties: {
tankerName: { type: "string", default: null },
phoneNumber: { type: "string", default: null },
capacity: { type: "number" },
typeofwater: { type: "string", default: null },
typeofwater: {
type: "array",
maxItems: 2500,
items: {
type: "object",
properties: {
typeofwater: { type: "string", default: null },
},
},
},
capacity: {
type: "array",
maxItems: 2500,
items: {
type: "object",
properties: {
capacity: { type: "string", default: null },
},
},
},
},
},
security: [

Loading…
Cancel
Save