(ctx context.Context, teamId string, keyword string)
| 1269 | } |
| 1270 | |
| 1271 | func (i *imlAppModule) searchMyApps(ctx context.Context, teamId string, keyword string) ([]*service.Service, error) { |
| 1272 | userID := utils.UserId(ctx) |
| 1273 | condition := make(map[string]interface{}) |
| 1274 | condition["as_app"] = true |
| 1275 | if teamId != "" { |
| 1276 | _, err := i.teamService.Get(ctx, teamId) |
| 1277 | if err != nil { |
| 1278 | return nil, err |
| 1279 | } |
| 1280 | condition["team"] = teamId |
| 1281 | return i.serviceService.Search(ctx, keyword, condition, "update_at desc") |
| 1282 | } else { |
| 1283 | membersForUser, err := i.teamMemberService.FilterMembersForUser(ctx, userID) |
| 1284 | if err != nil { |
| 1285 | return nil, err |
| 1286 | } |
| 1287 | teamIds := membersForUser[userID] |
| 1288 | condition["team"] = teamIds |
| 1289 | |
| 1290 | return i.serviceService.Search(ctx, keyword, condition, "update_at desc") |
| 1291 | } |
| 1292 | } |
| 1293 | |
| 1294 | func (i *imlAppModule) SearchMyApps(ctx context.Context, teamId string, keyword string) ([]*service_dto.AppItem, error) { |
| 1295 | services, err := i.searchMyApps(ctx, teamId, keyword) |
no test coverage detected