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>
64 lines
1.3 KiB
GraphQL
64 lines
1.3 KiB
GraphQL
extend type Identity {
|
|
personalAPIKeys(
|
|
first: Int
|
|
after: CursorKey
|
|
last: Int
|
|
before: CursorKey
|
|
): PersonalAPIKeyConnection @goField(forceResolver: true)
|
|
}
|
|
|
|
type PersonalAPIKey implements Node {
|
|
id: ID!
|
|
name: String!
|
|
expiresAt: Datetime!
|
|
lastUsedAt: Datetime
|
|
createdAt: Datetime!
|
|
|
|
token: String @goField(forceResolver: true)
|
|
|
|
permission(action: String!): Boolean!
|
|
@goField(forceResolver: true)
|
|
@session(required: PRESENT)
|
|
}
|
|
|
|
type PersonalAPIKeyConnection
|
|
@goModel(
|
|
model: "go.probo.inc/probo/pkg/server/api/connect/v1/types.PersonalAPIKeyConnection"
|
|
) {
|
|
edges: [PersonalAPIKeyEdge!]!
|
|
pageInfo: PageInfo!
|
|
totalCount: Int @goField(forceResolver: true)
|
|
}
|
|
|
|
type PersonalAPIKeyEdge {
|
|
node: PersonalAPIKey!
|
|
cursor: CursorKey!
|
|
}
|
|
|
|
extend type Mutation {
|
|
createPersonalAPIKey(
|
|
input: CreatePersonalAPIKeyInput!
|
|
): CreatePersonalAPIKeyPayload @session(required: PRESENT)
|
|
revokePersonalAPIKey(
|
|
input: RevokePersonalAPIKeyInput!
|
|
): RevokePersonalAPIKeyPayload @session(required: PRESENT)
|
|
}
|
|
|
|
input CreatePersonalAPIKeyInput {
|
|
name: String!
|
|
expiresAt: Datetime!
|
|
}
|
|
|
|
input RevokePersonalAPIKeyInput {
|
|
personalAPIKeyId: ID!
|
|
}
|
|
|
|
type CreatePersonalAPIKeyPayload {
|
|
personalAPIKeyEdge: PersonalAPIKeyEdge!
|
|
token: String!
|
|
}
|
|
|
|
type RevokePersonalAPIKeyPayload {
|
|
personalAPIKeyId: ID!
|
|
}
|