Compare commits

..

3 Commits

3 changed files with 35 additions and 0 deletions

View File

@@ -29,6 +29,14 @@ type PostListDTO struct {
Offset int `json:"offset"`
}
type SearchPostListDTO struct {
Posts []PostDTO `json:"posts"`
Count int `json:"count"`
Query string `json:"query"`
Limit int `json:"limit"`
Offset int `json:"offset"`
}
func ToPostDTO(post *database.Post) PostDTO {
if post == nil {
return PostDTO{}

View File

@@ -74,3 +74,19 @@ func ToSanitizedUserDTOs(users []database.User) []SanitizedUserDTO {
}
return dtos
}
type RegistrationResponseDTO struct {
User UserDTO `json:"user"`
VerificationSent bool `json:"verification_sent"`
}
func ToRegistrationResponseDTO(user *database.User, verificationSent bool) RegistrationResponseDTO {
return RegistrationResponseDTO{
User: ToUserDTO(user),
VerificationSent: verificationSent,
}
}
type AccountDeletionResponseDTO struct {
PostsDeleted bool `json:"posts_deleted"`
}

View File

@@ -41,3 +41,14 @@ func ToVoteDTOs(votes []database.Vote) []VoteDTO {
}
return dtos
}
type VoteResponseDTO struct {
HasVote bool `json:"has_vote"`
Vote *VoteDTO `json:"vote,omitempty"`
IsAnonymous bool `json:"is_anonymous"`
}
type VoteListDTO struct {
Votes []VoteDTO `json:"votes"`
Count int `json:"count"`
}