|
|
@ -937,5 +937,66 @@ fastify.route({
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fastify.route({
|
|
|
|
|
|
|
|
method: "POST",
|
|
|
|
|
|
|
|
url: "/api/favorites/add",
|
|
|
|
|
|
|
|
schema: {
|
|
|
|
|
|
|
|
tags: ["User"],
|
|
|
|
|
|
|
|
description: "Add a supplier to the customer's favorites",
|
|
|
|
|
|
|
|
summary: "Add a supplier to the customer's favorites",
|
|
|
|
|
|
|
|
body: {
|
|
|
|
|
|
|
|
type: "object",
|
|
|
|
|
|
|
|
required: ["customerId", "supplierId"],
|
|
|
|
|
|
|
|
properties: {
|
|
|
|
|
|
|
|
customerId: { type: "string", description: "Customer ID" },
|
|
|
|
|
|
|
|
supplierId: { type: "string", description: "Supplier ID to be added" }
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
security: [{ basicAuth: [] }]
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
handler: userController.addFavoriteSupplier
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fastify.route({
|
|
|
|
|
|
|
|
method: "GET",
|
|
|
|
|
|
|
|
url: "/api/favorites/:customerId",
|
|
|
|
|
|
|
|
schema: {
|
|
|
|
|
|
|
|
tags: ["User"],
|
|
|
|
|
|
|
|
description: "Get all favorite suppliers of a customer",
|
|
|
|
|
|
|
|
summary: "Get all favorite suppliers of a customer",
|
|
|
|
|
|
|
|
params: {
|
|
|
|
|
|
|
|
type: "object",
|
|
|
|
|
|
|
|
required: ["customerId"],
|
|
|
|
|
|
|
|
properties: {
|
|
|
|
|
|
|
|
customerId: { type: "string", description: "Customer ID" }
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
security: [{ basicAuth: [] }]
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
handler: userController.getFavoriteSuppliers
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fastify.route({
|
|
|
|
|
|
|
|
method: "DELETE",
|
|
|
|
|
|
|
|
url: "/api/favorites/:customerId/:supplierId",
|
|
|
|
|
|
|
|
schema: {
|
|
|
|
|
|
|
|
tags: ["User"],
|
|
|
|
|
|
|
|
description: "Remove a supplier from the customer's favorites",
|
|
|
|
|
|
|
|
summary: "Remove a supplier from the customer's favorites",
|
|
|
|
|
|
|
|
params: {
|
|
|
|
|
|
|
|
type: "object",
|
|
|
|
|
|
|
|
required: ["customerId", "supplierId"],
|
|
|
|
|
|
|
|
properties: {
|
|
|
|
|
|
|
|
customerId: { type: "string", description: "Customer ID" },
|
|
|
|
|
|
|
|
supplierId: { type: "string", description: "Supplier ID to be removed" }
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
security: [{ basicAuth: [] }]
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
handler: userController.removeFavoriteSupplier
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
next();
|
|
|
|
next();
|
|
|
|
};
|
|
|
|
};
|
|
|
|