Skip to content

Instantly share code, notes, and snippets.

@akkonrad
Last active October 24, 2022 12:30
Show Gist options
  • Save akkonrad/2c8d84d568c5dcb1455e6656c54fa964 to your computer and use it in GitHub Desktop.
Save akkonrad/2c8d84d568c5dcb1455e6656c54fa964 to your computer and use it in GitHub Desktop.
gql/type-defs.ts
// type-defs.ts
import { gql } from 'apollo-server-express';
export const typeDefs = gql`
type Person {
name: String!
born: Int!
actedInMovies: [Movie!]! @relationship(type: "ACTED_IN", properties: "ActedIn", direction: OUT)
directedMovies: [Movie!]! @relationship(type: "DIRECTED", direction: OUT)
}
type Movie {
title: String!
released: Int!
actors: [Person!]! @relationship(type: "ACTED_IN", properties: "ActedIn", direction: IN)
director: Person! @relationship(type: "DIRECTED", direction: IN)
}
interface ActedIn @relationshipProperties {
roles: [String!]
}
extend type Person
@auth(
rules: [
{ operations: [READ], allowUnauthenticated: true }
{ operations: [CREATE, DELETE, UPDATE], isAuthenticated: true }
]
)
`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment