Files
tp/main_dc/yalarba/api_yal/internal/domain/comment/dto.go
T
valitovgaziz cc3d0a8b07 On branch main
modified:   yalarba/api_yal/internal/domain/account/service.go
	modified:   yalarba/api_yal/internal/domain/comment/dto.go
	new file:   yalarba/api_yal/internal/domain/comment/handler.go
	new file:   yalarba/api_yal/internal/domain/comment/router.go
	new file:   yalarba/api_yal/internal/domain/comment/service.go
	modified:   yalarba/api_yal/internal/repository/feedback_repository.go
	new file:   yalarba/api_yal/internal/util/JSON_resp.go
Realize comment domain hole
2026-05-19 18:11:20 +05:00

55 lines
2.0 KiB
Go

package comment
import (
"time"
)
// CommentResponse - полный ответ для комментария
type CommentResponse struct {
ID uint `json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
AuthorID uint `json:"author_id"`
AuthorName string `json:"author_name"`
FeedbackID uint `json:"feedback_id"`
Text string `json:"text"`
ParentID *uint `json:"parent_id,omitempty"`
IsEdited bool `json:"is_edited"`
IsVerified bool `json:"is_verified"`
Replies []CommentShortResponse `json:"replies,omitempty"`
RepliesCount int64 `json:"replies_count,omitempty"`
}
// CommentShortResponse - краткий ответ для комментария
type CommentShortResponse struct {
ID uint `json:"id"`
CreatedAt time.Time `json:"created_at"`
AuthorID uint `json:"author_id"`
AuthorName string `json:"author_name"`
Text string `json:"text"`
IsEdited bool `json:"is_edited"`
}
// CreateCommentRequest - DTO для создания комментария
type CreateCommentRequest struct {
FeedbackID uint `json:"feedback_id" binding:"required"`
Text string `json:"text" binding:"required,min=1,max=5000"`
ParentID *uint `json:"parent_id"` // опционально, для ответов на комментарии
}
// UpdateCommentRequest - DTO для обновления комментария
type UpdateCommentRequest struct {
Text string `json:"text" binding:"required,min=1,max=5000"`
}
// ListCommentsRequest - DTO для списка комментариев с фильтрацией
type ListCommentsRequest struct {
Page int `form:"page,default=1"`
PageSize int `form:"page_size,default=20"`
FeedbackID *uint `form:"feedback_id"`
AuthorID *uint `form:"author_id"`
ParentID *uint `form:"parent_id"`
Verified *bool `form:"verified"`
SortBy string `form:"sort_by,default=created_at"`
SortOrder string `form:"sort_order,default=desc"`
}