fooey / busyQL

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

busyQL

Node.js based GraphQL wrapper for the busybusy REST API.

Getting Started

  1. Install Node.js (https://nodejs.org/en/)
  2. Install Yarn.js (https://yarnpkg.com/en/docs/install)
  3. Clone repo (https://github.com/fooey/busyQL.git
  4. Install dependencies, run yarn install
  5. Start in dev mode, run yarn dev
    • Or, start in server mode, run yarn start

Server will start on http://localhost:4000/
GraphQL endpoint: http://localhost:4000/graphql
GraphiQL editor: http://localhost:4000/graphiql
GraphQL Schema: http://localhost:4000/schema

Example Query

{
  organization {
    ...orgProps
    owner { ...memberProps }
  }
  memberById:member(id: "92cccae3-2aac-43c2-b69e-fbca7e472118") {
    ...memberProps
    organization {
      ...orgProps
    	owner {
        ...memberProps
      }
    }
  }
  # members:member {
  #   ...memberProps
  # }
}
fragment orgProps on OrganizationType {
    id
    organization_name
    owned_by
    updated_on
    created_on
    submitted_on
    deleted_on
}
fragment memberProps on MemberType {
    first_name
    last_name
    email
    organization_id
    position_id
}

result

{
  "data": {
    "organization": {
      "id": "a6735855-8738-44e7-a3e9-403b9c1e4470",
      "organization_name": "Jason Rushton Enterprises",
      "owned_by": "92cccae3-2aac-43c2-b69e-fbca7e472118",
      "updated_on": 1493311251,
      "created_on": 1456358400,
      "submitted_on": 1456425889,
      "deleted_on": null,
      "owner": {
        "first_name": "Jason",
        "last_name": "Rushton",
        "email": "jasonr@busybusybusy.com",
        "organization_id": "a6735855-8738-44e7-a3e9-403b9c1e4470",
        "position_id": "1e65a68c-51fd-49f6-93d0-d87bd0a00aee"
      }
    },
    "memberById": {
      "first_name": "Jason",
      "last_name": "Rushton",
      "email": "jasonr@busybusybusy.com",
      "organization_id": "a6735855-8738-44e7-a3e9-403b9c1e4470",
      "position_id": "1e65a68c-51fd-49f6-93d0-d87bd0a00aee",
      "organization": {
        "id": "a6735855-8738-44e7-a3e9-403b9c1e4470",
        "organization_name": "Jason Rushton Enterprises",
        "owned_by": "92cccae3-2aac-43c2-b69e-fbca7e472118",
        "updated_on": 1493311251,
        "created_on": 1456358400,
        "submitted_on": 1456425889,
        "deleted_on": null,
        "owner": {
          "first_name": "Jason",
          "last_name": "Rushton",
          "email": "jasonr@busybusybusy.com",
          "organization_id": "a6735855-8738-44e7-a3e9-403b9c1e4470",
          "position_id": "1e65a68c-51fd-49f6-93d0-d87bd0a00aee"
        }
      }
    }
  }
}

More Queries

query project($id: ID!) {
  project(id: $id) {
    ...projectProps
    
    parent_project{
      ...projectProps
      
      parent_project{
        ...projectProps
        
        parent_project{
          ...projectProps
        }
      }
    }
    
    root_project{
      ...projectProps
      
      child_projects {
        ...projectProps
      }
    }
  }
}

fragment projectProps on ProjectType {
    title
    id
}
query timeEntries($member_id: ID!) {
  openTimeEntries(
    member_id: $member_id, 
    start_time_gte: 1481792400,
  ) {
    # id
    start_time
    end_time
    project_id
    cost_code_id
    member_id
    
    project {
      id
      title
    }
  }
}
query member($id: ID!) {
  member(id: $id) {
    id
    first_name
    last_name
    email
    organization_id
    position_id
    
    timeEntries(start_time_gte: 1500000000) {
      start_time
      end_time
      project_id
      cost_code_id
      action_type
    }
    
    openTimeEntries {
      start_time
      end_time
      project_id
      cost_code_id
      action_type
    }
  }
}
{
  organization {
    id
    organization_name
    owned_by
    updated_on
    created_on
    submitted_on
    deleted_on
  }
}

About

License:MIT License


Languages

Language:JavaScript 100.0%