diff --git a/internal/auth/routes.go b/internal/auth/routes.go index 047e076..6cd2bb0 100644 --- a/internal/auth/routes.go +++ b/internal/auth/routes.go @@ -44,13 +44,14 @@ func (h *AuthHandler) getProfile(w http.ResponseWriter, r *http.Request) { } if err := json.NewEncoder(w).Encode(map[string]any{ - "full_name": user.FullName, - "email": user.Email, - "phoneNumber": user.PhoneNumber, - "isAdmin": user.IsAdmin, - "last_login": user.LastLogin, - "updated_at": user.UpdatedAt, - "created_at": user.CreatedAt, + "full_name": user.FullName, + "email": user.Email, + "phoneNumber": user.PhoneNumber, + "isAdmin": user.IsAdmin, + "last_login": user.LastLogin, + "profile_picture": user.ProfilePicture.String, + "updated_at": user.UpdatedAt, + "created_at": user.CreatedAt, }); err != nil { web.Error(w, "failed to encode user profile", http.StatusInternalServerError) } @@ -124,18 +125,20 @@ func (h *AuthHandler) login(w http.ResponseWriter, r *http.Request) { AccessToken string `json:"access"` RefreshToken string `json:"refresh"` // fields required for UI in account selector, e.g. email, full name and avatar - FullName string `json:"full_name"` - Email string `json:"email"` - Id string `json:"id"` + FullName string `json:"full_name"` + Email string `json:"email"` + Id string `json:"id"` + ProfilePicture string `json:"profile_picture"` // Avatar } if err := encoder.Encode(Response{ - AccessToken: accessToken, - RefreshToken: refreshToken, - FullName: user.FullName, - Email: user.Email, - Id: user.ID.String(), + AccessToken: accessToken, + RefreshToken: refreshToken, + FullName: user.FullName, + Email: user.Email, + Id: user.ID.String(), + ProfilePicture: user.ProfilePicture.String, // Avatar }); err != nil { web.Error(w, "failed to encode response", http.StatusInternalServerError)