From e9b8092a4d70e1825fea3bbb7a7c0a6c2c970097 Mon Sep 17 00:00:00 2001 From: varun Date: Tue, 31 Jan 2023 00:44:14 -0500 Subject: [PATCH] made changes in tankerBooking --- src/controllers/tankersController.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/controllers/tankersController.js b/src/controllers/tankersController.js index d303833d..b8ff9341 100644 --- a/src/controllers/tankersController.js +++ b/src/controllers/tankersController.js @@ -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,