feat: move user dto outside

This commit is contained in:
2025-06-04 12:46:24 +02:00
parent 81659181e4
commit c6998f33e1
3 changed files with 43 additions and 29 deletions

View File

@ -160,16 +160,16 @@ func (h *AuthHandler) getProfile(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
if err := json.NewEncoder(w).Encode(map[string]any{
"id": user.ID.String(),
"full_name": user.FullName,
"email": user.Email,
"phone_number": user.PhoneNumber,
"isAdmin": user.IsAdmin,
"last_login": user.LastLogin,
"profile_picture": user.ProfilePicture,
"updated_at": user.UpdatedAt,
"created_at": user.CreatedAt,
if err := json.NewEncoder(w).Encode(types.UserDTO{
ID: user.ID,
FullName: user.FullName,
Email: user.Email,
PhoneNumber: user.PhoneNumber,
IsAdmin: user.IsAdmin,
LastLogin: user.LastLogin,
ProfilePicture: user.ProfilePicture,
UpdatedAt: user.UpdatedAt,
CreatedAt: user.CreatedAt,
}); err != nil {
web.Error(w, "failed to encode user profile", http.StatusInternalServerError)
}