From 79633cc674f5af4e2ffdd0f013ce2df1688974b5 Mon Sep 17 00:00:00 2001 From: Misbahudin Date: Sun, 11 Feb 2024 03:35:04 +0700 Subject: [PATCH 1/3] docs: update response api --- src/config/routes.ts | 33 ++++++++++++++++++++------------- src/controllers/payment.ts | 8 ++++++-- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/src/config/routes.ts b/src/config/routes.ts index 5165b7e..5c20e46 100644 --- a/src/config/routes.ts +++ b/src/config/routes.ts @@ -171,19 +171,26 @@ router.get('/api/v1/users/profile', authToken, userController.profile) * schema: * type: object * properties: - * month: - * type: array - * items: - * type: object - * properties: - * statusCode: - * type: number - * transactionStatus: - * type: string - * transactionCount: - * type: number - * transactionAmount: - * type: number + * status: + * type: number + * message: + * type: string + * data: + * type: object + * properties: + * month: + * type: array + * items: + * type: object + * properties: + * statusCode: + * type: number + * transactionStatus: + * type: string + * transactionCount: + * type: number + * transactionAmount: + * type: number * 500: * description: Internal Server Error * content: diff --git a/src/controllers/payment.ts b/src/controllers/payment.ts index d4a5080..e204308 100644 --- a/src/controllers/payment.ts +++ b/src/controllers/payment.ts @@ -13,8 +13,12 @@ export class PaymentController { res: Response ): Promise>> => { try { - const transaction = await this.paymentService.getTransactionPayments() - return res.status(200).json(transaction) + const transactionPayments = await this.paymentService.getTransactionPayments() + return res.status(200).json({ + status: 200, + message: 'Successfully retrieved transaction payments', + data: transactionPayments, + }) } catch (err: unknown) { console.error(err) return res.status(500).json({ message: 'Internal Server Error' }) From 4c6d553e40efa9858405eefabbf65ff8fbb1642c Mon Sep 17 00:00:00 2001 From: Misbahudin Date: Sun, 11 Feb 2024 03:43:52 +0700 Subject: [PATCH 2/3] docs: update --- src/config/routes.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config/routes.ts b/src/config/routes.ts index 5c20e46..547d835 100644 --- a/src/config/routes.ts +++ b/src/config/routes.ts @@ -165,7 +165,7 @@ router.get('/api/v1/users/profile', authToken, userController.profile) * - bearerAuth: [] * responses: * 200: - * description: OK + * description: OK SIR * content: * application/json: * schema: From d72da88d4d32c4718ab008398287bac5c91e34da Mon Sep 17 00:00:00 2001 From: Misbahudin Date: Sun, 11 Feb 2024 03:45:06 +0700 Subject: [PATCH 3/3] docs: delete sir --- src/config/routes.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config/routes.ts b/src/config/routes.ts index 547d835..5c20e46 100644 --- a/src/config/routes.ts +++ b/src/config/routes.ts @@ -165,7 +165,7 @@ router.get('/api/v1/users/profile', authToken, userController.profile) * - bearerAuth: [] * responses: * 200: - * description: OK SIR + * description: OK * content: * application/json: * schema: