add default router when create new rest service

This commit is contained in:
Liujian
2024-12-16 14:31:52 +08:00
parent 4c685a9ec6
commit 0a1b08157d
6 changed files with 99 additions and 14 deletions
+5 -1
View File
@@ -3,6 +3,7 @@ package api_doc
import (
"context"
"errors"
api_doc_dto "github.com/APIParkLab/APIPark/module/api-doc/dto"
api_doc "github.com/APIParkLab/APIPark/service/api-doc"
"github.com/APIParkLab/APIPark/service/service"
@@ -20,16 +21,19 @@ type imlAPIDocModule struct {
}
func (i *imlAPIDocModule) UpdateDoc(ctx context.Context, serviceId string, input *api_doc_dto.UpdateDoc) (*api_doc_dto.ApiDocDetail, error) {
_, err := i.serviceService.Get(ctx, serviceId)
info, err := i.serviceService.Get(ctx, serviceId)
if err != nil {
return nil, err
}
if input.Id == "" {
input.Id = uuid.New().String()
}
// 每个API加上前缀
err = i.apiDocService.UpdateDoc(ctx, serviceId, &api_doc.UpdateDoc{
ID: input.Id,
Content: input.Content,
Prefix: info.Prefix,
})
if err != nil {
return nil, err