Passport/pkg/server/userinfo.go

23 lines
578 B
Go
Raw Normal View History

2024-04-02 12:23:25 +00:00
package server
import (
2024-04-13 05:48:19 +00:00
"git.solsynth.dev/hydrogen/passport/pkg/database"
"git.solsynth.dev/hydrogen/passport/pkg/models"
2024-04-02 12:23:25 +00:00
"github.com/gofiber/fiber/v2"
)
func getOtherUserinfo(c *fiber.Ctx) error {
alias := c.Params("alias")
var account models.Account
if err := database.C.
Where(&models.Account{Name: alias}).
Omit("sessions", "challenges", "factors", "events", "clients", "notifications", "notify_subscribers").
2024-04-05 17:07:36 +00:00
Preload("Profile").
2024-04-02 12:23:25 +00:00
First(&account).Error; err != nil {
return fiber.NewError(fiber.StatusBadRequest, err.Error())
}
return c.JSON(account)
}