(ctx context.Context, paths []string)
| 440 | } |
| 441 | |
| 442 | func (c *SpaceComponent) ListByPath(ctx context.Context, paths []string) ([]*types.Space, error) { |
| 443 | var spaces []*types.Space |
| 444 | |
| 445 | spacesData, err := c.ss.ListByPath(ctx, paths) |
| 446 | if err != nil { |
| 447 | return nil, fmt.Errorf("list space db failed, %w", err) |
| 448 | } |
| 449 | for _, data := range spacesData { |
| 450 | _, status, _ := c.status(ctx, &data) |
| 451 | var tags []types.RepoTag |
| 452 | for _, tag := range data.Repository.Tags { |
| 453 | tags = append(tags, types.RepoTag{ |
| 454 | Name: tag.Name, |
| 455 | Category: tag.Category, |
| 456 | Group: tag.Group, |
| 457 | BuiltIn: tag.BuiltIn, |
| 458 | ShowName: tag.ShowName, |
| 459 | CreatedAt: tag.CreatedAt, |
| 460 | UpdatedAt: tag.UpdatedAt, |
| 461 | }) |
| 462 | } |
| 463 | spaces = append(spaces, &types.Space{ |
| 464 | Name: data.Repository.Name, |
| 465 | Description: data.Repository.Description, |
| 466 | Path: data.Repository.Path, |
| 467 | Sdk: data.Sdk, |
| 468 | SdkVersion: data.SdkVersion, |
| 469 | Template: data.Template, |
| 470 | Env: data.Env, |
| 471 | Hardware: data.Hardware, |
| 472 | Secrets: data.Secrets, |
| 473 | CoverImageUrl: data.CoverImageUrl, |
| 474 | License: data.Repository.License, |
| 475 | Private: data.Repository.Private, |
| 476 | Likes: data.Repository.Likes, |
| 477 | CreatedAt: data.Repository.CreatedAt, |
| 478 | UpdatedAt: data.Repository.UpdatedAt, |
| 479 | Tags: tags, |
| 480 | Status: status, |
| 481 | RepositoryID: data.Repository.ID, |
| 482 | }) |
| 483 | } |
| 484 | return spaces, nil |
| 485 | } |
| 486 | |
| 487 | func (c *SpaceComponent) AllowCallApi(ctx context.Context, spaceID int64, username string) (bool, error) { |
| 488 | if username == "" { |
no test coverage detected