MCPcopy Create free account
hub / github.com/OpenCSGs/csghub-server / ListByPath

Method ListByPath

component/space.go:442–485  ·  view source on GitHub ↗
(ctx context.Context, paths []string)

Source from the content-addressed store, hash-verified

440}
441
442func (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
487func (c *SpaceComponent) AllowCallApi(ctx context.Context, spaceID int64, username string) (bool, error) {
488 if username == "" {

Callers 6

getRelationsMethod · 0.45
ListModelsByPathMethod · 0.45
ListDatasetsByPathMethod · 0.45
ListSpacesByPathMethod · 0.45

Calls 1

statusMethod · 0.95

Tested by

no test coverage detected