feat: organizations and API keys

This commit is contained in:
2023-04-27 07:09:10 +02:00
parent 504f40902e
commit 554a6c252f
22 changed files with 2469 additions and 199 deletions
+35 -4
View File
@@ -1,10 +1,33 @@
type Query {
subGraphs(ref: String!): [SubGraph!]! @hasApiKey @deprecated(reason: "Use supergraph instead")
supergraph(ref: String!, isAfter: String): Supergraph! @hasApiKey
organizations: [Organization!]! @auth(user: true)
supergraph(ref: String!, isAfter: String): Supergraph! @auth(organization: true)
}
type Mutation {
updateSubGraph(input: InputSubGraph!): SubGraph! @hasApiKey
addOrganization(name: String!): Organization! @auth(user: true)
addAPIKey(input: InputAPIKey): APIKey! @auth(user: true)
updateSubGraph(input: InputSubGraph!): SubGraph! @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
@@ -30,6 +53,14 @@ type SubGraph {
changedAt: Time!
}
input InputAPIKey {
name: String!
organizationId: ID!
refs: [String!]!
read: Boolean!
publish: Boolean!
}
input InputSubGraph {
ref: String!
service: String!
@@ -40,4 +71,4 @@ input InputSubGraph {
scalar Time
directive @hasApiKey on FIELD_DEFINITION
directive @auth(user: Boolean, organization: Boolean) on FIELD_DEFINITION