MCPcopy Index your code
hub / github.com/APIParkLab/APIPark / searchMyServices

Method searchMyServices

module/service/iml.go:453–473  ·  view source on GitHub ↗
(ctx context.Context, teamId string, keyword string)

Source from the content-addressed store, hash-verified

451}
452
453func (i *imlServiceModule) searchMyServices(ctx context.Context, teamId string, keyword string) ([]*service.Service, error) {
454 userID := utils.UserId(ctx)
455 condition := make(map[string]interface{})
456 condition["as_server"] = true
457 if teamId != "" {
458 _, err := i.teamService.Get(ctx, teamId)
459 if err != nil {
460 return nil, err
461 }
462 condition["team"] = teamId
463 return i.serviceService.Search(ctx, keyword, condition, "create_at desc")
464 } else {
465 membersForUser, err := i.teamMemberService.FilterMembersForUser(ctx, userID)
466 if err != nil {
467 return nil, err
468 }
469 teamIds := membersForUser[userID]
470 condition["team"] = teamIds
471 return i.serviceService.Search(ctx, keyword, condition, "create_at desc")
472 }
473}
474
475func (i *imlServiceModule) SearchMyServices(ctx context.Context, teamId string, keyword string) ([]*service_dto.ServiceItem, error) {
476 services, err := i.searchMyServices(ctx, teamId, keyword)

Callers 2

SearchMyServicesMethod · 0.95
MySimpleMethod · 0.95

Calls 2

GetMethod · 0.65
SearchMethod · 0.65

Tested by

no test coverage detected