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

Method Relations

component/model.go:549–561  ·  view source on GitHub ↗
(ctx context.Context, namespace, name, currentUser string)

Source from the content-addressed store, hash-verified

547}
548
549func (c *ModelComponent) Relations(ctx context.Context, namespace, name, currentUser string) (*types.Relations, error) {
550 model, err := c.ms.FindByPath(ctx, namespace, name)
551 if err != nil {
552 return nil, fmt.Errorf("failed to find model, error: %w", err)
553 }
554
555 allow, _ := c.AllowReadAccessRepo(ctx, model.Repository, currentUser)
556 if !allow {
557 return nil, ErrUnauthorized
558 }
559
560 return c.getRelations(ctx, model.RepositoryID, currentUser)
561}
562
563func (c *ModelComponent) getRelations(ctx context.Context, fromRepoID int64, currentUser string) (*types.Relations, error) {
564 res, err := c.relatedRepos(ctx, fromRepoID, currentUser)

Callers

nothing calls this directly

Calls 3

getRelationsMethod · 0.95
AllowReadAccessRepoMethod · 0.80
FindByPathMethod · 0.45

Tested by

no test coverage detected