(ctx context.Context, teamId string, keyword string)
| 473 | } |
| 474 | |
| 475 | func (i *imlServiceModule) SearchMyServices(ctx context.Context, teamId string, keyword string) ([]*service_dto.ServiceItem, error) { |
| 476 | services, err := i.searchMyServices(ctx, teamId, keyword) |
| 477 | if err != nil { |
| 478 | return nil, err |
| 479 | } |
| 480 | serviceIds := utils.SliceToSlice(services, func(p *service.Service) string { |
| 481 | return p.Id |
| 482 | }) |
| 483 | //apiCountMap, err := i.apiDocService.APICountByServices(ctx, serviceIds...) |
| 484 | //if err != nil { |
| 485 | // return nil, err |
| 486 | //} |
| 487 | //serviceIds := utils.SliceToSlice(services, func(s *service.Service) string { |
| 488 | // return s.Id |
| 489 | //}) |
| 490 | overviewMap, err := i.serviceOverviewService.Map(ctx, serviceIds...) |
| 491 | if err != nil { |
| 492 | return nil, err |
| 493 | } |
| 494 | |
| 495 | items := make([]*service_dto.ServiceItem, 0, len(services)) |
| 496 | for _, model := range services { |
| 497 | if teamId != "" && model.Team != teamId { |
| 498 | continue |
| 499 | } |
| 500 | item := toServiceItem(model) |
| 501 | if ov, ok := overviewMap[model.Id]; ok { |
| 502 | item.ApiNum = ov.ApiCount |
| 503 | item.CanDelete = ov.ApiCount == 0 |
| 504 | } |
| 505 | |
| 506 | items = append(items, item) |
| 507 | |
| 508 | } |
| 509 | return items, nil |
| 510 | } |
| 511 | |
| 512 | func (i *imlServiceModule) Simple(ctx context.Context) ([]*service_dto.SimpleServiceItem, error) { |
| 513 | w := make(map[string]interface{}) |
nothing calls this directly
no test coverage detected