feat: add ToUserListDTO and ToSanitizedUserListDTO helpers

This commit is contained in:
2026-01-10 22:38:30 +01:00
parent cbfe0fd54c
commit 0bcc1eb427

View File

@@ -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"`