You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
916 B
39 lines
916 B
3 years ago
|
|
||
|
const Supplier = require("../models/supplier");
|
||
|
const boom = require("boom");
|
||
|
const fastify = require("fastify")({
|
||
|
logger: true,
|
||
|
});
|
||
|
const { Tanker, Tankerbooking,Bore,GovtPipeLine } = require('../models/tankers')
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
exports.orderNow = async (req, reply) => {
|
||
|
|
||
|
try {
|
||
|
const customerId = req.body.customerId;
|
||
|
const bookingId = req.params.bookingId;
|
||
|
const tankerName = req.body.tankerName;
|
||
|
const booking_info = await Tankerbooking.findOne({ bookingid: bookingId})
|
||
|
const action = req.body.action
|
||
|
const typeofwater = req.body.typeofwater
|
||
|
|
||
|
if(action === "accept"){
|
||
|
booking_info.orderStatus = "accepted"
|
||
|
booking_info.price = "500"
|
||
|
|
||
|
}
|
||
|
else {
|
||
|
booking_info.orderStatus = "rejected"
|
||
|
|
||
|
}
|
||
|
|
||
|
const booking = await booking_info.save();
|
||
|
return booking;
|
||
|
|
||
|
} catch (err) {
|
||
|
throw boom.boomify(err);
|
||
|
}
|
||
|
};
|
||
|
|