Skip to content

dvrylc/cvwo-tasktracker

Repository files navigation

CircleCI Heroku

Details

Setup

Requirements

  • PostgreSQL
  • Ruby
  • Node.js

Steps

  1. Clone the repository
  2. bundle && yarn
  3. rails db:create && rails db:migrate
  4. Start two terminal sessions -
    • rails s for the Rails server
    • bin/webpack-dev-server for the webpack server, supports HMR

API Documentation

Read all tasks and tags

Request

GET /api/all

Response

200 OK

{
  "tasks": [
    {
      "id": 1,
      "title": "Eat breakfast",
      "done": true,
      "created_at": "2019-01-21T03:42:40.591Z",
      "updated_at": "2019-01-21T03:42:41.631Z",
      "tag_id": 1
    },
    {
      "id": 2,
      "title": "Eat lunch",
      "done": false,
      "created_at": "2019-01-21T03:42:47.966Z",
      "updated_at": "2019-01-21T03:42:47.966Z",
      "tag_id": 1
    }
  ],
  "tags": [
    {
      "id": 1,
      "title": "meals",
      "created_at": "2019-01-21T03:37:02.839Z",
      "updated_at": "2019-01-21T03:37:02.839Z"
    },
    {
      "id": 2,
      "title": "homework",
      "created_at": "2019-01-21T03:44:37.477Z",
      "updated_at": "2019-01-21T03:44:37.477Z"
    }
  ]
}

Read all tasks

Request

GET /api/tasks

Response

200 OK

[
  {
    "id": 1,
    "title": "Eat breakfast",
    "done": true,
    "created_at": "2019-01-21T03:42:40.591Z",
    "updated_at": "2019-01-21T03:42:41.631Z",
    "tag_id": 1
  },
  {
    "id": 2,
    "title": "Eat lunch",
    "done": false,
    "created_at": "2019-01-21T03:42:47.966Z",
    "updated_at": "2019-01-21T03:42:47.966Z",
    "tag_id": 1
  }
]

Create a task

Request

POST /api/tasks

{
  "task": {
    "title": "Eat breakfast",
    "done": false,
    "tag_id": 1
  }
}

Response

201 Created

{
  "id": 1,
  "title": "Eat breakfast",
  "done": false,
  "created_at": "2019-01-21T03:37:26.166Z",
  "updated_at": "2019-01-21T03:37:26.166Z",
  "tag_id": 1
}

Read a task

Request

GET /api/tasks/:id

Response

200 OK

{
  "id": 1,
  "title": "Eat breakfast",
  "done": false,
  "created_at": "2019-01-21T03:37:26.166Z",
  "updated_at": "2019-01-21T03:37:26.166Z",
  "tag_id": 1
}

Update a task

Request

PUT /api/tasks/:id

{
  "task": {
    "id": 1,
    "title": "Eat lunch",
    "done": false,
    "created_at": "2019-01-21T03:37:26.166Z",
    "updated_at": "2019-01-21T03:37:26.166Z",
    "tag_id": 1
  }
}

Response

200 OK

{
  "id": 1,
  "title": "Eat lunch",
  "done": false,
  "tag_id": 1,
  "created_at": "2019-01-21T03:37:26.166Z",
  "updated_at": "2019-01-21T03:39:32.939Z"
}

Delete a task

Request

DELETE /api/tasks/:id

Response

200 OK

Read all tags

Request

GET /api/tags

Response

200 OK

[
  {
    "id": 1,
    "title": "meals",
    "created_at": "2019-01-21T03:37:02.839Z",
    "updated_at": "2019-01-21T03:37:02.839Z"
  },
  {
    "id": 2,
    "title": "homework",
    "created_at": "2019-01-21T03:44:37.477Z",
    "updated_at": "2019-01-21T03:44:37.477Z"
  }
]

Create a tag

Request

POST /api/tags

{
  "tag": {
    "title": "homework"
  }
}

Response

201 Created

{
  "id": 2,
  "title": "homework",
  "created_at": "2019-01-21T03:44:37.477Z",
  "updated_at": "2019-01-21T03:44:37.477Z"
}

Delete a tag

Request

DELETE /api/tags/:id

Response

200 OK

About

CVWO AY18/19 Winter Assignment

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors