👔 Make transactions order by created at decreasing

This commit is contained in:
LittleSheep 2025-01-29 23:00:34 +08:00
parent 712ed6c2ae
commit 87b94cdb54

View File

@ -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())
}