🐛 Fix cannot approve something

This commit is contained in:
LittleSheep 2024-04-06 02:55:07 +08:00
parent bc688f61d3
commit ef55cbb32a
2 changed files with 4 additions and 3 deletions

View File

@ -87,6 +87,8 @@ func editFriendship(c *fiber.Ctx) error {
}
}
friendship.Status = models.FriendshipStatus(data.Status)
if friendship, err := services.EditFriend(friendship); err != nil {
return fiber.NewError(fiber.StatusBadRequest, err.Error())
} else {

View File

@ -11,9 +11,8 @@ import (
func ListFriend(anyside models.Account, status models.FriendshipStatus) ([]models.AccountFriendship, error) {
var relationships []models.AccountFriendship
if err := database.C.
Where(&models.AccountFriendship{Status: status}).
Where(&models.AccountFriendship{AccountID: anyside.ID}).
Or(&models.AccountFriendship{RelatedID: anyside.ID}).
Where(&models.AccountFriendship{AccountID: anyside.ID, Status: status}).
Or(&models.AccountFriendship{RelatedID: anyside.ID, Status: status}).
Preload("Account").
Preload("Related").
Find(&relationships).Error; err != nil {