diff --git a/backend/__debug_bin3098822796 b/backend/__debug_bin3098822796 deleted file mode 100755 index 2709cfa..0000000 Binary files a/backend/__debug_bin3098822796 and /dev/null differ diff --git a/backend/__debug_bin746813113 b/backend/__debug_bin746813113 new file mode 100644 index 0000000..e69de29 diff --git a/backend/modules/users/controller.go b/backend/modules/users/controller.go index d38a901..5517b03 100644 --- a/backend/modules/users/controller.go +++ b/backend/modules/users/controller.go @@ -5,6 +5,7 @@ import ( "backend/providers/jwt" "github.com/gofiber/fiber/v3" + "github.com/pkg/errors" log "github.com/sirupsen/logrus" hashids "github.com/speps/go-hashids/v2" ) @@ -47,5 +48,11 @@ func (c *Controller) Info(ctx fiber.Ctx) error { } info.Balance = balance + tenant, err := c.svc.GetTenantByID(ctx.Context(), claim.TenantID) + if err != nil { + return errors.Wrapf(err, "get tenant: %d", claim.TenantID) + } + info.IsAdmin = tenant.BindUserID == claim.UserID + return ctx.JSON(info) } diff --git a/backend/modules/users/dto.go b/backend/modules/users/dto.go index 9fabe38..e26b028 100644 --- a/backend/modules/users/dto.go +++ b/backend/modules/users/dto.go @@ -1,5 +1,6 @@ package users type UserInfo struct { + IsAdmin bool `json:"is_admin"` Balance int64 `json:"balance"` }