First time setup

  • install nodejs
  • install Yarn
  • install Docker
yarn install

Starting

Start Local MongoDB

./start-db.sh

In first terminal start build process in watch mode:

yarn watch

In second terminal start an application:

yarn start

API Browser

Open http://localhost:4000 to see Graphql Playground

Sign in as a default user & run queries as one

  1. Run signIn mutation in API Browser:
mutation {
  signIn (email: "admin@example.com", password: "123456") {
    token
    result {
      success
      message
    }
  }
}

Copy received token to HTTP HEADERS section:

{"Authorization": "<token-here>"}

Then you can run, for example, me query:

{ me {
  id
  email
  role
  appointments {
      id
      status
      startTime
      description
      issuer {
          email
      }
  }  
}}

Create an appointment

( for receiver id provide valid user id)

mutation {
  appointmentCreate(description: "test 1", receiver: "5fe4658a6b4dc07520e93079",
  startTime: "2020-12-24 12:30", endTime: "2020-12-24 12:45") {
    appointment {
      status
      id
      description
      startTime
      endTime
      receiver {
        id
        email
        created
      },
      issuer {
        id
        email
        created
      }
    }
    result {
      success
      message
    },
    errors {
      startTime
      endTime
      receiver
    }
  }
}

List of appointments

{ appointments {
  id
  status
  startTime  
}}

Approving an appointment

mutation {
  appointmentApprove(id: "5fe465d26b4dc07520e9307a") {
    result {
      success
      message
    }
    appointment {
      id
      status
    }
  }
}

( provide valid appointment id )

Example: Getting related data

{ me {
  id
  email
  role
  appointments {
    id
    status
    description
    receiver {
      appointments {
        id
        status
        startTime
        description
      }
    }
  }
}}