| 223 | } |
| 224 | |
| 225 | func (i *imlRouterModule) SimpleSearch(ctx context.Context, keyword string, serviceId string) ([]*router_dto.SimpleItem, error) { |
| 226 | _, err := i.serviceService.Check(ctx, serviceId, asServer) |
| 227 | if err != nil { |
| 228 | return nil, err |
| 229 | } |
| 230 | |
| 231 | list, err := i.apiService.Search(ctx, keyword, map[string]interface{}{ |
| 232 | "service": serviceId, |
| 233 | }) |
| 234 | if err != nil { |
| 235 | return nil, err |
| 236 | } |
| 237 | apiInfos, err := i.apiService.ListInfo(ctx, utils.SliceToSlice(list, func(s *api.API) string { |
| 238 | return s.UUID |
| 239 | })...) |
| 240 | if err != nil { |
| 241 | return nil, err |
| 242 | } |
| 243 | out := utils.SliceToSlice(apiInfos, func(item *api.Info) *router_dto.SimpleItem { |
| 244 | return &router_dto.SimpleItem{ |
| 245 | Id: item.UUID, |
| 246 | Methods: item.Methods, |
| 247 | Path: item.Path, |
| 248 | } |
| 249 | }) |
| 250 | return out, nil |
| 251 | } |
| 252 | |
| 253 | func (i *imlRouterModule) Create(ctx context.Context, serviceId string, dto *router_dto.Create) (*router_dto.SimpleDetail, error) { |
| 254 | info, err := i.serviceService.Check(ctx, serviceId, asServer) |