✨ Able to list all the friend without status filter
This commit is contained in:
@ -9,13 +9,21 @@ import (
|
||||
|
||||
func listFriendship(c *fiber.Ctx) error {
|
||||
user := c.Locals("principal").(models.Account)
|
||||
status := c.QueryInt("status", int(models.FriendshipActive))
|
||||
status := c.QueryInt("status", -1)
|
||||
|
||||
if friends, err := services.ListFriend(user, models.FriendshipStatus(status)); err != nil {
|
||||
return fiber.NewError(fiber.StatusInternalServerError, err.Error())
|
||||
var err error
|
||||
var friends []models.AccountFriendship
|
||||
if status < 0 {
|
||||
if friends, err = services.ListAllFriend(user); err != nil {
|
||||
return fiber.NewError(fiber.StatusInternalServerError, err.Error())
|
||||
}
|
||||
} else {
|
||||
return c.JSON(friends)
|
||||
if friends, err = services.ListFriend(user, models.FriendshipStatus(status)); err != nil {
|
||||
return fiber.NewError(fiber.StatusInternalServerError, err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
return c.JSON(friends)
|
||||
}
|
||||
|
||||
func getFriendship(c *fiber.Ctx) error {
|
||||
|
@ -1,6 +1,9 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"git.solsynth.dev/hydrogen/passport/pkg"
|
||||
"git.solsynth.dev/hydrogen/passport/pkg/i18n"
|
||||
"git.solsynth.dev/hydrogen/passport/pkg/server/ui"
|
||||
@ -14,8 +17,6 @@ import (
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/spf13/viper"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var A *fiber.App
|
||||
|
Reference in New Issue
Block a user