|
|
@ -98,6 +98,71 @@ fastify.get("/api/getUsersByRole/:role", {
|
|
|
|
handler: adminController.getUsersByRole,
|
|
|
|
handler: adminController.getUsersByRole,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fastify.put("/api/editUser/:customerId", {
|
|
|
|
|
|
|
|
schema: {
|
|
|
|
|
|
|
|
description: "Edit user details by customer ID",
|
|
|
|
|
|
|
|
tags: ["Sales/Store Users"],
|
|
|
|
|
|
|
|
summary: "Edit user details",
|
|
|
|
|
|
|
|
params: {
|
|
|
|
|
|
|
|
type: "object",
|
|
|
|
|
|
|
|
properties: {
|
|
|
|
|
|
|
|
customerId: { type: "string" }, // Customer ID
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
required: ["customerId"],
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
body: {
|
|
|
|
|
|
|
|
type: "object",
|
|
|
|
|
|
|
|
properties: {
|
|
|
|
|
|
|
|
phone: { type: "string" },
|
|
|
|
|
|
|
|
username: { type: "string" },
|
|
|
|
|
|
|
|
role: { type: "string", enum: ["sales", "store"] },
|
|
|
|
|
|
|
|
date: { type: "string", format: "date-time" }
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
required: ["phone", "username", "role", "date"]
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
response: {
|
|
|
|
|
|
|
|
200: {
|
|
|
|
|
|
|
|
type: "object",
|
|
|
|
|
|
|
|
properties: {
|
|
|
|
|
|
|
|
success: { type: "boolean" },
|
|
|
|
|
|
|
|
message: { type: "string" },
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
handler: adminController.editUserByCustomerId,
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fastify.delete("/api/deleteUser/:customerId", {
|
|
|
|
|
|
|
|
schema: {
|
|
|
|
|
|
|
|
description: "Delete a user by customer ID",
|
|
|
|
|
|
|
|
tags: ["Sales/Store Users"],
|
|
|
|
|
|
|
|
summary: "Delete a user by customer ID",
|
|
|
|
|
|
|
|
params: {
|
|
|
|
|
|
|
|
type: "object",
|
|
|
|
|
|
|
|
properties: {
|
|
|
|
|
|
|
|
customerId: { type: "string" }, // Customer ID
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
required: ["customerId"],
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
response: {
|
|
|
|
|
|
|
|
200: {
|
|
|
|
|
|
|
|
type: "object",
|
|
|
|
|
|
|
|
properties: {
|
|
|
|
|
|
|
|
success: { type: "boolean" },
|
|
|
|
|
|
|
|
message: { type: "string" },
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
handler: adminController.deleteUserInfo,
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fastify.route({
|
|
|
|
fastify.route({
|
|
|
|
method: "GET",
|
|
|
|
method: "GET",
|
|
|
|
url: "/api/users/:customerId", // Use path parameters for customerId
|
|
|
|
url: "/api/users/:customerId", // Use path parameters for customerId
|
|
|
|