const installationController = require("../controllers/installationController") module.exports = function (fastify, opts, next) { fastify.post("/api/createTeamMember", { schema: { description: "Create a new team member under an installation", tags: ["Installation"], summary: "Create Team Member", body: { type: "object", required: ["installationId", "name", "phone", "password"], properties: { installationId: { type: "string", description: "Installation ID to associate the team member with" }, name: { type: "string", description: "Full name of the team member" }, phone: { type: "string", description: "Phone number of the team member" }, password: { type: "string", description: "Password for the team member" }, alternativePhone: { type: "string", }, email: { type: "string", }, status: { type: "string", }, }, }, }, handler: installationController.createTeamMember, }); fastify.get("/api/getTeamMembers/:installationId", { schema: { description: "Get all team members under a specific installation", tags: ["Installation"], summary: "Get Team Members", params: { type: "object", properties: { installationId: { type: "string", description: "Installation ID to fetch team members from" } }, required: ["installationId"] }, response: { 200: { type: "object", properties: { simplydata: { type: "object", properties: { error: { type: "boolean" }, message: { type: "string" }, teamMembers: { type: "array", items: { type: "object", properties: { teamMemberId: { type: "string" }, name: { type: "string" }, phone: { type: "string" }, email: { type: "string" }, alternativePhone: { type: "string" }, installationTeamMemId: { type: "string" }, status: { type: "string" } } } } } } } } } }, handler: installationController.getTeamMembers }); fastify.put("/api/editTeamMember/:installationId/:teamMemberId", { schema: { description: "Update an existing team member's details", tags: ["Installation"], summary: "Edit Team Member", params: { type: "object", properties: { installationId: { type: "string", description: "Installation ID" }, teamMemberId: { type: "string", description: "Team Member ID" } }, required: ["installationId", "teamMemberId"] }, body: { type: "object", properties: { name: { type: "string" }, phone: { type: "string" }, email: { type: "string" }, alternativePhone: { type: "string" }, status: { type: "string" } } }, response: { 200: { type: "object", properties: { simplydata: { type: "object", properties: { error: { type: "boolean" }, message: { type: "string" } } } } } } }, handler: installationController.editTeamMember });fastify.delete("/api/deleteTeamMember/:installationId/:teamMemberId", { schema: { description: "Delete a team member from an installation", tags: ["Installation"], summary: "Delete Team Member", params: { type: "object", properties: { installationId: { type: "string", description: "Installation ID" }, teamMemberId: { type: "string", description: "Team Member ID" } }, required: ["installationId", "teamMemberId"] }, response: { 200: { type: "object", properties: { simplydata: { type: "object", properties: { error: { type: "boolean" }, message: { type: "string" } } } } } } }, handler: installationController.deleteTeamMember }); next(); }