Skip to content

Instantly share code, notes, and snippets.

@lightsofapollo
Last active April 18, 2018 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lightsofapollo/1aaab491b961c28cc7a0f6ef1b74dea8 to your computer and use it in GitHub Desktop.
Save lightsofapollo/1aaab491b961c28cc7a0f6ef1b74dea8 to your computer and use it in GitHub Desktop.
[@gql.name "AuthRoles"]
[@gql.comment "Authentication roles for all users"]
[@gql.type]
type authRoles = [ | `SuperUser | `Administrator | `User];
[@gql.type]
module User = {
type t = {
id: string,
email: string,
name: string,
role: option(authRoles),
};
let id = (root: t) => root.id;
let email = (root: t) => root.email;
let name = (root: t) => root.email;
let role = (root: t) => root.role;
};
[@gql.type]
[@gql.comment "All queries for graphql"]
module Query = {
let users = () => {/* return list of user types */};
let userById: string => User.t =
id => {id, email: "example@gmail.com", name: "james", role: None};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment