|
|
@ -7,6 +7,20 @@ const validationHandler = require("../handlers/supplierHandler");
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = function (fastify, opts, next) {
|
|
|
|
module.exports = function (fastify, opts, next) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fastify.get("/api/suppliers", {
|
|
|
|
|
|
|
|
schema: {
|
|
|
|
|
|
|
|
tags: ["Supplier-Data"],
|
|
|
|
|
|
|
|
description: "This is for Get All Suppliers",
|
|
|
|
|
|
|
|
summary: "This is for to Get All Suppliers",
|
|
|
|
|
|
|
|
security: [
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
basicAuth: [],
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
handler: validationHandler.getSuppliers,
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
fastify.post("/api/supplierlogin", {
|
|
|
|
fastify.post("/api/supplierlogin", {
|
|
|
|
schema: {
|
|
|
|
schema: {
|
|
|
|
description: "This is for Login Supplier",
|
|
|
|
description: "This is for Login Supplier",
|
|
|
@ -123,6 +137,58 @@ module.exports = function (fastify, opts, next) {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fastify.route({
|
|
|
|
|
|
|
|
method: "POST",
|
|
|
|
|
|
|
|
url: "/api/suppliers/:supplierId",
|
|
|
|
|
|
|
|
schema: {
|
|
|
|
|
|
|
|
description: "To Get Supplier by supplierId",
|
|
|
|
|
|
|
|
tags: ["Supplier-Data"],
|
|
|
|
|
|
|
|
summary: "This is for Get a Single Supplier by supplierId",
|
|
|
|
|
|
|
|
params: {
|
|
|
|
|
|
|
|
type: "object",
|
|
|
|
|
|
|
|
properties: {
|
|
|
|
|
|
|
|
supplierId: {
|
|
|
|
|
|
|
|
type: "string",
|
|
|
|
|
|
|
|
description: "supplierId",
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
security: [
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
basicAuth: [],
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
preHandler: fastify.auth([fastify.authenticate]),
|
|
|
|
|
|
|
|
handler: validationHandler.getSingleSupplier,
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fastify.route({
|
|
|
|
|
|
|
|
method: "POST",
|
|
|
|
|
|
|
|
url: "/api/currentsupplier",
|
|
|
|
|
|
|
|
schema: {
|
|
|
|
|
|
|
|
tags: ["Supplier-Data"],
|
|
|
|
|
|
|
|
description: "This is for Get Current Supplier by supplierId by Post Body",
|
|
|
|
|
|
|
|
summary: "This is for Get a Current Supplier.",
|
|
|
|
|
|
|
|
body: {
|
|
|
|
|
|
|
|
type: "object",
|
|
|
|
|
|
|
|
required: ["supplierId"],
|
|
|
|
|
|
|
|
properties: {
|
|
|
|
|
|
|
|
supplierId: { type: "string" },
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
security: [
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
basicAuth: [],
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
preHandler: fastify.auth([fastify.authenticate]),
|
|
|
|
|
|
|
|
handler: validationHandler.getCurrentSupplier,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
next();
|
|
|
|
next();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|