ffcf41b85a
Introduce `AddUserToOrganization`, `RemoveAPIKey`, and `RemoveOrganization` commands to enhance organization management. Implement validation for user addition and API key removal. Update GraphQL schema to support new mutations and add caching for the new events, ensuring that organizations and their relationships are accurately represented in the cache.
92 lines
1.8 KiB
GraphQL
92 lines
1.8 KiB
GraphQL
type Query {
|
|
organizations: [Organization!]! @auth(user: true)
|
|
allOrganizations: [Organization!]! @auth(user: true)
|
|
supergraph(ref: String!, isAfter: String): Supergraph! @auth(user: true, organization: true)
|
|
latestSchema(ref: String!): SchemaUpdate! @auth(user: true, organization: true)
|
|
}
|
|
|
|
type Mutation {
|
|
addOrganization(name: String!): Organization! @auth(user: true)
|
|
addUserToOrganization(organizationId: ID!, userId: String!): Organization! @auth(user: true)
|
|
addAPIKey(input: InputAPIKey): APIKey! @auth(user: true)
|
|
removeAPIKey(organizationId: ID!, keyName: String!): Organization! @auth(user: true)
|
|
removeOrganization(organizationId: ID!): Boolean! @auth(user: true)
|
|
updateSubGraph(input: InputSubGraph!): SubGraph! @auth(organization: true)
|
|
}
|
|
|
|
type Subscription {
|
|
schemaUpdates(ref: String!): SchemaUpdate! @auth(organization: true)
|
|
}
|
|
|
|
type Organization {
|
|
id: ID!
|
|
name: String!
|
|
users: [User!]!
|
|
apiKeys: [APIKey!]!
|
|
}
|
|
|
|
type User {
|
|
id: String!
|
|
}
|
|
|
|
type APIKey {
|
|
id: ID!
|
|
name: String!
|
|
key: String
|
|
organization: Organization!
|
|
refs: [String!]!
|
|
read: Boolean!
|
|
publish: Boolean!
|
|
}
|
|
|
|
union Supergraph = Unchanged | SubGraphs
|
|
|
|
type Unchanged {
|
|
id: ID!
|
|
minDelaySeconds: Int!
|
|
}
|
|
|
|
type SubGraphs {
|
|
id: ID!
|
|
minDelaySeconds: Int!
|
|
sdl: String!
|
|
subGraphs: [SubGraph!]!
|
|
}
|
|
|
|
type SubGraph {
|
|
id: ID!
|
|
service: String!
|
|
url: String
|
|
wsUrl: String
|
|
sdl: String!
|
|
changedBy: String!
|
|
changedAt: Time!
|
|
}
|
|
|
|
type SchemaUpdate {
|
|
ref: String!
|
|
id: ID!
|
|
subGraphs: [SubGraph!]!
|
|
cosmoRouterConfig: String
|
|
}
|
|
|
|
input InputAPIKey {
|
|
name: String!
|
|
organizationId: ID!
|
|
refs: [String!]!
|
|
read: Boolean!
|
|
publish: Boolean!
|
|
}
|
|
|
|
input InputSubGraph {
|
|
ref: String!
|
|
service: String!
|
|
url: String
|
|
wsUrl: String
|
|
sdl: String!
|
|
}
|
|
|
|
scalar Time
|
|
|
|
directive @auth(user: Boolean, organization: Boolean) on FIELD_DEFINITION
|