Add compliance frameworks

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
Sacha Al Himdani
2026-03-03 08:56:39 +01:00
parent 4d882e37b0
commit c17c53e80f
36 changed files with 5303 additions and 90 deletions

View File

@@ -1227,6 +1227,34 @@ enum TrustCenterReferenceOrderField
)
}
enum ComplianceFrameworkOrderField
@goModel(
model: "go.probo.inc/probo/pkg/coredata.ComplianceFrameworkOrderField"
) {
CREATED_AT
@goEnum(
value: "go.probo.inc/probo/pkg/coredata.ComplianceFrameworkOrderFieldCreatedAt"
)
RANK
@goEnum(
value: "go.probo.inc/probo/pkg/coredata.ComplianceFrameworkOrderFieldRank"
)
}
enum ComplianceFrameworkVisibility
@goModel(
model: "go.probo.inc/probo/pkg/coredata.ComplianceFrameworkVisibility"
) {
NONE
@goEnum(
value: "go.probo.inc/probo/pkg/coredata.ComplianceFrameworkVisibilityNone"
)
PUBLIC
@goEnum(
value: "go.probo.inc/probo/pkg/coredata.ComplianceFrameworkVisibilityPublic"
)
}
enum TrustCenterFileOrderField
@goModel(
model: "go.probo.inc/probo/pkg/coredata.TrustCenterFileOrderField"
@@ -1463,6 +1491,14 @@ input TrustCenterFileOrder
field: TrustCenterFileOrderField!
}
input ComplianceFrameworkOrder
@goModel(
model: "go.probo.inc/probo/pkg/server/api/console/v1/types.ComplianceFrameworkOrderBy"
) {
direction: OrderDirection!
field: ComplianceFrameworkOrderField!
}
input EvidenceOrder
@goModel(
model: "go.probo.inc/probo/pkg/server/api/console/v1/types.EvidenceOrderBy"
@@ -1614,6 +1650,14 @@ type TrustCenter implements Node {
orderBy: TrustCenterReferenceOrder
): TrustCenterReferenceConnection! @goField(forceResolver: true)
complianceFrameworks(
first: Int
after: CursorKey
last: Int
before: CursorKey
orderBy: ComplianceFrameworkOrder
): ComplianceFrameworkConnection! @goField(forceResolver: true)
permission(action: String!): Boolean! @goField(forceResolver: true)
}
@@ -2806,6 +2850,31 @@ type TrustCenterReferenceEdge {
node: TrustCenterReference!
}
type ComplianceFramework implements Node
@goModel(
model: "go.probo.inc/probo/pkg/server/api/console/v1/types.ComplianceFramework"
) {
id: ID!
framework: Framework! @goField(forceResolver: true)
rank: Int!
visibility: ComplianceFrameworkVisibility!
createdAt: Datetime!
updatedAt: Datetime!
}
type ComplianceFrameworkConnection
@goModel(
model: "go.probo.inc/probo/pkg/server/api/console/v1/types.ComplianceFrameworkConnection"
) {
edges: [ComplianceFrameworkEdge!]!
pageInfo: PageInfo!
}
type ComplianceFrameworkEdge {
cursor: CursorKey!
node: ComplianceFramework!
}
type TrustCenterFile implements Node {
id: ID!
name: String!
@@ -3247,6 +3316,16 @@ type Mutation {
deleteTrustCenterReference(
input: DeleteTrustCenterReferenceInput!
): DeleteTrustCenterReferencePayload!
# Compliance Framework mutations
createComplianceFramework(
input: CreateComplianceFrameworkInput!
): CreateComplianceFrameworkPayload!
updateComplianceFramework(
input: UpdateComplianceFrameworkInput!
): UpdateComplianceFrameworkPayload!
deleteComplianceFramework(
input: DeleteComplianceFrameworkInput!
): DeleteComplianceFrameworkPayload!
# Trust Center File mutations
createTrustCenterFile(
input: CreateTrustCenterFileInput!
@@ -3647,6 +3726,20 @@ input DeleteTrustCenterReferenceInput {
id: ID!
}
input CreateComplianceFrameworkInput {
trustCenterId: ID!
frameworkId: ID!
}
input UpdateComplianceFrameworkInput {
id: ID!
rank: Int!
}
input DeleteComplianceFrameworkInput {
id: ID!
}
input CreateTrustCenterFileInput {
organizationId: ID!
name: String!
@@ -4462,6 +4555,18 @@ type DeleteTrustCenterReferencePayload {
deletedTrustCenterReferenceId: ID!
}
type CreateComplianceFrameworkPayload {
complianceFrameworkEdge: ComplianceFrameworkEdge!
}
type UpdateComplianceFrameworkPayload {
complianceFramework: ComplianceFramework!
}
type DeleteComplianceFrameworkPayload {
deletedComplianceFrameworkId: ID!
}
type CreateTrustCenterFilePayload {
trustCenterFileEdge: TrustCenterFileEdge!
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,76 @@
// Copyright (c) 2025 Probo Inc <hello@getprobo.com>.
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
package types
import (
"time"
"go.probo.inc/probo/pkg/coredata"
"go.probo.inc/probo/pkg/gid"
"go.probo.inc/probo/pkg/page"
)
type ComplianceFrameworkOrderBy = OrderBy[coredata.ComplianceFrameworkOrderField]
type ComplianceFramework struct {
ID gid.GID `json:"id"`
Framework *Framework `json:"framework"`
Rank int `json:"rank"`
Visibility coredata.ComplianceFrameworkVisibility `json:"visibility"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
FrameworkID gid.GID `json:"-"`
}
func (ComplianceFramework) IsNode() {}
func (c ComplianceFramework) GetID() gid.GID { return c.ID }
type ComplianceFrameworkConnection struct {
Edges []*ComplianceFrameworkEdge `json:"edges"`
PageInfo *PageInfo `json:"pageInfo"`
}
func NewComplianceFramework(cf *coredata.ComplianceFramework) *ComplianceFramework {
return &ComplianceFramework{
ID: cf.ID,
FrameworkID: cf.FrameworkID,
Rank: cf.Rank,
Visibility: cf.Visibility,
CreatedAt: cf.CreatedAt,
UpdatedAt: cf.UpdatedAt,
}
}
func NewComplianceFrameworkConnection(
p *page.Page[*coredata.ComplianceFramework, coredata.ComplianceFrameworkOrderField],
) *ComplianceFrameworkConnection {
edges := make([]*ComplianceFrameworkEdge, len(p.Data))
for i := range edges {
edges[i] = NewComplianceFrameworkEdge(p.Data[i], p.Cursor.OrderBy.Field)
}
return &ComplianceFrameworkConnection{
Edges: edges,
PageInfo: NewPageInfo(p),
}
}
func NewComplianceFrameworkEdge(cf *coredata.ComplianceFramework, orderBy coredata.ComplianceFrameworkOrderField) *ComplianceFrameworkEdge {
return &ComplianceFrameworkEdge{
Cursor: cf.CursorKey(orderBy),
Node: NewComplianceFramework(cf),
}
}

View File

@@ -149,6 +149,11 @@ type CancelSignatureRequestPayload struct {
DeletedDocumentVersionSignatureID gid.GID `json:"deletedDocumentVersionSignatureId"`
}
type ComplianceFrameworkEdge struct {
Cursor page.CursorKey `json:"cursor"`
Node *ComplianceFramework `json:"node"`
}
type ContinualImprovement struct {
ID gid.GID `json:"id"`
SnapshotID *gid.GID `json:"snapshotId,omitempty"`
@@ -250,6 +255,15 @@ type CreateAuditPayload struct {
AuditEdge *AuditEdge `json:"auditEdge"`
}
type CreateComplianceFrameworkInput struct {
TrustCenterID gid.GID `json:"trustCenterId"`
FrameworkID gid.GID `json:"frameworkId"`
}
type CreateComplianceFrameworkPayload struct {
ComplianceFrameworkEdge *ComplianceFrameworkEdge `json:"complianceFrameworkEdge"`
}
type CreateContinualImprovementInput struct {
OrganizationID gid.GID `json:"organizationId"`
ReferenceID string `json:"referenceId"`
@@ -789,6 +803,14 @@ type DeleteAuditReportPayload struct {
Audit *Audit `json:"audit"`
}
type DeleteComplianceFrameworkInput struct {
ID gid.GID `json:"id"`
}
type DeleteComplianceFrameworkPayload struct {
DeletedComplianceFrameworkID gid.GID `json:"deletedComplianceFrameworkId"`
}
type DeleteContinualImprovementInput struct {
ContinualImprovementID gid.GID `json:"continualImprovementId"`
}
@@ -1851,18 +1873,19 @@ type TransferImpactAssessmentFilter struct {
}
type TrustCenter struct {
ID gid.GID `json:"id"`
Active bool `json:"active"`
LogoFileURL *string `json:"logoFileUrl,omitempty"`
DarkLogoFileURL *string `json:"darkLogoFileUrl,omitempty"`
NdaFileName *string `json:"ndaFileName,omitempty"`
NdaFileURL *string `json:"ndaFileUrl,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Organization *Organization `json:"organization"`
Accesses *TrustCenterAccessConnection `json:"accesses"`
References *TrustCenterReferenceConnection `json:"references"`
Permission bool `json:"permission"`
ID gid.GID `json:"id"`
Active bool `json:"active"`
LogoFileURL *string `json:"logoFileUrl,omitempty"`
DarkLogoFileURL *string `json:"darkLogoFileUrl,omitempty"`
NdaFileName *string `json:"ndaFileName,omitempty"`
NdaFileURL *string `json:"ndaFileUrl,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Organization *Organization `json:"organization"`
Accesses *TrustCenterAccessConnection `json:"accesses"`
References *TrustCenterReferenceConnection `json:"references"`
ComplianceFrameworks *ComplianceFrameworkConnection `json:"complianceFrameworks"`
Permission bool `json:"permission"`
}
func (TrustCenter) IsNode() {}
@@ -1994,6 +2017,15 @@ type UpdateAuditPayload struct {
Audit *Audit `json:"audit"`
}
type UpdateComplianceFrameworkInput struct {
ID gid.GID `json:"id"`
Rank int `json:"rank"`
}
type UpdateComplianceFrameworkPayload struct {
ComplianceFramework *ComplianceFramework `json:"complianceFramework"`
}
type UpdateContinualImprovementInput struct {
ID gid.GID `json:"id"`
ReferenceID *string `json:"referenceId,omitempty"`

View File

@@ -324,6 +324,23 @@ func (r *auditConnectionResolver) TotalCount(ctx context.Context, obj *types.Aud
return count, nil
}
// Framework is the resolver for the framework field.
func (r *complianceFrameworkResolver) Framework(ctx context.Context, obj *types.ComplianceFramework) (*types.Framework, error) {
if err := r.authorize(ctx, obj.FrameworkID, probo.ActionFrameworkGet); err != nil {
return nil, err
}
prb := r.ProboService(ctx, obj.FrameworkID.TenantID())
framework, err := prb.Frameworks.Get(ctx, obj.FrameworkID)
if err != nil {
r.logger.ErrorCtx(ctx, "cannot load framework", log.Error(err))
return nil, gqlutils.Internal(ctx)
}
return types.NewFramework(framework), nil
}
// Organization is the resolver for the organization field.
func (r *continualImprovementResolver) Organization(ctx context.Context, obj *types.ContinualImprovement) (*types.Organization, error) {
if err := r.authorize(ctx, obj.ID, probo.ActionOrganizationGet); err != nil {
@@ -2098,6 +2115,77 @@ func (r *mutationResolver) DeleteTrustCenterReference(ctx context.Context, input
}, nil
}
// CreateComplianceFramework is the resolver for the createComplianceFramework field.
func (r *mutationResolver) CreateComplianceFramework(ctx context.Context, input types.CreateComplianceFrameworkInput) (*types.CreateComplianceFrameworkPayload, error) {
if err := r.authorize(ctx, input.TrustCenterID, probo.ActionComplianceFrameworkCreate); err != nil {
return nil, err
}
prb := r.ProboService(ctx, input.TrustCenterID.TenantID())
cf, err := prb.ComplianceFrameworks.Create(
ctx,
&probo.CreateComplianceFrameworkRequest{
TrustCenterID: input.TrustCenterID,
FrameworkID: input.FrameworkID,
},
)
if err != nil {
r.logger.ErrorCtx(ctx, "cannot create compliance framework", log.Error(err))
return nil, gqlutils.Internal(ctx)
}
return &types.CreateComplianceFrameworkPayload{
ComplianceFrameworkEdge: types.NewComplianceFrameworkEdge(cf, coredata.ComplianceFrameworkOrderFieldRank),
}, nil
}
// UpdateComplianceFramework is the resolver for the updateComplianceFramework field.
func (r *mutationResolver) UpdateComplianceFramework(ctx context.Context, input types.UpdateComplianceFrameworkInput) (*types.UpdateComplianceFrameworkPayload, error) {
if err := r.authorize(ctx, input.ID, probo.ActionComplianceFrameworkUpdateRank); err != nil {
return nil, err
}
prb := r.ProboService(ctx, input.ID.TenantID())
cf, err := prb.ComplianceFrameworks.Update(ctx, &probo.UpdateComplianceFrameworkRequest{
ID: input.ID,
Rank: input.Rank,
})
if err != nil {
r.logger.ErrorCtx(ctx, "cannot update compliance framework", log.Error(err))
return nil, gqlutils.Internal(ctx)
}
return &types.UpdateComplianceFrameworkPayload{
ComplianceFramework: types.NewComplianceFramework(cf),
}, nil
}
// DeleteComplianceFramework is the resolver for the deleteComplianceFramework field.
func (r *mutationResolver) DeleteComplianceFramework(ctx context.Context, input types.DeleteComplianceFrameworkInput) (*types.DeleteComplianceFrameworkPayload, error) {
if err := r.authorize(ctx, input.ID, probo.ActionComplianceFrameworkDelete); err != nil {
return nil, err
}
prb := r.ProboService(ctx, input.ID.TenantID())
err := prb.ComplianceFrameworks.Delete(
ctx,
&probo.DeleteComplianceFrameworkRequest{
ID: input.ID,
},
)
if err != nil {
r.logger.ErrorCtx(ctx, "cannot delete compliance framework", log.Error(err))
return nil, gqlutils.Internal(ctx)
}
return &types.DeleteComplianceFrameworkPayload{
DeletedComplianceFrameworkID: input.ID,
}, nil
}
// CreateTrustCenterFile is the resolver for the createTrustCenterFile field.
func (r *mutationResolver) CreateTrustCenterFile(ctx context.Context, input types.CreateTrustCenterFileInput) (*types.CreateTrustCenterFilePayload, error) {
if err := r.authorize(ctx, input.OrganizationID, probo.ActionTrustCenterFileCreate); err != nil {
@@ -7814,6 +7902,36 @@ func (r *trustCenterResolver) References(ctx context.Context, obj *types.TrustCe
return types.NewTrustCenterReferenceConnection(result, obj.ID), nil
}
// ComplianceFrameworks is the resolver for the complianceFrameworks field.
func (r *trustCenterResolver) ComplianceFrameworks(ctx context.Context, obj *types.TrustCenter, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.OrderBy[coredata.ComplianceFrameworkOrderField]) (*types.ComplianceFrameworkConnection, error) {
if err := r.authorize(ctx, obj.ID, probo.ActionComplianceFrameworkList); err != nil {
return nil, err
}
prb := r.ProboService(ctx, obj.ID.TenantID())
pageOrderBy := page.OrderBy[coredata.ComplianceFrameworkOrderField]{
Field: coredata.ComplianceFrameworkOrderFieldRank,
Direction: page.OrderDirectionAsc,
}
if orderBy != nil {
pageOrderBy = page.OrderBy[coredata.ComplianceFrameworkOrderField]{
Field: orderBy.Field,
Direction: orderBy.Direction,
}
}
cursor := types.NewCursor(first, after, last, before, pageOrderBy)
result, err := prb.ComplianceFrameworks.ListWithHiddenForTrustCenterID(ctx, obj.ID, cursor)
if err != nil {
r.logger.ErrorCtx(ctx, "cannot list compliance frameworks", log.Error(err))
return nil, gqlutils.Internal(ctx)
}
return types.NewComplianceFrameworkConnection(result), nil
}
// Permission is the resolver for the permission field.
func (r *trustCenterResolver) Permission(ctx context.Context, obj *types.TrustCenter, action string) (bool, error) {
return r.Resolver.Permission(ctx, obj, action)
@@ -8776,6 +8894,11 @@ func (r *Resolver) AuditConnection() schema.AuditConnectionResolver {
return &auditConnectionResolver{r}
}
// ComplianceFramework returns schema.ComplianceFrameworkResolver implementation.
func (r *Resolver) ComplianceFramework() schema.ComplianceFrameworkResolver {
return &complianceFrameworkResolver{r}
}
// ContinualImprovement returns schema.ContinualImprovementResolver implementation.
func (r *Resolver) ContinualImprovement() schema.ContinualImprovementResolver {
return &continualImprovementResolver{r}
@@ -9078,6 +9201,7 @@ type assetResolver struct{ *Resolver }
type assetConnectionResolver struct{ *Resolver }
type auditResolver struct{ *Resolver }
type auditConnectionResolver struct{ *Resolver }
type complianceFrameworkResolver struct{ *Resolver }
type continualImprovementResolver struct{ *Resolver }
type continualImprovementConnectionResolver struct{ *Resolver }
type controlResolver struct{ *Resolver }

View File

@@ -107,6 +107,21 @@ type AuditEdge @nda {
node: Audit!
}
type ComplianceFramework implements Node {
id: ID!
framework: Framework! @goField(forceResolver: true)
}
type ComplianceFrameworkConnection {
edges: [ComplianceFrameworkEdge!]!
pageInfo: PageInfo!
}
type ComplianceFrameworkEdge {
cursor: CursorKey!
node: ComplianceFramework!
}
enum CountryCode
@goModel(model: "go.probo.inc/probo/pkg/coredata.CountryCode") {
AD @goEnum(value: "go.probo.inc/probo/pkg/coredata.CountryCodeAD")
@@ -542,6 +557,13 @@ type TrustCenter implements Node {
last: Int
before: CursorKey
): TrustCenterFileConnection! @goField(forceResolver: true)
complianceFrameworks(
first: Int
after: CursorKey
last: Int
before: CursorKey
): ComplianceFrameworkConnection! @goField(forceResolver: true)
}
type TrustCenterAccess implements Node {

View File

@@ -37,6 +37,7 @@ type Config = graphql.Config[ResolverRoot, DirectiveRoot, ComplexityRoot]
type ResolverRoot interface {
Audit() AuditResolver
ComplianceFramework() ComplianceFrameworkResolver
Document() DocumentResolver
Framework() FrameworkResolver
Mutation() MutationResolver
@@ -77,6 +78,21 @@ type ComplexityRoot struct {
Node func(childComplexity int) int
}
ComplianceFramework struct {
Framework func(childComplexity int) int
ID func(childComplexity int) int
}
ComplianceFrameworkConnection struct {
Edges func(childComplexity int) int
PageInfo func(childComplexity int) int
}
ComplianceFrameworkEdge struct {
Cursor func(childComplexity int) int
Node func(childComplexity int) int
}
Document struct {
Access func(childComplexity int) int
DocumentType func(childComplexity int) int
@@ -216,6 +232,7 @@ type ComplexityRoot struct {
TrustCenter struct {
Active func(childComplexity int) int
Audits func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey) int
ComplianceFrameworks func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey) int
DarkLogoFileURL func(childComplexity int) int
Documents func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey) int
ID func(childComplexity int) int
@@ -302,6 +319,9 @@ type AuditResolver interface {
Framework(ctx context.Context, obj *types.Audit) (*types.Framework, error)
Report(ctx context.Context, obj *types.Audit) (*types.Report, error)
}
type ComplianceFrameworkResolver interface {
Framework(ctx context.Context, obj *types.ComplianceFramework) (*types.Framework, error)
}
type DocumentResolver interface {
IsUserAuthorized(ctx context.Context, obj *types.Document) (bool, error)
Access(ctx context.Context, obj *types.Document) (*types.DocumentAccess, error)
@@ -349,6 +369,7 @@ type TrustCenterResolver interface {
Vendors(ctx context.Context, obj *types.TrustCenter, first *int, after *page.CursorKey, last *int, before *page.CursorKey) (*types.VendorConnection, error)
References(ctx context.Context, obj *types.TrustCenter, first *int, after *page.CursorKey, last *int, before *page.CursorKey) (*types.TrustCenterReferenceConnection, error)
TrustCenterFiles(ctx context.Context, obj *types.TrustCenter, first *int, after *page.CursorKey, last *int, before *page.CursorKey) (*types.TrustCenterFileConnection, error)
ComplianceFrameworks(ctx context.Context, obj *types.TrustCenter, first *int, after *page.CursorKey, last *int, before *page.CursorKey) (*types.ComplianceFrameworkConnection, error)
}
type TrustCenterFileResolver interface {
IsUserAuthorized(ctx context.Context, obj *types.TrustCenterFile) (bool, error)
@@ -433,6 +454,45 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
return e.ComplexityRoot.AuditEdge.Node(childComplexity), true
case "ComplianceFramework.framework":
if e.ComplexityRoot.ComplianceFramework.Framework == nil {
break
}
return e.ComplexityRoot.ComplianceFramework.Framework(childComplexity), true
case "ComplianceFramework.id":
if e.ComplexityRoot.ComplianceFramework.ID == nil {
break
}
return e.ComplexityRoot.ComplianceFramework.ID(childComplexity), true
case "ComplianceFrameworkConnection.edges":
if e.ComplexityRoot.ComplianceFrameworkConnection.Edges == nil {
break
}
return e.ComplexityRoot.ComplianceFrameworkConnection.Edges(childComplexity), true
case "ComplianceFrameworkConnection.pageInfo":
if e.ComplexityRoot.ComplianceFrameworkConnection.PageInfo == nil {
break
}
return e.ComplexityRoot.ComplianceFrameworkConnection.PageInfo(childComplexity), true
case "ComplianceFrameworkEdge.cursor":
if e.ComplexityRoot.ComplianceFrameworkEdge.Cursor == nil {
break
}
return e.ComplexityRoot.ComplianceFrameworkEdge.Cursor(childComplexity), true
case "ComplianceFrameworkEdge.node":
if e.ComplexityRoot.ComplianceFrameworkEdge.Node == nil {
break
}
return e.ComplexityRoot.ComplianceFrameworkEdge.Node(childComplexity), true
case "Document.access":
if e.ComplexityRoot.Document.Access == nil {
break
@@ -948,6 +1008,17 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
}
return e.ComplexityRoot.TrustCenter.Audits(childComplexity, args["first"].(*int), args["after"].(*page.CursorKey), args["last"].(*int), args["before"].(*page.CursorKey)), true
case "TrustCenter.complianceFrameworks":
if e.ComplexityRoot.TrustCenter.ComplianceFrameworks == nil {
break
}
args, err := ec.field_TrustCenter_complianceFrameworks_args(ctx, rawArgs)
if err != nil {
return 0, false
}
return e.ComplexityRoot.TrustCenter.ComplianceFrameworks(childComplexity, args["first"].(*int), args["after"].(*page.CursorKey), args["last"].(*int), args["before"].(*page.CursorKey)), true
case "TrustCenter.darkLogoFileUrl":
if e.ComplexityRoot.TrustCenter.DarkLogoFileURL == nil {
break
@@ -1458,6 +1529,21 @@ type AuditEdge @nda {
node: Audit!
}
type ComplianceFramework implements Node {
id: ID!
framework: Framework! @goField(forceResolver: true)
}
type ComplianceFrameworkConnection {
edges: [ComplianceFrameworkEdge!]!
pageInfo: PageInfo!
}
type ComplianceFrameworkEdge {
cursor: CursorKey!
node: ComplianceFramework!
}
enum CountryCode
@goModel(model: "go.probo.inc/probo/pkg/coredata.CountryCode") {
AD @goEnum(value: "go.probo.inc/probo/pkg/coredata.CountryCodeAD")
@@ -1893,6 +1979,13 @@ type TrustCenter implements Node {
last: Int
before: CursorKey
): TrustCenterFileConnection! @goField(forceResolver: true)
complianceFrameworks(
first: Int
after: CursorKey
last: Int
before: CursorKey
): ComplianceFrameworkConnection! @goField(forceResolver: true)
}
type TrustCenterAccess implements Node {
@@ -2396,6 +2489,32 @@ func (ec *executionContext) field_TrustCenter_audits_args(ctx context.Context, r
return args, nil
}
func (ec *executionContext) field_TrustCenter_complianceFrameworks_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) {
var err error
args := map[string]any{}
arg0, err := graphql.ProcessArgField(ctx, rawArgs, "first", ec.unmarshalOInt2ᚖint)
if err != nil {
return nil, err
}
args["first"] = arg0
arg1, err := graphql.ProcessArgField(ctx, rawArgs, "after", ec.unmarshalOCursorKey2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋpageᚐCursorKey)
if err != nil {
return nil, err
}
args["after"] = arg1
arg2, err := graphql.ProcessArgField(ctx, rawArgs, "last", ec.unmarshalOInt2ᚖint)
if err != nil {
return nil, err
}
args["last"] = arg2
arg3, err := graphql.ProcessArgField(ctx, rawArgs, "before", ec.unmarshalOCursorKey2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋpageᚐCursorKey)
if err != nil {
return nil, err
}
args["before"] = arg3
return args, nil
}
func (ec *executionContext) field_TrustCenter_documents_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) {
var err error
args := map[string]any{}
@@ -2929,6 +3048,212 @@ func (ec *executionContext) fieldContext_AuditEdge_node(_ context.Context, field
return fc, nil
}
func (ec *executionContext) _ComplianceFramework_id(ctx context.Context, field graphql.CollectedField, obj *types.ComplianceFramework) (ret graphql.Marshaler) {
return graphql.ResolveField(
ctx,
ec.OperationContext,
field,
ec.fieldContext_ComplianceFramework_id,
func(ctx context.Context) (any, error) {
return obj.ID, nil
},
nil,
ec.marshalNID2goᚗproboᚗincᚋproboᚋpkgᚋgidᚐGID,
true,
true,
)
}
func (ec *executionContext) fieldContext_ComplianceFramework_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "ComplianceFramework",
Field: field,
IsMethod: false,
IsResolver: false,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
return nil, errors.New("field of type ID does not have child fields")
},
}
return fc, nil
}
func (ec *executionContext) _ComplianceFramework_framework(ctx context.Context, field graphql.CollectedField, obj *types.ComplianceFramework) (ret graphql.Marshaler) {
return graphql.ResolveField(
ctx,
ec.OperationContext,
field,
ec.fieldContext_ComplianceFramework_framework,
func(ctx context.Context) (any, error) {
return ec.Resolvers.ComplianceFramework().Framework(ctx, obj)
},
nil,
ec.marshalNFramework2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐFramework,
true,
true,
)
}
func (ec *executionContext) fieldContext_ComplianceFramework_framework(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "ComplianceFramework",
Field: field,
IsMethod: true,
IsResolver: true,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
switch field.Name {
case "id":
return ec.fieldContext_Framework_id(ctx, field)
case "name":
return ec.fieldContext_Framework_name(ctx, field)
case "lightLogoURL":
return ec.fieldContext_Framework_lightLogoURL(ctx, field)
case "darkLogoURL":
return ec.fieldContext_Framework_darkLogoURL(ctx, field)
}
return nil, fmt.Errorf("no field named %q was found under type Framework", field.Name)
},
}
return fc, nil
}
func (ec *executionContext) _ComplianceFrameworkConnection_edges(ctx context.Context, field graphql.CollectedField, obj *types.ComplianceFrameworkConnection) (ret graphql.Marshaler) {
return graphql.ResolveField(
ctx,
ec.OperationContext,
field,
ec.fieldContext_ComplianceFrameworkConnection_edges,
func(ctx context.Context) (any, error) {
return obj.Edges, nil
},
nil,
ec.marshalNComplianceFrameworkEdge2ᚕᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐComplianceFrameworkEdgeᚄ,
true,
true,
)
}
func (ec *executionContext) fieldContext_ComplianceFrameworkConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "ComplianceFrameworkConnection",
Field: field,
IsMethod: false,
IsResolver: false,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
switch field.Name {
case "cursor":
return ec.fieldContext_ComplianceFrameworkEdge_cursor(ctx, field)
case "node":
return ec.fieldContext_ComplianceFrameworkEdge_node(ctx, field)
}
return nil, fmt.Errorf("no field named %q was found under type ComplianceFrameworkEdge", field.Name)
},
}
return fc, nil
}
func (ec *executionContext) _ComplianceFrameworkConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *types.ComplianceFrameworkConnection) (ret graphql.Marshaler) {
return graphql.ResolveField(
ctx,
ec.OperationContext,
field,
ec.fieldContext_ComplianceFrameworkConnection_pageInfo,
func(ctx context.Context) (any, error) {
return obj.PageInfo, nil
},
nil,
ec.marshalNPageInfo2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐPageInfo,
true,
true,
)
}
func (ec *executionContext) fieldContext_ComplianceFrameworkConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "ComplianceFrameworkConnection",
Field: field,
IsMethod: false,
IsResolver: false,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
switch field.Name {
case "hasNextPage":
return ec.fieldContext_PageInfo_hasNextPage(ctx, field)
case "hasPreviousPage":
return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field)
case "startCursor":
return ec.fieldContext_PageInfo_startCursor(ctx, field)
case "endCursor":
return ec.fieldContext_PageInfo_endCursor(ctx, field)
}
return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name)
},
}
return fc, nil
}
func (ec *executionContext) _ComplianceFrameworkEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *types.ComplianceFrameworkEdge) (ret graphql.Marshaler) {
return graphql.ResolveField(
ctx,
ec.OperationContext,
field,
ec.fieldContext_ComplianceFrameworkEdge_cursor,
func(ctx context.Context) (any, error) {
return obj.Cursor, nil
},
nil,
ec.marshalNCursorKey2goᚗproboᚗincᚋproboᚋpkgᚋpageᚐCursorKey,
true,
true,
)
}
func (ec *executionContext) fieldContext_ComplianceFrameworkEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "ComplianceFrameworkEdge",
Field: field,
IsMethod: false,
IsResolver: false,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
return nil, errors.New("field of type CursorKey does not have child fields")
},
}
return fc, nil
}
func (ec *executionContext) _ComplianceFrameworkEdge_node(ctx context.Context, field graphql.CollectedField, obj *types.ComplianceFrameworkEdge) (ret graphql.Marshaler) {
return graphql.ResolveField(
ctx,
ec.OperationContext,
field,
ec.fieldContext_ComplianceFrameworkEdge_node,
func(ctx context.Context) (any, error) {
return obj.Node, nil
},
nil,
ec.marshalNComplianceFramework2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐComplianceFramework,
true,
true,
)
}
func (ec *executionContext) fieldContext_ComplianceFrameworkEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "ComplianceFrameworkEdge",
Field: field,
IsMethod: false,
IsResolver: false,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
switch field.Name {
case "id":
return ec.fieldContext_ComplianceFramework_id(ctx, field)
case "framework":
return ec.fieldContext_ComplianceFramework_framework(ctx, field)
}
return nil, fmt.Errorf("no field named %q was found under type ComplianceFramework", field.Name)
},
}
return fc, nil
}
func (ec *executionContext) _Document_id(ctx context.Context, field graphql.CollectedField, obj *types.Document) (ret graphql.Marshaler) {
return graphql.ResolveField(
ctx,
@@ -5203,6 +5528,8 @@ func (ec *executionContext) fieldContext_Query_currentTrustCenter(_ context.Cont
return ec.fieldContext_TrustCenter_references(ctx, field)
case "trustCenterFiles":
return ec.fieldContext_TrustCenter_trustCenterFiles(ctx, field)
case "complianceFrameworks":
return ec.fieldContext_TrustCenter_complianceFrameworks(ctx, field)
}
return nil, fmt.Errorf("no field named %q was found under type TrustCenter", field.Name)
},
@@ -6228,6 +6555,53 @@ func (ec *executionContext) fieldContext_TrustCenter_trustCenterFiles(ctx contex
return fc, nil
}
func (ec *executionContext) _TrustCenter_complianceFrameworks(ctx context.Context, field graphql.CollectedField, obj *types.TrustCenter) (ret graphql.Marshaler) {
return graphql.ResolveField(
ctx,
ec.OperationContext,
field,
ec.fieldContext_TrustCenter_complianceFrameworks,
func(ctx context.Context) (any, error) {
fc := graphql.GetFieldContext(ctx)
return ec.Resolvers.TrustCenter().ComplianceFrameworks(ctx, obj, fc.Args["first"].(*int), fc.Args["after"].(*page.CursorKey), fc.Args["last"].(*int), fc.Args["before"].(*page.CursorKey))
},
nil,
ec.marshalNComplianceFrameworkConnection2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐComplianceFrameworkConnection,
true,
true,
)
}
func (ec *executionContext) fieldContext_TrustCenter_complianceFrameworks(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "TrustCenter",
Field: field,
IsMethod: true,
IsResolver: true,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
switch field.Name {
case "edges":
return ec.fieldContext_ComplianceFrameworkConnection_edges(ctx, field)
case "pageInfo":
return ec.fieldContext_ComplianceFrameworkConnection_pageInfo(ctx, field)
}
return nil, fmt.Errorf("no field named %q was found under type ComplianceFrameworkConnection", field.Name)
},
}
defer func() {
if r := recover(); r != nil {
err = ec.Recover(ctx, r)
ec.Error(ctx, err)
}
}()
ctx = graphql.WithFieldContext(ctx, fc)
if fc.Args, err = ec.field_TrustCenter_complianceFrameworks_args(ctx, field.ArgumentMap(ec.Variables)); err != nil {
ec.Error(ctx, err)
return fc, err
}
return fc, nil
}
func (ec *executionContext) _TrustCenterAccess_id(ctx context.Context, field graphql.CollectedField, obj *types.TrustCenterAccess) (ret graphql.Marshaler) {
return graphql.ResolveField(
ctx,
@@ -9263,6 +9637,13 @@ func (ec *executionContext) _Node(ctx context.Context, sel ast.SelectionSet, obj
return graphql.Null
}
return ec._Document(ctx, sel, obj)
case types.ComplianceFramework:
return ec._ComplianceFramework(ctx, sel, &obj)
case *types.ComplianceFramework:
if obj == nil {
return graphql.Null
}
return ec._ComplianceFramework(ctx, sel, obj)
case types.Audit:
return ec._Audit(ctx, sel, &obj)
case *types.Audit:
@@ -9520,6 +9901,169 @@ func (ec *executionContext) _AuditEdge(ctx context.Context, sel ast.SelectionSet
return out
}
var complianceFrameworkImplementors = []string{"ComplianceFramework", "Node"}
func (ec *executionContext) _ComplianceFramework(ctx context.Context, sel ast.SelectionSet, obj *types.ComplianceFramework) graphql.Marshaler {
fields := graphql.CollectFields(ec.OperationContext, sel, complianceFrameworkImplementors)
out := graphql.NewFieldSet(fields)
deferred := make(map[string]*graphql.FieldSet)
for i, field := range fields {
switch field.Name {
case "__typename":
out.Values[i] = graphql.MarshalString("ComplianceFramework")
case "id":
out.Values[i] = ec._ComplianceFramework_id(ctx, field, obj)
if out.Values[i] == graphql.Null {
atomic.AddUint32(&out.Invalids, 1)
}
case "framework":
field := field
innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) {
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
}
}()
res = ec._ComplianceFramework_framework(ctx, field, obj)
if res == graphql.Null {
atomic.AddUint32(&fs.Invalids, 1)
}
return res
}
if field.Deferrable != nil {
dfs, ok := deferred[field.Deferrable.Label]
di := 0
if ok {
dfs.AddField(field)
di = len(dfs.Values) - 1
} else {
dfs = graphql.NewFieldSet([]graphql.CollectedField{field})
deferred[field.Deferrable.Label] = dfs
}
dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler {
return innerFunc(ctx, dfs)
})
// don't run the out.Concurrently() call below
out.Values[i] = graphql.Null
continue
}
out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) })
default:
panic("unknown field " + strconv.Quote(field.Name))
}
}
out.Dispatch(ctx)
if out.Invalids > 0 {
return graphql.Null
}
atomic.AddInt32(&ec.Deferred, int32(len(deferred)))
for label, dfs := range deferred {
ec.ProcessDeferredGroup(graphql.DeferredGroup{
Label: label,
Path: graphql.GetPath(ctx),
FieldSet: dfs,
Context: ctx,
})
}
return out
}
var complianceFrameworkConnectionImplementors = []string{"ComplianceFrameworkConnection"}
func (ec *executionContext) _ComplianceFrameworkConnection(ctx context.Context, sel ast.SelectionSet, obj *types.ComplianceFrameworkConnection) graphql.Marshaler {
fields := graphql.CollectFields(ec.OperationContext, sel, complianceFrameworkConnectionImplementors)
out := graphql.NewFieldSet(fields)
deferred := make(map[string]*graphql.FieldSet)
for i, field := range fields {
switch field.Name {
case "__typename":
out.Values[i] = graphql.MarshalString("ComplianceFrameworkConnection")
case "edges":
out.Values[i] = ec._ComplianceFrameworkConnection_edges(ctx, field, obj)
if out.Values[i] == graphql.Null {
out.Invalids++
}
case "pageInfo":
out.Values[i] = ec._ComplianceFrameworkConnection_pageInfo(ctx, field, obj)
if out.Values[i] == graphql.Null {
out.Invalids++
}
default:
panic("unknown field " + strconv.Quote(field.Name))
}
}
out.Dispatch(ctx)
if out.Invalids > 0 {
return graphql.Null
}
atomic.AddInt32(&ec.Deferred, int32(len(deferred)))
for label, dfs := range deferred {
ec.ProcessDeferredGroup(graphql.DeferredGroup{
Label: label,
Path: graphql.GetPath(ctx),
FieldSet: dfs,
Context: ctx,
})
}
return out
}
var complianceFrameworkEdgeImplementors = []string{"ComplianceFrameworkEdge"}
func (ec *executionContext) _ComplianceFrameworkEdge(ctx context.Context, sel ast.SelectionSet, obj *types.ComplianceFrameworkEdge) graphql.Marshaler {
fields := graphql.CollectFields(ec.OperationContext, sel, complianceFrameworkEdgeImplementors)
out := graphql.NewFieldSet(fields)
deferred := make(map[string]*graphql.FieldSet)
for i, field := range fields {
switch field.Name {
case "__typename":
out.Values[i] = graphql.MarshalString("ComplianceFrameworkEdge")
case "cursor":
out.Values[i] = ec._ComplianceFrameworkEdge_cursor(ctx, field, obj)
if out.Values[i] == graphql.Null {
out.Invalids++
}
case "node":
out.Values[i] = ec._ComplianceFrameworkEdge_node(ctx, field, obj)
if out.Values[i] == graphql.Null {
out.Invalids++
}
default:
panic("unknown field " + strconv.Quote(field.Name))
}
}
out.Dispatch(ctx)
if out.Invalids > 0 {
return graphql.Null
}
atomic.AddInt32(&ec.Deferred, int32(len(deferred)))
for label, dfs := range deferred {
ec.ProcessDeferredGroup(graphql.DeferredGroup{
Label: label,
Path: graphql.GetPath(ctx),
FieldSet: dfs,
Context: ctx,
})
}
return out
}
var documentImplementors = []string{"Document", "Node"}
func (ec *executionContext) _Document(ctx context.Context, sel ast.SelectionSet, obj *types.Document) graphql.Marshaler {
@@ -11265,6 +11809,42 @@ func (ec *executionContext) _TrustCenter(ctx context.Context, sel ast.SelectionS
continue
}
out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) })
case "complianceFrameworks":
field := field
innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) {
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
}
}()
res = ec._TrustCenter_complianceFrameworks(ctx, field, obj)
if res == graphql.Null {
atomic.AddUint32(&fs.Invalids, 1)
}
return res
}
if field.Deferrable != nil {
dfs, ok := deferred[field.Deferrable.Label]
di := 0
if ok {
dfs.AddField(field)
di = len(dfs.Values) - 1
} else {
dfs = graphql.NewFieldSet([]graphql.CollectedField{field})
deferred[field.Deferrable.Label] = dfs
}
dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler {
return innerFunc(ctx, dfs)
})
// don't run the out.Concurrently() call below
out.Values[i] = graphql.Null
continue
}
out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) })
default:
panic("unknown field " + strconv.Quote(field.Name))
@@ -12355,6 +12935,56 @@ func (ec *executionContext) marshalNBoolean2bool(ctx context.Context, sel ast.Se
return res
}
func (ec *executionContext) marshalNComplianceFramework2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐComplianceFramework(ctx context.Context, sel ast.SelectionSet, v *types.ComplianceFramework) graphql.Marshaler {
if v == nil {
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow")
}
return graphql.Null
}
return ec._ComplianceFramework(ctx, sel, v)
}
func (ec *executionContext) marshalNComplianceFrameworkConnection2goᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐComplianceFrameworkConnection(ctx context.Context, sel ast.SelectionSet, v types.ComplianceFrameworkConnection) graphql.Marshaler {
return ec._ComplianceFrameworkConnection(ctx, sel, &v)
}
func (ec *executionContext) marshalNComplianceFrameworkConnection2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐComplianceFrameworkConnection(ctx context.Context, sel ast.SelectionSet, v *types.ComplianceFrameworkConnection) graphql.Marshaler {
if v == nil {
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow")
}
return graphql.Null
}
return ec._ComplianceFrameworkConnection(ctx, sel, v)
}
func (ec *executionContext) marshalNComplianceFrameworkEdge2ᚕᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐComplianceFrameworkEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*types.ComplianceFrameworkEdge) graphql.Marshaler {
ret := graphql.MarshalSliceConcurrently(ctx, len(v), 0, false, func(ctx context.Context, i int) graphql.Marshaler {
fc := graphql.GetFieldContext(ctx)
fc.Result = &v[i]
return ec.marshalNComplianceFrameworkEdge2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐComplianceFrameworkEdge(ctx, sel, v[i])
})
for _, e := range ret {
if e == graphql.Null {
return graphql.Null
}
}
return ret
}
func (ec *executionContext) marshalNComplianceFrameworkEdge2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋtrustᚋv1ᚋtypesᚐComplianceFrameworkEdge(ctx context.Context, sel ast.SelectionSet, v *types.ComplianceFrameworkEdge) graphql.Marshaler {
if v == nil {
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
graphql.AddErrorf(ctx, "the requested element is null which the schema does not allow")
}
return graphql.Null
}
return ec._ComplianceFrameworkEdge(ctx, sel, v)
}
func (ec *executionContext) unmarshalNCountryCode2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐCountryCode(ctx context.Context, v any) (coredata.CountryCode, error) {
tmp, err := graphql.UnmarshalString(v)
res := unmarshalNCountryCode2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐCountryCode[tmp]

View File

@@ -16,6 +16,7 @@ package types
import (
"go.probo.inc/probo/pkg/coredata"
"go.probo.inc/probo/pkg/page"
)
func NewFramework(f *coredata.Framework) *Framework {
@@ -24,3 +25,31 @@ func NewFramework(f *coredata.Framework) *Framework {
Name: f.Name,
}
}
func NewComplianceFramework(cf *coredata.ComplianceFramework) *ComplianceFramework {
return &ComplianceFramework{
ID: cf.ID,
FrameworkID: cf.FrameworkID,
}
}
func NewComplianceFrameworkEdge(cf *coredata.ComplianceFramework) *ComplianceFrameworkEdge {
return &ComplianceFrameworkEdge{
Cursor: cf.CursorKey(coredata.ComplianceFrameworkOrderFieldRank),
Node: NewComplianceFramework(cf),
}
}
func NewComplianceFrameworkConnection(
p *page.Page[*coredata.ComplianceFramework, coredata.ComplianceFrameworkOrderField],
) *ComplianceFrameworkConnection {
edges := make([]*ComplianceFrameworkEdge, len(p.Data))
for i, cf := range p.Data {
edges[i] = NewComplianceFrameworkEdge(cf)
}
return &ComplianceFrameworkConnection{
Edges: edges,
PageInfo: NewPageInfo(p),
}
}

View File

@@ -45,6 +45,26 @@ type AuditEdge struct {
Node *Audit `json:"node"`
}
type ComplianceFramework struct {
ID gid.GID `json:"id"`
// FrameworkID is a non-schema field used by the Framework resolver to avoid an extra DB lookup.
FrameworkID gid.GID `json:"-"`
Framework *Framework `json:"framework"`
}
func (ComplianceFramework) IsNode() {}
func (this ComplianceFramework) GetID() gid.GID { return this.ID }
type ComplianceFrameworkConnection struct {
Edges []*ComplianceFrameworkEdge `json:"edges"`
PageInfo *PageInfo `json:"pageInfo"`
}
type ComplianceFrameworkEdge struct {
Cursor page.CursorKey `json:"cursor"`
Node *ComplianceFramework `json:"node"`
}
type Document struct {
ID gid.GID `json:"id"`
Title string `json:"title"`
@@ -235,6 +255,7 @@ type TrustCenter struct {
Vendors *VendorConnection `json:"vendors"`
References *TrustCenterReferenceConnection `json:"references"`
TrustCenterFiles *TrustCenterFileConnection `json:"trustCenterFiles"`
ComplianceFrameworks *ComplianceFrameworkConnection `json:"complianceFrameworks"`
}
func (TrustCenter) IsNode() {}

View File

@@ -71,6 +71,19 @@ func (r *auditResolver) Report(ctx context.Context, obj *types.Audit) (*types.Re
return types.NewReport(report), nil
}
// Framework is the resolver for the framework field on ComplianceFramework.
func (r *complianceFrameworkResolver) Framework(ctx context.Context, obj *types.ComplianceFramework) (*types.Framework, error) {
trustService := r.TrustService(ctx, obj.ID.TenantID())
framework, err := trustService.Frameworks.Get(ctx, obj.FrameworkID)
if err != nil {
r.logger.ErrorCtx(ctx, "cannot load framework", log.Error(err))
return nil, gqlutils.Internal(ctx)
}
return types.NewFramework(framework), nil
}
// IsUserAuthorized is the resolver for the isUserAuthorized field.
func (r *documentResolver) IsUserAuthorized(ctx context.Context, obj *types.Document) (bool, error) {
trustService := r.TrustService(ctx, obj.ID.TenantID())
@@ -1014,6 +1027,25 @@ func (r *trustCenterResolver) TrustCenterFiles(ctx context.Context, obj *types.T
return types.NewTrustCenterFileConnection(trustCenterFilePage), nil
}
// ComplianceFrameworks is the resolver for the complianceFrameworks field.
func (r *trustCenterResolver) ComplianceFrameworks(ctx context.Context, obj *types.TrustCenter, first *int, after *page.CursorKey, last *int, before *page.CursorKey) (*types.ComplianceFrameworkConnection, error) {
trustService := r.TrustService(ctx, obj.ID.TenantID())
pageOrderBy := page.OrderBy[coredata.ComplianceFrameworkOrderField]{
Field: coredata.ComplianceFrameworkOrderFieldRank,
Direction: page.OrderDirectionAsc,
}
cursor := types.NewCursor(first, after, last, before, pageOrderBy)
cfPage, err := trustService.ComplianceFrameworks.ListByTrustCenterID(ctx, obj.ID, cursor)
if err != nil {
r.logger.ErrorCtx(ctx, "cannot list compliance frameworks", log.Error(err))
return nil, gqlutils.Internal(ctx)
}
return types.NewComplianceFrameworkConnection(cfPage), nil
}
// IsUserAuthorized is the resolver for the isUserAuthorized field.
func (r *trustCenterFileResolver) IsUserAuthorized(ctx context.Context, obj *types.TrustCenterFile) (bool, error) {
trustService := r.TrustService(ctx, obj.ID.TenantID())
@@ -1124,6 +1156,11 @@ func (r *vendorConnectionResolver) TotalCount(ctx context.Context, obj *types.Ve
// Audit returns schema.AuditResolver implementation.
func (r *Resolver) Audit() schema.AuditResolver { return &auditResolver{r} }
// ComplianceFramework returns schema.ComplianceFrameworkResolver implementation.
func (r *Resolver) ComplianceFramework() schema.ComplianceFrameworkResolver {
return &complianceFrameworkResolver{r}
}
// Document returns schema.DocumentResolver implementation.
func (r *Resolver) Document() schema.DocumentResolver { return &documentResolver{r} }
@@ -1166,6 +1203,7 @@ func (r *Resolver) VendorConnection() schema.VendorConnectionResolver {
}
type auditResolver struct{ *Resolver }
type complianceFrameworkResolver struct{ *Resolver }
type documentResolver struct{ *Resolver }
type frameworkResolver struct{ *Resolver }
type mutationResolver struct{ *Resolver }