made changes in tankers booking data and tankers.js and controllers

master
varun 3 years ago
parent 834cb59c60
commit 9f213c2038

@ -103,7 +103,8 @@ exports.deleteTankerInfo = async (req, reply) => {
exports.tankerBooking = async (req, reply) => {
try {
var customerId = req.params.customerId;
const customerId = req.params.customerId;
const tankerName = req.body.tankerName;
var b_id = await generateBookingId()
const date = new Date()
const year = date.getFullYear()
@ -118,6 +119,7 @@ exports.tankerBooking = async (req, reply) => {
else {
bookingsData = {
tankerName:tankerName,
customerId:customerId,
bookingid : bookingId,
typeofwater: req.body.typeofwater,
@ -134,6 +136,7 @@ exports.tankerBooking = async (req, reply) => {
usertobeInserted = checkFormEncoding.tankersBookingData;
console.log("thsi true url string");
tankersBookingData.customerId = customerId;
tankersBookingData.tankerName = tankerName;
tankersBookingData.bookingid = bookingId;
tankersBookingData.capacity = usertobeInserted.capacity;
tankersBookingData.typeofwater = usertobeInserted.typeofwater;
@ -144,6 +147,7 @@ exports.tankerBooking = async (req, reply) => {
}
const booking_data = await tankersBookingData.save();
reply.send({ status_code: 200, data: booking_data });
return booking_data;

@ -22,11 +22,13 @@ const tankersSchema = new mongoose.Schema({
const tankersbookingSchema = new mongoose.Schema({
customerId: { type: String, default: null },
tankerName: { type: String, default: null },
bookingid: { type: String, default: null,unique: true },
dateOfOrder: { type: String, default: null },
typeofwater: { type: String, default: null },
capacity: { type: String, default: null },
address: { type: String, default: null },
price: { type: String, default: "750" },
payment_status : { type: String, default: "due" },
//orderStatus: { type: String, default: "due" },
quantityDelivered: { type: String, default: null},

@ -185,10 +185,11 @@ module.exports = function (fastify, opts, next) {
},
},
},
body: {
type: "object",
properties: {
tankerName: {type: 'string'},
typeofwater: { type: "string" },
capacity: { type: "string" },
address: { type: "string" },

Loading…
Cancel
Save