Skip to content

Development :: Local

Matthew Sullivan edited this page Dec 24, 2020 · 4 revisions

Database

Install Postgres

https://postgresapp.com/

Create database

$ createdb rjpa_test

Setup

Install dependencies and build database

$ bundle install && rails db:migrate

Serve

$ rails s

Graphiql

Register Mutation

mutation($input: RegisterInput!) {
  register(input: $input) {
    email
    firstName
    lastName
  }
}

Query Parameters

{
  "input": {
    "firstName": "[FIRST_NAME]",
    "lastName": "[LAST_NAME]",
    "authProvider": {
      "credentials": {
      	"email": "[EMAIL]",
    	"password": "[PASSWORD]"
      }
    }
  }
}

Login Mutation

mutation ($input: LoginInput!) {
  login (input: $input){
    token
    user {
      email
      firstName
      lastName
    }
  }
}

Query Parameters

{
  "input": {
    "credentials": {
      "email": "[EMAIL]",
      "password": "[PASSWORD]"
    }
  }
}

UpdateUser Mutation

mutation ($input: UpdateUserInput!) {
  updateUser (input: $input){
    user {
      email
      firstName
      lastName
    }
  }
}

Query Parameters

{
  "input": {
    "arguments": {
      "email": "[EMAIL]",
      "firstName": "[FIRST_NAME]",
      "lastName": "[LAST_NAME]",
      "password": "[PASSWORD]",
      "token": "[JWT_TOKEN]",
    }
  }
}

FetchUser Query

query ($input: FetchUserInput!) {
  fetchUser(input: $input) {
    user {
      firstName
      lastName
    }
  }
}

Query Parameters

{
  "input": {
    "arguments": {
      "id": "[USER_ID]",
      "token": "[JWT_TOKEN]"
    }
  }
}

Clone this wiki locally