From 0bcc1eb4274e14be83e261c8b2bfef411b13fd0a Mon Sep 17 00:00:00 2001 From: Kharec Date: Sat, 10 Jan 2026 22:38:30 +0100 Subject: [PATCH] feat: add ToUserListDTO and ToSanitizedUserListDTO helpers --- internal/dto/user.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/internal/dto/user.go b/internal/dto/user.go index 3d25350..56df60c 100644 --- a/internal/dto/user.go +++ b/internal/dto/user.go @@ -82,6 +82,26 @@ type SanitizedUserListDTO struct { Offset int `json:"offset"` } +func ToUserListDTO(users []database.User, limit, offset int) UserListDTO { + userDTOs := ToUserDTOs(users) + return UserListDTO{ + Users: userDTOs, + Count: len(userDTOs), + Limit: limit, + Offset: offset, + } +} + +func ToSanitizedUserListDTO(users []database.User, limit, offset int) SanitizedUserListDTO { + userDTOs := ToSanitizedUserDTOs(users) + return SanitizedUserListDTO{ + Users: userDTOs, + Count: len(userDTOs), + Limit: limit, + Offset: offset, + } +} + type RegistrationResponseDTO struct { User UserDTO `json:"user"` VerificationSent bool `json:"verification_sent"`