feat: update bug fixing article
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
5affb20eac
commit
0a9789ae2d
|
|
@ -36,7 +36,7 @@ type ArticlesCreateRequest struct {
|
|||
Slug string `json:"slug" validate:"required"`
|
||||
Description string `json:"description" validate:"required"`
|
||||
HtmlDescription string `json:"htmlDescription" validate:"required"`
|
||||
CategoryIds string `json:"categoryIds" validate:"required"`
|
||||
CategoryIds string `json:"categoryIds" validate:"omitempty"`
|
||||
TypeId int `json:"typeId" validate:"required"`
|
||||
Tags string `json:"tags" validate:"required"`
|
||||
AiArticleId *int `json:"aiArticleId"`
|
||||
|
|
@ -71,7 +71,7 @@ type ArticlesUpdateRequest struct {
|
|||
Slug string `json:"slug" validate:"required"`
|
||||
Description string `json:"description" validate:"required"`
|
||||
HtmlDescription string `json:"htmlDescription" validate:"required"`
|
||||
CategoryIds string `json:"categoryIds" validate:"required"`
|
||||
CategoryIds string `json:"categoryIds" validate:"omitempty"`
|
||||
TypeId int `json:"typeId" validate:"required"`
|
||||
Tags string `json:"tags" validate:"required"`
|
||||
CreatedAt *string `json:"createdAt"`
|
||||
|
|
|
|||
|
|
@ -336,14 +336,23 @@ func (_i *articlesService) Save(clientId *uuid.UUID, req request.ArticlesCreateR
|
|||
}
|
||||
|
||||
var categoryIds []string
|
||||
if req.CategoryIds != "" {
|
||||
categoryIds = strings.Split(req.CategoryIds, ",")
|
||||
if strings.TrimSpace(req.CategoryIds) != "" {
|
||||
for _, part := range strings.Split(req.CategoryIds, ",") {
|
||||
part = strings.TrimSpace(part)
|
||||
if part == "" {
|
||||
continue
|
||||
}
|
||||
categoryIds = append(categoryIds, part)
|
||||
}
|
||||
}
|
||||
|
||||
_i.Log.Info().Interface("categoryIds", categoryIds).Msg("")
|
||||
|
||||
for _, categoryId := range categoryIds {
|
||||
categoryIdInt, _ := strconv.Atoi(categoryId)
|
||||
categoryIdInt, parseErr := strconv.Atoi(categoryId)
|
||||
if parseErr != nil || categoryIdInt <= 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
_i.Log.Info().Interface("categoryIdUint", uint(categoryIdInt)).Msg("")
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue