Skip to content

Instantly share code, notes, and snippets.

@LuigiClaudio
Created October 6, 2021 23:55
Show Gist options
  • Save LuigiClaudio/ae7bca8043cb397eb92ba1206b655123 to your computer and use it in GitHub Desktop.
Save LuigiClaudio/ae7bca8043cb397eb92ba1206b655123 to your computer and use it in GitHub Desktop.
schema
# imported schema to faunadb
type User {
netlifyId: ID!
stripeId: ID!
subscription: String!
subscriptionPlanId: String!
activeSubscription: Boolean!
emailAddress: String! @unique
groups: [String]!
countries: [String]!
}
type Brand {
name: String!
brandWatchList: BrandWatchList
}
type BrandWatchList {
title: String!
list: [Brand] @relation
}
type Query {
allBrands: [Brand!]
allBrandWatchList: [BrandWatchList!]
findUserByNetlifyID(netlifyId: ID!): User
findUserByStripeID(stripeId: ID!): User
}
## faunadb generated schema
directive @embedded on OBJECT
directive @collection(name: String!) on OBJECT
directive @index(name: String!) on FIELD_DEFINITION
directive @resolver(name: String, paginated: Boolean! = false) on FIELD_DEFINITION
directive @relation(name: String) on FIELD_DEFINITION
directive @unique(index: String) on FIELD_DEFINITION
type Brand {
# The document's ID.
_id: ID!
# The document's timestamp.
_ts: Long!
name: String!
brandWatchList: BrandWatchList
}
# Allow manipulating the relationship between the types 'Brand' and 'BrandWatchList' using the field 'Brand.brandWatchList'.
input BrandBrandWatchListRelation {
# Create a document of type 'BrandWatchList' and associate it with the current document.
create: BrandWatchListInput
# Connect a document of type 'BrandWatchList' with the current document using its ID.
connect: ID
# If true, disconnects this document from 'BrandWatchList'
disconnect: Boolean
}
# 'Brand' input values
input BrandInput {
name: String!
brandWatchList: BrandBrandWatchListRelation
}
# The pagination object for elements of type 'Brand'.
type BrandPage {
# The elements of type 'Brand' in this page.
data: [Brand]!
# A cursor for elements coming after the current page.
after: String
# A cursor for elements coming before the current page.
before: String
}
type BrandWatchList {
# The document's ID.
_id: ID!
# The document's timestamp.
_ts: Long!
title: String!
list(
# The number of items to return per page.
_size: Int
# The pagination cursor.
_cursor: String
): BrandPage!
}
# 'BrandWatchList' input values
input BrandWatchListInput {
title: String!
list: BrandWatchListListRelation
}
# Allow manipulating the relationship between the types 'BrandWatchList' and 'Brand'.
input BrandWatchListListRelation {
# Create one or more documents of type 'Brand' and associate them with the current document.
create: [BrandInput]
# Connect one or more documents of type 'Brand' with the current document using their IDs.
connect: [ID]
# Disconnect the given documents of type 'Brand' from the current document using their IDs.
disconnect: [ID]
}
# The pagination object for elements of type 'BrandWatchList'.
type BrandWatchListPage {
# The elements of type 'BrandWatchList' in this page.
data: [BrandWatchList]!
# A cursor for elements coming after the current page.
after: String
# A cursor for elements coming before the current page.
before: String
}
scalar Date
# The `Long` scalar type represents non-fractional signed whole numeric values.
# Long can represent values between -(2^63) and 2^63 - 1.
scalar Long
type Mutation {
# Update an existing document in the collection of 'User'
updateUser(
# The 'User' document's ID
id: ID!
# 'User' input values
data: UserInput!
): User
# Update an existing document in the collection of 'BrandWatchList'
updateBrandWatchList(
# The 'BrandWatchList' document's ID
id: ID!
# 'BrandWatchList' input values
data: BrandWatchListInput!
): BrandWatchList
# Create a new document in the collection of 'User'
createUser(
# 'User' input values
data: UserInput!
): User!
# Update an existing document in the collection of 'Brand'
updateBrand(
# The 'Brand' document's ID
id: ID!
# 'Brand' input values
data: BrandInput!
): Brand
# Delete an existing document in the collection of 'BrandWatchList'
deleteBrandWatchList(
# The 'BrandWatchList' document's ID
id: ID!
): BrandWatchList
# Delete an existing document in the collection of 'Brand'
deleteBrand(
# The 'Brand' document's ID
id: ID!
): Brand
# Delete an existing document in the collection of 'User'
deleteUser(
# The 'User' document's ID
id: ID!
): User
# Create a new document in the collection of 'BrandWatchList'
createBrandWatchList(
# 'BrandWatchList' input values
data: BrandWatchListInput!
): BrandWatchList!
# Create a new document in the collection of 'Brand'
createBrand(
# 'Brand' input values
data: BrandInput!
): Brand!
}
type Query {
findUserByNetlifyID(netlifyId: ID!): User
# Find a document from the collection of 'User' by its id.
findUserByID(
# The 'User' document's ID
id: ID!
): User
findUserByStripeID(stripeId: ID!): User
allBrands(
# The number of items to return per page.
_size: Int
# The pagination cursor.
_cursor: String
): BrandPage!
# Find a document from the collection of 'BrandWatchList' by its id.
findBrandWatchListByID(
# The 'BrandWatchList' document's ID
id: ID!
): BrandWatchList
allBrandWatchList(
# The number of items to return per page.
_size: Int
# The pagination cursor.
_cursor: String
): BrandWatchListPage!
# Find a document from the collection of 'Brand' by its id.
findBrandByID(
# The 'Brand' document's ID
id: ID!
): Brand
}
scalar Time
type User {
# The document's ID.
_id: ID!
emailAddress: String!
stripeId: ID!
subscription: String!
groups: [String]!
countries: [String]!
netlifyId: ID!
activeSubscription: Boolean!
subscriptionPlanId: String!
# The document's timestamp.
_ts: Long!
}
# 'User' input values
input UserInput {
netlifyId: ID!
stripeId: ID!
subscription: String!
subscriptionPlanId: String!
activeSubscription: Boolean!
emailAddress: String!
groups: [String]!
countries: [String]!
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment