Skip to content

Commit

Permalink
Merge pull request #44 from Synrgy-Academy-Final-Project/feat/summary…
Browse files Browse the repository at this point in the history
…/trx

Update Response API for Summary Transaction Payments
  • Loading branch information
mizzcode authored Feb 10, 2024
2 parents 22f1ca2 + d72da88 commit 7e5fc25
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
33 changes: 20 additions & 13 deletions src/config/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 6 additions & 2 deletions src/controllers/payment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@ export class PaymentController {
res: Response
): Promise<Response<unknown, Record<string, unknown>>> => {
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' })
Expand Down

0 comments on commit 7e5fc25

Please sign in to comment.