From c03be7636a3ed4aa87b95912faaec67560bd2b29 Mon Sep 17 00:00:00 2001 From: gearnode Date: Fri, 31 Jan 2025 08:27:48 -0800 Subject: [PATCH] Add framework node query support Signed-off-by: gearnode --- pkg/api/console/v1/v1_resolver.go | 7 +++++++ pkg/probo/probo.go | 20 ++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/pkg/api/console/v1/v1_resolver.go b/pkg/api/console/v1/v1_resolver.go index f48ada473..ad7e12811 100644 --- a/pkg/api/console/v1/v1_resolver.go +++ b/pkg/api/console/v1/v1_resolver.go @@ -124,6 +124,13 @@ func (r *queryResolver) Node(ctx context.Context, id gid.GID) (types.Node, error } return types.NewVendor(vendor), nil + case coredata.FrameworkEntityType: + framework, err := r.svc.GetFramework(ctx, id) + if err != nil { + return nil, err + } + + return types.NewFramework(framework), nil default: } diff --git a/pkg/probo/probo.go b/pkg/probo/probo.go index 266c4c816..780c37c2c 100644 --- a/pkg/probo/probo.go +++ b/pkg/probo/probo.go @@ -109,6 +109,26 @@ func (s Service) GetVendor( return vendor, nil } +func (s Service) GetFramework( + ctx context.Context, + frameworkID gid.GID, +) (*coredata.Framework, error) { + framework := &coredata.Framework{} + + err := s.pg.WithConn( + ctx, + func(conn pg.Conn) error { + return framework.LoadByID(ctx, conn, s.scope, frameworkID) + }, + ) + + if err != nil { + return nil, err + } + + return framework, nil +} + func (s Service) ListOrganizationFrameworks( ctx context.Context, organizationID gid.GID,