feat: add feedbacks and update article comments
This commit is contained in:
parent
b322cccfff
commit
1c259c2bc0
|
|
@ -10,7 +10,7 @@ type Feedbacks struct {
|
|||
StatusId int `json:"status_id" gorm:"type:int4;default:0"`
|
||||
ApprovedAt *time.Time `json:"approved_at" gorm:"type:timestamp"`
|
||||
ReplyMessage *string `json:"reply_message" gorm:"type:varchar"`
|
||||
IsActive bool `json:"is_active" gorm:"type:bool"`
|
||||
IsActive bool `json:"is_active" gorm:"type:bool;default:true"`
|
||||
CreatedAt time.Time `json:"created_at" gorm:"default:now()"`
|
||||
UpdatedAt time.Time `json:"updated_at" gorm:"default:now()"`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ func ArticleCommentsResponseMapper(articleCommentsReq *entity.ArticleComments, u
|
|||
CommentFromName: &commentFromName,
|
||||
ParentId: articleCommentsReq.ParentId,
|
||||
IsPublic: articleCommentsReq.IsPublic,
|
||||
StatusId: articleCommentsReq.StatusId,
|
||||
IsActive: articleCommentsReq.IsActive,
|
||||
CreatedAt: articleCommentsReq.CreatedAt,
|
||||
UpdatedAt: articleCommentsReq.UpdatedAt,
|
||||
|
|
|
|||
|
|
@ -51,6 +51,9 @@ func (_i *articleCommentsRepository) GetAll(req request.ArticleCommentsQueryRequ
|
|||
if req.ParentId != nil {
|
||||
query = query.Where("parent_id = ?", req.ParentId)
|
||||
}
|
||||
if req.IsPublic != nil {
|
||||
query = query.Where("is_public = ?", req.IsPublic)
|
||||
}
|
||||
query.Count(&count)
|
||||
|
||||
if req.Pagination.SortBy != "" {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ type ArticleCommentsResponse struct {
|
|||
CommentFromId *uint `json:"commentFromId"`
|
||||
CommentFromName *string `json:"commentFromName"`
|
||||
ParentId *int `json:"parentId"`
|
||||
StatusId int `json:"statusId"`
|
||||
IsPublic bool `json:"isPublic"`
|
||||
IsActive bool `json:"isActive"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ func (req FeedbacksCreateRequest) ToEntity() *entity.Feedbacks {
|
|||
CommentFromName: req.CommentFromName,
|
||||
CommentFromEmail: req.CommentFromEmail,
|
||||
StatusId: 0,
|
||||
IsActive: true,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue