feat: expose some more info in /settings

This commit is contained in:
Sam 2023-05-19 03:13:46 +02:00
parent 130a1996d7
commit c3291edd4f
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
3 changed files with 37 additions and 1 deletions

View file

@ -2,6 +2,7 @@ package user
import (
"net/http"
"time"
"codeberg.org/u1f320/pronouns.cc/backend/db"
"codeberg.org/u1f320/pronouns.cc/backend/log"
@ -29,6 +30,8 @@ type GetUserResponse struct {
type GetMeResponse struct {
GetUserResponse
CreatedAt time.Time `json:"created_at"`
MaxInvites int `json:"max_invites"`
IsAdmin bool `json:"is_admin"`
ListPrivate bool `json:"list_private"`
@ -194,6 +197,7 @@ func (s *Server) getMeUser(w http.ResponseWriter, r *http.Request) error {
render.JSON(w, r, GetMeResponse{
GetUserResponse: dbUserToResponse(u, fields, members),
CreatedAt: u.ID.Time(),
MaxInvites: u.MaxInvites,
IsAdmin: u.IsAdmin,
ListPrivate: u.ListPrivate,