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.

117 lines
3.0 KiB

3 years ago
const fastify = require("fastify");
const supplierOrderController = require("../controllers/supplierOrderController");
const validationHandler = require("../handlers/supplierHandler");
module.exports = function (fastify, opts, next) {
fastify.route({
method: "POST",
url: "/api/ordernow/:bookingId",
schema: {
tags: ["Supplier-Order"],
description:"This is for giving booking data to supplier",
summary: "This is for giving booking data to supplier",
params: {
required: ["bookingId"],
type: "object",
properties: {
bookingId: {
type: "string",
description: "bookingId",
},
},
},
body: {
type: "object",
properties: {
supplierName: {type: 'string'},
supplierId: { type: "string" },
customerId:{type:"string"},
capacity: { type: "string" },
customer_address: { type: "string" },
dateOfOrder: { type: "string"},
action:{type:"string"},
price :{type:"string"},
delivery_agent :{type:"string"},
agent_mobile :{type:"string"},
agent_alternative_mobile :{type:"string"},
3 years ago
},
},
security: [
{
basicAuth: [],
},
],
},
// preHandler: fastify.auth([fastify.authenticate]),
handler:supplierOrderController.orderNow,
// onResponse: (request, reply) => {
// validationHandler.sendPhoneVerificationCode(request, reply);
// },
//onResponse: validationHandler.sendPhoneVerificationCode,
});
fastify.route({
method: "POST",
url: "/api/addDeliveryboys/:supplierId",
schema: {
tags: ["Supplier-Data"],
description: "This is for adding delivery boys",
summary: "This is for adding delivery boys",
params: {
required: ["supplierId"],
type: "object",
properties: {
supplierId: {
type: "string",
description: "supplierId",
},
},
},
body: {
type: "object",
properties: {
Name: { type: "string" },
phone: { type: "string" },
alternativeContactNumber : { type : "string" },
address: { type: "string", default: null },
city: { type: "string", default: null },
state: { type: "string", default: null },
zip: { type: "string", default: null },
status: { type: "string" },
},
},
security: [
{
basicAuth: [],
},
],
},
preHandler: [
//validationHandler.fieldCheck,
//validationHandler.verifySupplier,
// validationHandler.validatePhoneFormat,
//validationHandler.validateEmailFormat,
],
handler: supplierOrderController.addDeliveryboy,
});
3 years ago
next();
}