diff --git a/app/module/articles/controller/articles.controller.go b/app/module/articles/controller/articles.controller.go index 869e80b..1d70787 100644 --- a/app/module/articles/controller/articles.controller.go +++ b/app/module/articles/controller/articles.controller.go @@ -64,6 +64,7 @@ func (_i *articlesController) All(c *fiber.Ctx) error { StatusId: c.Query("statusId"), IsPublish: c.Query("isPublish"), IsDraft: c.Query("isDraft"), + IsBanner: c.Query("isBanner"), } req := reqContext.ToParamRequest() req.Pagination = paginate diff --git a/app/module/articles/mapper/articles.mapper.go b/app/module/articles/mapper/articles.mapper.go index 9c7dbc1..c00f924 100644 --- a/app/module/articles/mapper/articles.mapper.go +++ b/app/module/articles/mapper/articles.mapper.go @@ -69,6 +69,7 @@ func ArticlesResponseMapper( ViewCount: articlesReq.ViewCount, CommentCount: articlesReq.CommentCount, StatusId: articlesReq.StatusId, + IsBanner: articlesReq.IsBanner, IsPublish: articlesReq.IsPublish, PublishedAt: articlesReq.PublishedAt, IsActive: articlesReq.IsActive, diff --git a/app/module/articles/repository/articles.repository.go b/app/module/articles/repository/articles.repository.go index af12de0..e974ec3 100644 --- a/app/module/articles/repository/articles.repository.go +++ b/app/module/articles/repository/articles.repository.go @@ -68,6 +68,9 @@ func (_i *articlesRepository) GetAll(req request.ArticlesQueryRequest) (articles if req.IsPublish != nil { query = query.Where("articles.is_publish = ?", req.IsPublish) } + if req.IsBanner != nil { + query = query.Where("articles.is_banner = ?", req.IsBanner) + } if req.IsDraft != nil { query = query.Where("articles.is_draft = ?", req.IsDraft) } diff --git a/app/module/articles/request/articles.request.go b/app/module/articles/request/articles.request.go index 93753b2..2ae1302 100644 --- a/app/module/articles/request/articles.request.go +++ b/app/module/articles/request/articles.request.go @@ -20,6 +20,7 @@ type ArticlesQueryRequest struct { Tags *string `json:"tags"` CreatedById *int `json:"createdById"` StatusId *int `json:"statusId"` + IsBanner *bool `json:"isBanner"` IsPublish *bool `json:"isPublish"` IsDraft *bool `json:"isDraft"` Pagination *paginator.Pagination `json:"pagination"` @@ -113,6 +114,7 @@ type ArticlesQueryRequestContext struct { TypeId string `json:"typeId"` Tags string `json:"tags"` CreatedById string `json:"createdById"` + IsBanner string `json:"isBanner"` IsPublish string `json:"isPublish"` IsDraft string `json:"isDraft"` StatusId string `json:"statusId"` @@ -152,6 +154,12 @@ func (req ArticlesQueryRequestContext) ToParamRequest() ArticlesQueryRequest { request.IsPublish = &isPublish } } + if isBannerStr := req.IsBanner; isBannerStr != "" { + isBanner, err := strconv.ParseBool(isBannerStr) + if err == nil { + request.IsBanner = &isBanner + } + } if isDraftStr := req.IsDraft; isDraftStr != "" { isDraft, err := strconv.ParseBool(isDraftStr) if err == nil { diff --git a/app/module/articles/response/articles.response.go b/app/module/articles/response/articles.response.go index dc248f3..4f864e9 100644 --- a/app/module/articles/response/articles.response.go +++ b/app/module/articles/response/articles.response.go @@ -25,6 +25,7 @@ type ArticlesResponse struct { CommentCount *int `json:"commentCount"` AiArticleId *int `json:"aiArticleId"` StatusId *int `json:"statusId"` + IsBanner *bool `json:"isBanner"` IsPublish *bool `json:"isPublish"` PublishedAt *time.Time `json:"publishedAt"` IsActive *bool `json:"isActive"` diff --git a/docs/swagger/docs.go b/docs/swagger/docs.go index 3f8d5a0..778cb3a 100644 --- a/docs/swagger/docs.go +++ b/docs/swagger/docs.go @@ -3102,6 +3102,11 @@ const docTemplate = `{ "name": "description", "in": "query" }, + { + "type": "boolean", + "name": "isBanner", + "in": "query" + }, { "type": "boolean", "name": "isDraft", diff --git a/docs/swagger/swagger.json b/docs/swagger/swagger.json index dcc5379..cc0db49 100644 --- a/docs/swagger/swagger.json +++ b/docs/swagger/swagger.json @@ -3091,6 +3091,11 @@ "name": "description", "in": "query" }, + { + "type": "boolean", + "name": "isBanner", + "in": "query" + }, { "type": "boolean", "name": "isDraft", diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 609cad0..5517245 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -2863,6 +2863,9 @@ paths: - in: query name: description type: string + - in: query + name: isBanner + type: boolean - in: query name: isDraft type: boolean