From 2480eb83778c437b287f234d55e845cafc38efc3 Mon Sep 17 00:00:00 2001 From: oderahub Date: Wed, 24 Jul 2024 22:32:58 +0100 Subject: [PATCH] feat: update organisation details --- src/controllers/updateorgController.ts | 82 ++++++++++++++++++++++++++ src/index.ts | 2 + 2 files changed, 84 insertions(+) diff --git a/src/controllers/updateorgController.ts b/src/controllers/updateorgController.ts index 6affbb3f..e2975b5f 100644 --- a/src/controllers/updateorgController.ts +++ b/src/controllers/updateorgController.ts @@ -1,6 +1,88 @@ import { Request, Response } from "express"; import { UpdateOrganizationDetails } from "../services/updateorg.service"; +/** + * @swagger + * /organization/{organization_id}: + * put: + * summary: Update organization details + * description: Updates the details of an organization by its ID. + * tags: + * - Organization + * parameters: + * - in: path + * name: organization_id + * schema: + * type: string + * required: true + * description: The ID of the organization to update + * requestBody: + * required: true + * content: + * application/json: + * schema: + * type: object + * properties: + * name: + * type: string + * address: + * type: string + * phone: + * type: string + * email: + * type: string + * responses: + * 200: + * description: Organization details updated successfully + * content: + * application/json: + * schema: + * type: object + * properties: + * message: + * type: string + * status_code: + * type: integer + * data: + * type: object + * properties: + * id: + * type: string + * name: + * type: string + * address: + * type: string + * phone: + * type: string + * email: + * type: string + * 404: + * description: Organization not found + * content: + * application/json: + * schema: + * type: object + * properties: + * status: + * type: string + * status_code: + * type: integer + * message: + * type: string + * 500: + * description: Failed to update organization details + * content: + * application/json + * schema: + * type: object + * properties: + * status: + * type: string + * status_code: + * type: integer + * message: + * type: string + */ export const updateOrganization = async (req: Request, res: Response) => { const { organization_id } = req.params; const updateData = req.body; diff --git a/src/index.ts b/src/index.ts index 75278881..1936dcb1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -73,6 +73,8 @@ server.use("/api/v1/product", productRouter); server.use("/api/v1/docs", swaggerUi.serve, swaggerUi.setup(swaggerSpec)); server.use("/api/v1/settings", notificationRouter); server.use("/api/v1/jobs", jobRouter); +server.use("/api/v1/", updateRouter); +server.use("/api/v1/organisation", organisationRoute); server.use("/api-docs", swaggerUi.serve, swaggerUi.setup(swaggerSpec)); server.use("/api/v1", orgRouter); server.use("/api/v1", authMiddleware, orgRouter);