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