feat: move UserDTO logic into single file

This commit is contained in:
2025-06-07 00:11:46 +02:00
parent cc7f7f40c4
commit ae41076673
3 changed files with 24 additions and 27 deletions

View File

@ -162,17 +162,7 @@ func (h *AuthHandler) getProfile(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
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 {
if err := json.NewEncoder(w).Encode(types.NewUserDTO(&user)); err != nil {
web.Error(w, "failed to encode user profile", http.StatusInternalServerError)
}
}