Skip to content

Commit

Permalink
修复创建服务,标签更新失败的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Dot-Liu committed Aug 12, 2024
1 parent cd885a4 commit 4c1c0e3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
19 changes: 10 additions & 9 deletions module/service/dto/input.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package service_dto

type CreateService struct {
Id string `json:"id"`
Name string `json:"name"`
Prefix string `json:"prefix"`
Description string `json:"description"`
ServiceType string `json:"service_type"`
Logo string `json:"logo"`
Catalogue string `json:"catalogue" aocheck:"catalogue"`
AsApp *bool `json:"as_app"`
AsServer *bool `json:"as_server"`
Id string `json:"id"`
Name string `json:"name"`
Prefix string `json:"prefix"`
Description string `json:"description"`
ServiceType string `json:"service_type"`
Logo string `json:"logo"`
Tags []string `json:"tags"`
Catalogue string `json:"catalogue" aocheck:"catalogue"`
AsApp *bool `json:"as_app"`
AsServer *bool `json:"as_server"`
}

type EditService struct {
Expand Down
15 changes: 15 additions & 0 deletions module/service/iml.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,21 @@ func (i *imlServiceModule) Create(ctx context.Context, teamID string, input *ser
}
input.Prefix = strings.Trim(strings.Trim(input.Prefix, " "), "/")
err := i.transaction.Transaction(ctx, func(ctx context.Context) error {
if input.Tags != nil {
tags, err := i.getTagUuids(ctx, input.Tags)
if err != nil {
return err
}
for _, t := range tags {
err = i.serviceTagService.Create(ctx, &service_tag.CreateTag{
Tid: t,
Sid: input.Id,
})
if err != nil {
return err
}
}
}
return i.serviceService.Create(ctx, mo)
})
if err != nil {
Expand Down

0 comments on commit 4c1c0e3

Please sign in to comment.