Compare commits
2 Commits
cbfe0fd54c
...
1ff1c8faf4
| Author | SHA1 | Date | |
|---|---|---|---|
| 1ff1c8faf4 | |||
| 0bcc1eb427 |
@@ -75,3 +75,24 @@ func ToPostDTOs(posts []database.Post) []PostDTO {
|
||||
}
|
||||
return dtos
|
||||
}
|
||||
|
||||
func ToPostListDTO(posts []database.Post, limit, offset int) PostListDTO {
|
||||
postDTOs := ToPostDTOs(posts)
|
||||
return PostListDTO{
|
||||
Posts: postDTOs,
|
||||
Count: len(postDTOs),
|
||||
Limit: limit,
|
||||
Offset: offset,
|
||||
}
|
||||
}
|
||||
|
||||
func ToSearchPostListDTO(posts []database.Post, query string, limit, offset int) SearchPostListDTO {
|
||||
postDTOs := ToPostDTOs(posts)
|
||||
return SearchPostListDTO{
|
||||
Posts: postDTOs,
|
||||
Count: len(postDTOs),
|
||||
Query: query,
|
||||
Limit: limit,
|
||||
Offset: offset,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"`
|
||||
|
||||
Reference in New Issue
Block a user