varun 3 years ago
commit 0e0398d5c8

@ -633,3 +633,17 @@ exports.connectstatus = async (req, reply) => {
//delete selected bookingid
exports.deleteBookingInfo = async (req, reply) => {
try {
var bookingid = req.params.bookingid;
const booking = await Tankerbooking.findOneAndDelete({ bookingid:bookingid });
reply.send({ status_code: 200, data: booking});
// return tank;
} catch (err) {
throw boom.boomify(err);
}
};

@ -60,10 +60,10 @@ exports.friendRequest = async (request, reply) => {
exports.friendRequestAccept = async (request, reply) => {
try {
//const {friendRequestId} = request.body;
const {supplierId} = request.body;
const {supplierId,customerId} = request.body;
// Update the friend request status to 'accepted'
// const friendRequest = await FriendRequest.findByIdAndUpdate(friendRequestId, { status: 'accepted' });
const friendRequest = await FriendRequest.findOneAndUpdate({supplierId}, { status: 'accepted' });
const friendRequest = await FriendRequest.findOneAndUpdate({supplierId,customerId }, { status: 'accepted' });
console.log("friendRequest....---", friendRequest)
@ -82,10 +82,10 @@ exports.friendRequestAccept = async (request, reply) => {
exports.friendRequestReject = async (request, reply) => {
try {
//const {friendRequestId} = request.body;
const {supplierId} = request.body;
const {supplierId, customerId} = request.body;
// Update the friend request status to 'rejected'
// const friendRequest = await FriendRequest.findByIdAndUpdate(friendRequestId, { status: 'rejected' });
const friendRequest = await FriendRequest.findOneAndUpdate({supplierId}, { status: 'rejected' });
const friendRequest = await FriendRequest.findOneAndUpdate({supplierId, customerId}, { status: 'rejected' });
console.log("friendRequest....---", friendRequest)

@ -32,7 +32,7 @@ module.exports = function (fastify, opts, next) {
fastify.route({
method: "PUT",
url: "/api/friend-request/:id/accept",
url: "/api/friend-request/accept",
schema: {
tags: ["Friend-Request"],
description: "This is for supplier accept the friend request",
@ -40,7 +40,8 @@ module.exports = function (fastify, opts, next) {
body: {
type: "object",
properties: {
supplierId: { type: "string" }
supplierId: { type: "string" },
customerId: { type: "string" }
},
},
@ -54,7 +55,7 @@ module.exports = function (fastify, opts, next) {
});
fastify.route({
method: "PUT",
url: "/api/friend-request/:id/reject",
url: "/api/friend-request/reject",
schema: {
tags: ["Friend-Request"],
description: "This is for supplier reject the friend request",
@ -64,7 +65,7 @@ module.exports = function (fastify, opts, next) {
type: "object",
properties: {
supplierId: { type: "string" },
customerId: { type: "string" }
},
},
security: [

@ -702,6 +702,35 @@ module.exports = function (fastify, opts, next) {
handler: tankersController.getAllTankersaccepted,
});
fastify.route({
method: "PUT",
url: "/api/deleteBookingInfo/:bookingid",
schema: {
tags: ["Supplier-Order"],
summary: "This is for delete Booking Info",
params: {
required: ["bookingid"],
type: "object",
properties: {
bookingid: {
type: "string",
description: "bookingid",
},
},
},
security: [
{
basicAuth: [],
},
],
},
preHandler: fastify.auth([fastify.authenticate]),
handler: tankersController.deleteBookingInfo,
});
next();
}

Loading…
Cancel
Save