👔 Make transactions order by created at decreasing
This commit is contained in:
parent
712ed6c2ae
commit
87b94cdb54
@ -30,6 +30,7 @@ func getTransaction(c *fiber.Ctx) error {
|
|||||||
var transactions []models.Transaction
|
var transactions []models.Transaction
|
||||||
if err := database.C.Where("payer_id = ? OR payee_id = ?", user.ID, user.ID).
|
if err := database.C.Where("payer_id = ? OR payee_id = ?", user.ID, user.ID).
|
||||||
Limit(take).Offset(offset).
|
Limit(take).Offset(offset).
|
||||||
|
Order("created_at DESC").
|
||||||
Find(&transactions).Error; err != nil {
|
Find(&transactions).Error; err != nil {
|
||||||
return fiber.NewError(fiber.StatusInternalServerError, err.Error())
|
return fiber.NewError(fiber.StatusInternalServerError, err.Error())
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user