diff --git a/module/service/dto/input.go b/module/service/dto/input.go index c258de5..5f49366 100644 --- a/module/service/dto/input.go +++ b/module/service/dto/input.go @@ -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 { diff --git a/module/service/iml.go b/module/service/iml.go index bff74cd..5869341 100644 --- a/module/service/iml.go +++ b/module/service/iml.go @@ -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 {