Add framework node query support

Signed-off-by: gearnode <bryan@frimin.fr>
This commit is contained in:
gearnode
2025-01-31 08:27:48 -08:00
parent 940bc597ea
commit c03be7636a
2 changed files with 27 additions and 0 deletions

View File

@@ -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:
}

View File

@@ -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,