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

Loading…
Cancel
Save