From 87b94cdb5488e5cedc153a9f55fdc55151d5781b Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Wed, 29 Jan 2025 23:00:34 +0800 Subject: [PATCH] :necktie: Make transactions order by created at decreasing --- pkg/internal/server/api/transaction_api.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/internal/server/api/transaction_api.go b/pkg/internal/server/api/transaction_api.go index 368b883..1a3bc90 100644 --- a/pkg/internal/server/api/transaction_api.go +++ b/pkg/internal/server/api/transaction_api.go @@ -30,6 +30,7 @@ func getTransaction(c *fiber.Ctx) error { var transactions []models.Transaction if err := database.C.Where("payer_id = ? OR payee_id = ?", user.ID, user.ID). Limit(take).Offset(offset). + Order("created_at DESC"). Find(&transactions).Error; err != nil { return fiber.NewError(fiber.StatusInternalServerError, err.Error()) }