made changes in tankerBooking

master
varun 3 years ago
parent 1378b3bcb1
commit e9b8092a4d

@ -4,6 +4,8 @@ const Tankerbooking = require("../models/tankers");
const User = require("../models/User");
const boom = require("boom");
const fastify = require("fastify")({
logger: true,
});
@ -97,20 +99,19 @@ exports.deleteTankerInfo = async (req, reply) => {
}
};
let bookingCount = 0
exports.tankerBooking = async (req, reply) => {
try {
const date = new Date()
const year = date.getFullYear()
const month = (date.getMonth() + 1).toString().padStart(2, '0')
const day = date.getDate().toString().padStart(2, '0')
const count = bookingCount.toString().padStart(2, '0')
const bookingId = `booking${year}${month}${day}${count}`
//bookingCount = (bookingCount + 1) % 100;
const count = bookingCount.toString().padStart(4, '0')
const bookingId = `ARM${year}${month}${day}${count}`
bookingCount = (bookingCount + 1) % 100;
bookingsData = {
bookingid : bookingId,
typeofwater: req.body.typeofwater,
capacity: req.body.capacity,
address: req.body.address,

Loading…
Cancel
Save