varun 3 years ago
parent fe7d35368e
commit 798761d3ba

@ -110,10 +110,10 @@ exports.tankerBooking = async (req, reply) => {
const bookingId = `ARM${year}${month}${day}${count}` const bookingId = `ARM${year}${month}${day}${count}`
bookingCount = (bookingCount + 1) % 100; bookingCount = (bookingCount + 1) % 100;
var booking_id = await Tankerbooking.findOne({ bookingid: bookingId}) var booking_id = await Tankerbooking.findOne({ bookingid: bookingId})
if(booking_id){ // if(booking_id){
reply.redirect(tankerBooking()) // reply.redirect(tankerBooking())
} // }
else { // else {
bookingsData = { bookingsData = {
bookingid : bookingId, bookingid : bookingId,
@ -138,7 +138,7 @@ exports.tankerBooking = async (req, reply) => {
} }
} //}
const booking_data = await tankersBookingData.save(); const booking_data = await tankersBookingData.save();

@ -20,7 +20,7 @@ const tankersSchema = new mongoose.Schema({
const tankersbookingSchema = new mongoose.Schema({ const tankersbookingSchema = new mongoose.Schema({
bookingid: { type: String, default: null }, bookingid: { type: String, default: null,unique: true },
typeofwater: { type: String, default: null }, typeofwater: { type: String, default: null },
capacity: { type: String, default: null }, capacity: { type: String, default: null },
address: { type: String, default: null }, address: { type: String, default: null },

Loading…
Cancel
Save