From bde5d4f5dcdcc216335936139a51cf6d291031a4 Mon Sep 17 00:00:00 2001 From: Agboola Akorede Date: Mon, 29 Jul 2024 13:20:48 +0100 Subject: [PATCH 1/3] fix: endpoint convention --- src/controllers/exportController.ts | 2 +- src/data-source.ts | 12 ++++++------ src/routes/export.ts | 9 ++++++++- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/controllers/exportController.ts b/src/controllers/exportController.ts index 0d28ded6..da2c6a7d 100644 --- a/src/controllers/exportController.ts +++ b/src/controllers/exportController.ts @@ -3,7 +3,7 @@ import { Request, Response } from "express"; import ExportService from "../services/export.services"; /** * @swagger - * /api/v1/export-data: + * /api/v1/organisation/members/export: * get: * summary: Export signed-in user information * tags: [Export user data by csv or pdf format] diff --git a/src/data-source.ts b/src/data-source.ts index 89ea2564..c081a0f2 100644 --- a/src/data-source.ts +++ b/src/data-source.ts @@ -16,12 +16,12 @@ const AppDataSource = new DataSource({ entities: ["src/models/**/*.ts"], migrations: ["src/migrations/**/*.ts"], migrationsTableName: "migrations", - ssl: true, - extra: { - ssl: { - rejectUnauthorized: false, - }, - }, + // ssl: true, + // extra: { + // ssl: { + // rejectUnauthorized: false, + // }, + // }, }); export async function initializeDataSource() { diff --git a/src/routes/export.ts b/src/routes/export.ts index df306a78..956bb24c 100644 --- a/src/routes/export.ts +++ b/src/routes/export.ts @@ -1,9 +1,16 @@ import { Router } from "express"; import exportController from "../controllers/exportController"; import { authMiddleware } from "../middleware"; +import { checkPermissions } from "../middleware/checkUserRole"; +import { UserRole } from "../enums/userRoles"; const exportRouter = Router(); -exportRouter.get("/export-data", authMiddleware, exportController.exportData); +exportRouter.get( + "/organisation/members/export", + authMiddleware, + checkPermissions([UserRole.SUPER_ADMIN, UserRole.USER]), + exportController.exportData, +); export { exportRouter }; From d0c953e41e105044dc86927462e5a11f05d2f17d Mon Sep 17 00:00:00 2001 From: Agboola Akorede Date: Mon, 29 Jul 2024 13:24:35 +0100 Subject: [PATCH 2/3] fix: data-source ssl --- src/data-source.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data-source.ts b/src/data-source.ts index c081a0f2..74479243 100644 --- a/src/data-source.ts +++ b/src/data-source.ts @@ -18,7 +18,7 @@ const AppDataSource = new DataSource({ migrationsTableName: "migrations", // ssl: true, // extra: { - // ssl: { + // ssl: {git // rejectUnauthorized: false, // }, // }, From be0f28ef24293013761b5f9a1ade32ba25bc0fe7 Mon Sep 17 00:00:00 2001 From: Agboola Akorede Date: Mon, 29 Jul 2024 13:26:28 +0100 Subject: [PATCH 3/3] fix: data-source ssl --- src/data-source.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data-source.ts b/src/data-source.ts index 74479243..c081a0f2 100644 --- a/src/data-source.ts +++ b/src/data-source.ts @@ -18,7 +18,7 @@ const AppDataSource = new DataSource({ migrationsTableName: "migrations", // ssl: true, // extra: { - // ssl: {git + // ssl: { // rejectUnauthorized: false, // }, // },