Split GraphQL schemas into per-entity files
Split each API's monolithic schema.graphql into per-coredata-model
files under graphql/ subdirectories. gqlgen's follow-schema layout
with {name}.resolvers.go template generates one resolver file per
schema file. Relay uses schema + schemaExtensions to load the split
files.
Connect API: 8 files (base, session, organization, profile,
personal_api_key, saml, scim, audit_log)
Trust API: 5 files (base, trust_center, auth, nda, mailing_list)
Console API: 25 files covering all domain entities
Types extended across files (Organization, Mutation, Viewer,
TrustCenter, Identity) are defined in base.graphql as required by
Relay's schemaExtensions.
Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
113
pkg/server/api/console/v1/graphql/snapshot.graphql
Normal file
113
pkg/server/api/console/v1/graphql/snapshot.graphql
Normal file
@@ -0,0 +1,113 @@
|
||||
extend type Organization {
|
||||
snapshots(
|
||||
first: Int
|
||||
after: CursorKey
|
||||
last: Int
|
||||
before: CursorKey
|
||||
orderBy: SnapshotOrder
|
||||
): SnapshotConnection! @goField(forceResolver: true)
|
||||
}
|
||||
|
||||
enum SnapshotsType
|
||||
@goModel(model: "go.probo.inc/probo/pkg/coredata.SnapshotsType") {
|
||||
RISKS @goEnum(value: "go.probo.inc/probo/pkg/coredata.SnapshotsTypeRisks")
|
||||
VENDORS
|
||||
@goEnum(value: "go.probo.inc/probo/pkg/coredata.SnapshotsTypeVendors")
|
||||
ASSETS @goEnum(value: "go.probo.inc/probo/pkg/coredata.SnapshotsTypeAssets")
|
||||
DATA @goEnum(value: "go.probo.inc/probo/pkg/coredata.SnapshotsTypeData")
|
||||
FINDINGS
|
||||
@goEnum(
|
||||
value: "go.probo.inc/probo/pkg/coredata.SnapshotsTypeFindings"
|
||||
)
|
||||
OBLIGATIONS
|
||||
@goEnum(
|
||||
value: "go.probo.inc/probo/pkg/coredata.SnapshotsTypeObligations"
|
||||
)
|
||||
PROCESSING_ACTIVITIES
|
||||
@goEnum(
|
||||
value: "go.probo.inc/probo/pkg/coredata.SnapshotsTypeProcessingActivities"
|
||||
)
|
||||
STATEMENTS_OF_APPLICABILITY
|
||||
@goEnum(
|
||||
value: "go.probo.inc/probo/pkg/coredata.SnapshotsTypeStatementsOfApplicability"
|
||||
)
|
||||
}
|
||||
|
||||
enum SnapshotOrderField
|
||||
@goModel(model: "go.probo.inc/probo/pkg/coredata.SnapshotOrderField") {
|
||||
CREATED_AT
|
||||
@goEnum(
|
||||
value: "go.probo.inc/probo/pkg/coredata.SnapshotOrderFieldCreatedAt"
|
||||
)
|
||||
NAME
|
||||
@goEnum(value: "go.probo.inc/probo/pkg/coredata.SnapshotOrderFieldName")
|
||||
TYPE
|
||||
@goEnum(value: "go.probo.inc/probo/pkg/coredata.SnapshotOrderFieldType")
|
||||
}
|
||||
|
||||
input SnapshotOrder
|
||||
@goModel(
|
||||
model: "go.probo.inc/probo/pkg/server/api/console/v1/types.SnapshotOrderBy"
|
||||
) {
|
||||
direction: OrderDirection!
|
||||
field: SnapshotOrderField!
|
||||
}
|
||||
|
||||
type Snapshot implements Node {
|
||||
id: ID!
|
||||
organization: Organization! @goField(forceResolver: true)
|
||||
name: String!
|
||||
description: String
|
||||
type: SnapshotsType!
|
||||
|
||||
controls(
|
||||
first: Int
|
||||
after: CursorKey
|
||||
last: Int
|
||||
before: CursorKey
|
||||
orderBy: ControlOrder
|
||||
filter: ControlFilter
|
||||
): ControlConnection! @goField(forceResolver: true)
|
||||
|
||||
createdAt: Datetime!
|
||||
|
||||
permission(action: String!): Boolean! @goField(forceResolver: true)
|
||||
}
|
||||
|
||||
type SnapshotConnection
|
||||
@goModel(
|
||||
model: "go.probo.inc/probo/pkg/server/api/console/v1/types.SnapshotConnection"
|
||||
) {
|
||||
totalCount: Int! @goField(forceResolver: true)
|
||||
edges: [SnapshotEdge!]!
|
||||
pageInfo: PageInfo!
|
||||
}
|
||||
|
||||
type SnapshotEdge {
|
||||
cursor: CursorKey!
|
||||
node: Snapshot!
|
||||
}
|
||||
|
||||
extend type Mutation {
|
||||
createSnapshot(input: CreateSnapshotInput!): CreateSnapshotPayload!
|
||||
deleteSnapshot(input: DeleteSnapshotInput!): DeleteSnapshotPayload!
|
||||
}
|
||||
|
||||
input CreateSnapshotInput {
|
||||
organizationId: ID!
|
||||
name: String!
|
||||
description: String
|
||||
type: SnapshotsType!
|
||||
}
|
||||
|
||||
input DeleteSnapshotInput {
|
||||
snapshotId: ID!
|
||||
}
|
||||
|
||||
type CreateSnapshotPayload {
|
||||
snapshotEdge: SnapshotEdge!
|
||||
}
|
||||
|
||||
type DeleteSnapshotPayload {
|
||||
deletedSnapshotId: ID!
|
||||
}
|
||||
Reference in New Issue
Block a user