(ctx context.Context, teamId string, keyword string)
| 451 | } |
| 452 | |
| 453 | func (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 | |
| 475 | func (i *imlServiceModule) SearchMyServices(ctx context.Context, teamId string, keyword string) ([]*service_dto.ServiceItem, error) { |
| 476 | services, err := i.searchMyServices(ctx, teamId, keyword) |
no test coverage detected