|
|
|
const fastify = require("fastify");
|
|
|
|
const tankersController = require("../controllers/tankersController.js");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = function (fastify, opts, next) {
|
|
|
|
|
|
|
|
fastify.route({
|
|
|
|
method: "POST",
|
|
|
|
url: "/api/addTankers/:supplierId",
|
|
|
|
schema: {
|
|
|
|
tags: ["Tanker-Data"],
|
|
|
|
description: "This is to cretae New Tanker",
|
|
|
|
summary: "This is to Create New Tanker.",
|
|
|
|
params: {
|
|
|
|
required: ["supplierId"],
|
|
|
|
type: "object",
|
|
|
|
properties: {
|
|
|
|
supplierId: {
|
|
|
|
type: "string",
|
|
|
|
description: "supplierId",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
body: {
|
|
|
|
type: "object",
|
|
|
|
properties: {
|
|
|
|
supplier_name: { type: "string" },
|
|
|
|
supplier_address:{ type: "string" },
|
|
|
|
tankerName: { type: "string" },
|
|
|
|
phoneNumber: { type: "string"},
|
|
|
|
alternative_phoneNumber: { type: "string"},
|
|
|
|
typeofwater: {
|
|
|
|
type: "array",
|
|
|
|
maxItems: 2500,
|
|
|
|
items: {
|
|
|
|
type: "object",
|
|
|
|
properties: {
|
|
|
|
typeofwater: { type: "string", default: null },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
price: {
|
|
|
|
type: "array",
|
|
|
|
maxItems: 2500,
|
|
|
|
items: {
|
|
|
|
type: "object",
|
|
|
|
properties: {
|
|
|
|
price: { type: "string", default: null },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
capacity: { type: "string"},
|
|
|
|
// price: {type : "string"},
|
|
|
|
// status: {type: "string"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
security: [
|
|
|
|
{
|
|
|
|
basicAuth: [],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
|
|
|
|
},
|
|
|
|
preHandler: fastify.auth([fastify.authenticate]),
|
|
|
|
handler: tankersController.addTankers,
|
|
|
|
// onResponse: (request, reply) => {
|
|
|
|
// validationHandler.sendPhoneVerificationCode(request, reply);
|
|
|
|
// },
|
|
|
|
//onResponse: validationHandler.sendPhoneVerificationCode,
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//update tankers
|
|
|
|
fastify.route({
|
|
|
|
method: "PUT",
|
|
|
|
url: "/api/updateTankers/:supplierId",
|
|
|
|
schema: {
|
|
|
|
tags: ["Tanker-Data"],
|
|
|
|
summary: "This is to update tanker",
|
|
|
|
params: {
|
|
|
|
required: ["supplierId"],
|
|
|
|
type: "object",
|
|
|
|
properties: {
|
|
|
|
supplierId: {
|
|
|
|
type: "string",
|
|
|
|
description: "supplierId",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
querystring: {
|
|
|
|
tankerName: {type: 'string'}
|
|
|
|
},
|
|
|
|
body: {
|
|
|
|
type: "object",
|
|
|
|
properties: {
|
|
|
|
supplier_name: { type: "string" },
|
|
|
|
supplier_address:{ type: "string" },
|
|
|
|
tankerName: { type: "string" },
|
|
|
|
phoneNumber: { type: "string"},
|
|
|
|
alternative_phoneNumber: { type: "string"},
|
|
|
|
typeofwater: {
|
|
|
|
type: "array",
|
|
|
|
maxItems: 2500,
|
|
|
|
items: {
|
|
|
|
type: "object",
|
|
|
|
properties: {
|
|
|
|
typeofwater: { type: "string", default: null },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
price: {
|
|
|
|
type: "array",
|
|
|
|
maxItems: 2500,
|
|
|
|
items: {
|
|
|
|
type: "object",
|
|
|
|
properties: {
|
|
|
|
price: { type: "string", default: null },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
capacity: { type: "string"},
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
security: [
|
|
|
|
{
|
|
|
|
basicAuth: [],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
// preHandler: [
|
|
|
|
// fastify.auth([fastify.operatorAuthenticate]),
|
|
|
|
// validationHandler.validatePhoneFormat,
|
|
|
|
// ],
|
|
|
|
preHandler: fastify.auth([fastify.authenticate]),
|
|
|
|
handler: tankersController.updateTankersInfo,
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
fastify.route({
|
|
|
|
method: "PUT",
|
|
|
|
url: "/api/deleteTanker/:supplierId",
|
|
|
|
schema: {
|
|
|
|
tags: ["Tanker-Data"],
|
|
|
|
summary: "This is to delete tanker",
|
|
|
|
params: {
|
|
|
|
required: ["supplierId"],
|
|
|
|
type: "object",
|
|
|
|
properties: {
|
|
|
|
supplierId: {
|
|
|
|
type: "string",
|
|
|
|
description: "supplierId",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
querystring: {
|
|
|
|
tankerName: {type: 'string'}
|
|
|
|
},
|
|
|
|
security: [
|
|
|
|
{
|
|
|
|
basicAuth: [],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
preHandler: fastify.auth([fastify.authenticate]),
|
|
|
|
handler: tankersController.deleteTankerInfo,
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fastify.route({
|
|
|
|
method: "POST",
|
|
|
|
url: "/api/bookingData/:customerId",
|
|
|
|
schema: {
|
|
|
|
tags: ["Tanker-Data"],
|
|
|
|
description: "This is for storing booking data of a Tanker",
|
|
|
|
summary: "This is for storing booking data of a Tanker",
|
|
|
|
params: {
|
|
|
|
required: ["customerId"],
|
|
|
|
type: "object",
|
|
|
|
properties: {
|
|
|
|
customerId: {
|
|
|
|
type: "string",
|
|
|
|
description: "customerId",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
body: {
|
|
|
|
type: "object",
|
|
|
|
properties: {
|
|
|
|
tankName:{type: 'string'},
|
|
|
|
tankLocation:{type: 'string'},
|
|
|
|
tankerName: {type: 'string'},
|
|
|
|
typeofwater: { type: "string" },
|
|
|
|
capacity: { type: "string" },
|
|
|
|
address: { type: "string" },
|
|
|
|
dateOfOrder: { type: "string"},
|
|
|
|
price: { type: "string"},
|
|
|
|
supplierId: { type: "string"},
|
|
|
|
latitude: { type: 'number' , default: 0.0},
|
|
|
|
longitude: { type: 'number', default: 0.0}
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
security: [
|
|
|
|
{
|
|
|
|
basicAuth: [],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
|
|
|
|
},
|
|
|
|
preHandler: fastify.auth([fastify.authenticate]),
|
|
|
|
handler: tankersController.tankerBooking,
|
|
|
|
// onResponse: (request, reply) => {
|
|
|
|
// validationHandler.sendPhoneVerificationCode(request, reply);
|
|
|
|
// },
|
|
|
|
//onResponse: validationHandler.sendPhoneVerificationCode,
|
|
|
|
});
|
|
|
|
|
|
|
|
fastify.get("/api/getTankers", {
|
|
|
|
schema: {
|
|
|
|
tags: ["Tanker-Data"],
|
|
|
|
description: "This is for Get Tanker Data",
|
|
|
|
summary: "This is for to Get Tanker Data",
|
|
|
|
querystring: {
|
|
|
|
supplierId: {type: 'string'}
|
|
|
|
},
|
|
|
|
security: [
|
|
|
|
{
|
|
|
|
basicAuth: [],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
preHandler: fastify.auth([fastify.authenticate]),
|
|
|
|
handler: tankersController.getTanker,
|
|
|
|
});
|
|
|
|
|
|
|
|
fastify.get("/api/getallTankers", {
|
|
|
|
schema: {
|
|
|
|
tags: ["Tanker-Data"],
|
|
|
|
description: "This is for Get all Tanker Data",
|
|
|
|
summary: "This is for to Get all Tanker Data",
|
|
|
|
|
|
|
|
security: [
|
|
|
|
{
|
|
|
|
basicAuth: [],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
preHandler: fastify.auth([fastify.authenticate]),
|
|
|
|
handler: tankersController.getallTanker,
|
|
|
|
});
|
|
|
|
|
|
|
|
fastify.route({
|
|
|
|
method: "POST",
|
|
|
|
url: "/api/addBores/:customerId",
|
|
|
|
schema: {
|
|
|
|
tags: ["Tank"],
|
|
|
|
description: "This is to cretae New Bore",
|
|
|
|
summary: "This is to Create New Bore.",
|
|
|
|
params: {
|
|
|
|
required: ["customerId"],
|
|
|
|
type: "object",
|
|
|
|
properties: {
|
|
|
|
customerId: {
|
|
|
|
type: "string",
|
|
|
|
description: "customerId",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
body: {
|
|
|
|
type: "object",
|
|
|
|
properties: {
|
|
|
|
boreName: { type: "string" },
|
|
|
|
capacity: { type: "string" },
|
|
|
|
typeofwater: { type: "string" },
|
|
|
|
description: { type: "string" },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
security: [
|
|
|
|
{
|
|
|
|
basicAuth: [],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
|
|
|
|
},
|
|
|
|
preHandler: fastify.auth([fastify.authenticate]),
|
|
|
|
handler: tankersController.addBores,
|
|
|
|
// onResponse: (request, reply) => {
|
|
|
|
// validationHandler.sendPhoneVerificationCode(request, reply);
|
|
|
|
// },
|
|
|
|
//onResponse: validationHandler.sendPhoneVerificationCode,
|
|
|
|
});
|
|
|
|
|
|
|
|
fastify.get("/api/getTankersBookingdetails/:customerId", {
|
|
|
|
schema: {
|
|
|
|
tags: ["Tanker-Data"],
|
|
|
|
description: "This is for Get Tanker Booking Data",
|
|
|
|
summary: "This is for to Get Tanker Booking Data",
|
|
|
|
params: {
|
|
|
|
required: ["customerId"],
|
|
|
|
type: "object",
|
|
|
|
properties: {
|
|
|
|
customerId: {
|
|
|
|
type: "string",
|
|
|
|
description: "customerId",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
querystring: {
|
|
|
|
tankerName: {type: 'string'}
|
|
|
|
},
|
|
|
|
security: [
|
|
|
|
{
|
|
|
|
basicAuth: [],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
preHandler: fastify.auth([fastify.authenticate]),
|
|
|
|
handler: tankersController.getTankersBookingdetails,
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
fastify.get("/api/getAllTankersBookingdetails/:supplierId", {
|
|
|
|
schema: {
|
|
|
|
tags: ["Tanker-Data"],
|
|
|
|
description: "This is for Get All Tanker Booking Data",
|
|
|
|
summary: "This is for to Get All Tanker Booking Data",
|
|
|
|
params: {
|
|
|
|
required: ["supplierId"],
|
|
|
|
type: "object",
|
|
|
|
properties: {
|
|
|
|
supplierId: {
|
|
|
|
type: "string",
|
|
|
|
description: "supplierId",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
// querystring: {
|
|
|
|
// tankerName: {type: 'string'}
|
|
|
|
// },
|
|
|
|
security: [
|
|
|
|
{
|
|
|
|
basicAuth: [],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
preHandler: fastify.auth([fastify.authenticate]),
|
|
|
|
handler: tankersController.getAllTankersBookingdetails,
|
|
|
|
});
|
|
|
|
|
|
|
|
fastify.get("/api/getBores", {
|
|
|
|
schema: {
|
|
|
|
tags: ["Tank"],
|
|
|
|
description: "This is for Get Bore Data",
|
|
|
|
summary: "This is for to Get Bore Data",
|
|
|
|
querystring: {
|
|
|
|
customerId: {type: 'string'}
|
|
|
|
},
|
|
|
|
security: [
|
|
|
|
{
|
|
|
|
basicAuth: [],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
preHandler: fastify.auth([fastify.authenticate]),
|
|
|
|
handler: tankersController.getBores,
|
|
|
|
});
|
|
|
|
|
|
|
|
fastify.route({
|
|
|
|
method: "PUT",
|
|
|
|
url: "/api/deleteBore/:customerId",
|
|
|
|
schema: {
|
|
|
|
tags: ["Tank"],
|
|
|
|
summary: "This is for delete bore",
|
|
|
|
params: {
|
|
|
|
required: ["customerId"],
|
|
|
|
type: "object",
|
|
|
|
properties: {
|
|
|
|
customerId: {
|
|
|
|
type: "string",
|
|
|
|
description: "customerId",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
querystring: {
|
|
|
|
boreName: {type: 'string'}
|
|
|
|
},
|
|
|
|
security: [
|
|
|
|
{
|
|
|
|
basicAuth: [],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//preHandler: fastify.auth([fastify.authenticate]),
|
|
|
|
handler: tankersController.deleteBoresInfo,
|
|
|
|
});
|
|
|
|
|
|
|
|
fastify.route({
|
|
|
|
method: "PUT",
|
|
|
|
url: "/api/updateBores/:customerId",
|
|
|
|
schema: {
|
|
|
|
tags: ["Tank"],
|
|
|
|
summary: "This is for update bore",
|
|
|
|
params: {
|
|
|
|
required: ["customerId"],
|
|
|
|
type: "object",
|
|
|
|
properties: {
|
|
|
|
customerId: {
|
|
|
|
type: "string",
|
|
|
|
description: "customerId",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
querystring: {
|
|
|
|
boreName: {type: 'string'}
|
|
|
|
},
|
|
|
|
|
|
|
|
body: {
|
|
|
|
type: "object",
|
|
|
|
// required: ['phone'],
|
|
|
|
properties: {
|
|
|
|
|
|
|
|
boreName: { type: "string" },
|
|
|
|
capacity: { type: "string" },
|
|
|
|
typeofwater: { type: "string" },
|
|
|
|
description: { type: "string" },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
security: [
|
|
|
|
{
|
|
|
|
basicAuth: [],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
// preHandler: [
|
|
|
|
// fastify.auth([fastify.operatorAuthenticate]),
|
|
|
|
// validationHandler.validatePhoneFormat,
|
|
|
|
// ],
|
|
|
|
preHandler: fastify.auth([fastify.authenticate]),
|
|
|
|
handler: tankersController.updateBoresInfo,
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fastify.route({
|
|
|
|
method: "POST",
|
|
|
|
url: "/api/addGovtPIpeline/:customerId",
|
|
|
|
schema: {
|
|
|
|
tags: ["Tank"],
|
|
|
|
description: "This is to cretae New addGovtPIpeline",
|
|
|
|
summary: "This is to Create New addGovtPIpeline.",
|
|
|
|
params: {
|
|
|
|
required: ["customerId"],
|
|
|
|
type: "object",
|
|
|
|
properties: {
|
|
|
|
customerId: {
|
|
|
|
type: "string",
|
|
|
|
description: "customerId",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
body: {
|
|
|
|
type: "object",
|
|
|
|
properties: {
|
|
|
|
Name: { type: "string" },
|
|
|
|
capacity: { type: "string" },
|
|
|
|
typeofwater: { type: "string" },
|
|
|
|
description: { type: "string" },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
security: [
|
|
|
|
{
|
|
|
|
basicAuth: [],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
|
|
|
|
},
|
|
|
|
preHandler: fastify.auth([fastify.authenticate]),
|
|
|
|
handler: tankersController.addGovtPIpeline,
|
|
|
|
// onResponse: (request, reply) => {
|
|
|
|
// validationHandler.sendPhoneVerificationCode(request, reply);
|
|
|
|
// },
|
|
|
|
//onResponse: validationHandler.sendPhoneVerificationCode,
|
|
|
|
});
|
|
|
|
|
|
|
|
fastify.get("/api/getPipelines", {
|
|
|
|
schema: {
|
|
|
|
tags: ["Tank"],
|
|
|
|
description: "This is for Get Pipeline Data",
|
|
|
|
summary: "This is for to Get Pipeline Data",
|
|
|
|
querystring: {
|
|
|
|
customerId: {type: 'string'}
|
|
|
|
},
|
|
|
|
security: [
|
|
|
|
{
|
|
|
|
basicAuth: [],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
preHandler: fastify.auth([fastify.authenticate]),
|
|
|
|
handler: tankersController.getPipeline,
|
|
|
|
});
|
|
|
|
|
|
|
|
fastify.route({
|
|
|
|
method: "PUT",
|
|
|
|
url: "/api/deletePipeline/:customerId",
|
|
|
|
schema: {
|
|
|
|
tags: ["Tank"],
|
|
|
|
summary: "This is for delete Pipeline",
|
|
|
|
params: {
|
|
|
|
required: ["customerId"],
|
|
|
|
type: "object",
|
|
|
|
properties: {
|
|
|
|
customerId: {
|
|
|
|
type: "string",
|
|
|
|
description: "customerId",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
querystring: {
|
|
|
|
Name: {type: 'string'}
|
|
|
|
},
|
|
|
|
security: [
|
|
|
|
{
|
|
|
|
basicAuth: [],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//preHandler: fastify.auth([fastify.authenticate]),
|
|
|
|
handler: tankersController.deletePipelineInfo,
|
|
|
|
});
|
|
|
|
|
|
|
|
fastify.route({
|
|
|
|
method: "PUT",
|
|
|
|
url: "/api/updatePipeline/:customerId",
|
|
|
|
schema: {
|
|
|
|
tags: ["Tank"],
|
|
|
|
summary: "This is for update Pipeline",
|
|
|
|
params: {
|
|
|
|
required: ["customerId"],
|
|
|
|
type: "object",
|
|
|
|
properties: {
|
|
|
|
customerId: {
|
|
|
|
type: "string",
|
|
|
|
description: "customerId",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
querystring: {
|
|
|
|
Name: {type: 'string'}
|
|
|
|
},
|
|
|
|
|
|
|
|
body: {
|
|
|
|
type: "object",
|
|
|
|
// required: ['phone'],
|
|
|
|
properties: {
|
|
|
|
|
|
|
|
Name: { type: "string" },
|
|
|
|
capacity: { type: "string" },
|
|
|
|
typeofwater: { type: "string" },
|
|
|
|
description: { type: "string" },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
security: [
|
|
|
|
{
|
|
|
|
basicAuth: [],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
// preHandler: [
|
|
|
|
// fastify.auth([fastify.operatorAuthenticate]),
|
|
|
|
// validationHandler.validatePhoneFormat,
|
|
|
|
// ],
|
|
|
|
preHandler: fastify.auth([fastify.authenticate]),
|
|
|
|
handler: tankersController.updatePipelineInfo,
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
fastify.route({
|
|
|
|
method: "PUT",
|
|
|
|
url: "/api/deleteTanker1/:supplierId",
|
|
|
|
schema: {
|
|
|
|
tags: ["Tanker-Data"],
|
|
|
|
summary: "This is to delete tanker",
|
|
|
|
params: {
|
|
|
|
required: ["supplierId"],
|
|
|
|
type: "object",
|
|
|
|
properties: {
|
|
|
|
supplierId: {
|
|
|
|
type: "string",
|
|
|
|
description: "supplierId",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
querystring: {
|
|
|
|
tankerName: {type: 'string'}
|
|
|
|
},
|
|
|
|
security: [
|
|
|
|
{
|
|
|
|
basicAuth: [],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
preHandler: fastify.auth([fastify.authenticate]),
|
|
|
|
handler: tankersController.deleteTankerInfo1,
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
fastify.route({
|
|
|
|
method: 'GET',
|
|
|
|
url: '/connection-status',
|
|
|
|
schema: {
|
|
|
|
tags: ["Tanker-Data"],
|
|
|
|
description: "This is for Get Tankers Data for status connected or not",
|
|
|
|
summary: "This is for to Get Tankers Data for status connected or not",
|
|
|
|
querystring: {
|
|
|
|
type: 'object',
|
|
|
|
properties: {
|
|
|
|
customerId: { type: 'string' },
|
|
|
|
//supplierId: { type: 'string' }
|
|
|
|
},
|
|
|
|
required: ['customerId']
|
|
|
|
},
|
|
|
|
security: [
|
|
|
|
{
|
|
|
|
basicAuth: [],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
|
|
|
|
handler: tankersController.connectionStatus
|
|
|
|
});
|
|
|
|
|
|
|
|
fastify.get("/api/getConnectStatus/:customerId", {
|
|
|
|
schema: {
|
|
|
|
tags: ["Supplier"],
|
|
|
|
description: "This is to get connect status",
|
|
|
|
summary: "This is to get connect status",
|
|
|
|
params: {
|
|
|
|
required: ["customerId"],
|
|
|
|
type: "object",
|
|
|
|
properties: {
|
|
|
|
customerId: {
|
|
|
|
type: "string",
|
|
|
|
description: "customerId",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
querystring: {
|
|
|
|
supplierId: {type: 'string'}
|
|
|
|
},
|
|
|
|
|
|
|
|
security: [
|
|
|
|
{
|
|
|
|
basicAuth: [],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
preHandler: fastify.auth([fastify.authenticate]),
|
|
|
|
handler: tankersController.connectstatus,
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
fastify.get("/api/alltankersaccepted/:supplierId", {
|
|
|
|
schema: {
|
|
|
|
tags: ["Supplier-Order"],
|
|
|
|
description: "This is for Get All connected and rejected for Suppliers",
|
|
|
|
summary: "This is for to Get All connected and rejected for suppliers",
|
|
|
|
params: {
|
|
|
|
type: "object",
|
|
|
|
properties: {
|
|
|
|
supplierId: {
|
|
|
|
type: "string",
|
|
|
|
description: "supplierId",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
security: [
|
|
|
|
{
|
|
|
|
basicAuth: [],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
handler: tankersController.getAllTankersaccepted,
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fastify.route({
|
|
|
|
method: "PUT",
|
|
|
|
url: "/api/deleteBookingInfo/:bookingid",
|
|
|
|
schema: {
|
|
|
|
tags: ["Tanker-Data"],
|
|
|
|
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,
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
fastify.route({
|
|
|
|
method: "PUT",
|
|
|
|
url: "/api/distrubanceStatus/:bookingid",
|
|
|
|
schema: {
|
|
|
|
tags: ["Tanker-Data"],
|
|
|
|
summary: "This is for disrtubance status",
|
|
|
|
params: {
|
|
|
|
required: ["bookingid"],
|
|
|
|
type: "object",
|
|
|
|
properties: {
|
|
|
|
bookingid: {
|
|
|
|
type: "string",
|
|
|
|
description: "bookingid",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
body: {
|
|
|
|
type: "object",
|
|
|
|
// required: ['phone'],
|
|
|
|
properties: {
|
|
|
|
|
|
|
|
action: { type: "string" },
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
security: [
|
|
|
|
{
|
|
|
|
basicAuth: [],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
preHandler: fastify.auth([fastify.authenticate]),
|
|
|
|
handler: tankersController.distrubanceStatus,
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
fastify.route({
|
|
|
|
method: "PUT",
|
|
|
|
url: "/api/UserSupplierAccounts/:customerId",
|
|
|
|
schema: {
|
|
|
|
tags: ["Tanker-Data"],
|
|
|
|
summary: "This is for user and supplier accounts",
|
|
|
|
params: {
|
|
|
|
required: ["customerId"],
|
|
|
|
type: "object",
|
|
|
|
properties: {
|
|
|
|
customerId: {
|
|
|
|
type: "string",
|
|
|
|
description: "customerId",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
body: {
|
|
|
|
type: "object",
|
|
|
|
// required: ['phone'],
|
|
|
|
properties: {
|
|
|
|
|
|
|
|
supplierId: { type: "string" },
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
security: [
|
|
|
|
{
|
|
|
|
basicAuth: [],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
preHandler: fastify.auth([fastify.authenticate]),
|
|
|
|
handler: tankersController.UserSupplierAccounts,
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
next();
|
|
|
|
}
|
|
|
|
|