Git Product home page Git Product logo

birkle's People

Contributors

swackles avatar

Watchers

 avatar  avatar

birkle's Issues

TimeLog/See one

Request GET timelog/:id

Header

{
  "Authorization": "mandatory; user auth token",
}

##Response

Code 401

When token authentication failed

Code 400

When time log with ID doesn't exist

{
  "code": "code for the specific error",
  "msg": "message for the specific error"
}

Code 200

{
  "id": "id of the timelog",
  "description": "description for the timelog",
  "startTime": "2012-04-23T18:25:43.511Z",
  "endTime": "2012-04-23T18:25:43.511Z"
}

util/Error Response

This method will be a number input and each number will represent an error and then return a JSON object.

{
  "code": "code for the specific error",
  "msg": "message for the specific error"
}

List of errors

TIMELOG_ID_MISSING

Timelog with this id doesn't exist

TIMELOG_ONGOING

Timelog is still ongoing

TIMELOG_OVERLAP

There's an already existing time range that overlaps

MANDATORY_FIELD_MISSING

The mandatory field is missing

USER_EXISTS

User already exists

TimeLog/Edit

Request PUT timelog/:id

Header

{
  "Authorization": "mandatory; user auth token",
}

Body

{
  "description": "description for the timelog",
  "startTime": "2012-04-23T18:25:43.511Z",
  "endTime": "2012-04-23T18:25:43.511Z",
}

##Response

Code 401

When token authentication failed

Code 400

  • When time log with ID doesn't exist
  • When the time log is still ongoing
{
  "code": "code for the specific error",
  "msg": "message for the specific error"
}

Code 200

{
  "id": "id for the time log"
}

TimeLog/End

Request POST timelog/:id/end

Header

{
  "Authorization": "mandatory; user auth token",
}

Body

{
  "endTime": "2012-04-23T18:25:43.511Z"
}

##Response

Code 401

When token authentication failed

Code 400

  • When time log with ID doesn't exist
  • When the time log is still ongoing
{
  "code": "code for the specific error",
  "msg": "message for the specific error"
}

Code 200

{
  "id": "id for the time log"
}

TimeLog/new

Request POST timelog/new

Header

{
  "Authorization": "mandatory; user auth token",
}

Body

{
  "description": "mandatory; description for the timelog",
  "startTime": "mandatory; 2012-04-23T18:25:43.511Z",
  "endTime": "2012-04-23T18:25:43.511Z",
}

##Response

Code 401

When token authentication failed

Code 400

  • When the mandatory field is missing
  • When the time range overlaps with another
{
  "code": "code for the specific error",
  "msg": "message for the specific error"
}

Code 200

{
  "id": "id for the time log"
}

util/authentication middleware

Authentication middleware that checks token in the header is valid. If valid then uses next if not then returns a correct error

TimeLog/Delete

Request Delete timelog/:id

Header

{
  "Authorization": "mandatory; user auth token",
}

##Response

Code 401

When token authentication failed

Code 400

When time log with ID doesn't exist

{
  "code": "code for the specific error",
  "msg": "message for the specific error"
}

Code 200

{
  "id": "id for the time log"
}

Authentication/Registration

POST auth/register

Request

{
  "email": "Email of the user",
  "password": "Password of the user",
  "name": {
    "forname": "First name of the user",
    "surname": "Last name of the user"
  }
}

All fields mandatory

Return

Code 400

  • When the mandatory field is missing
  • When user already exists
{
  "code": "code for the specific error",
  "msg": "message for the specific error"
}

200 Code

If registration is successful

{
  "token": "Token for the user"
}

TimeLog/List

Request GET timelog

Header

{
  "Authorization": "mandatory; user auth token",
}

##Response

Code 401

When token authentication failed

Code 200

{
  [
    {
      "id": "id of the timelog",
      "description": "description for the timelog",
      "startTime": "2012-04-23T18:25:43.511Z",
      "endTime": "2012-04-23T18:25:43.511Z",
    },
    {
      "id": "id of the timelog",
      "description": "description for the timelog",
      "startTime": "2012-04-23T18:25:43.511Z",
      "endTime": "2012-04-23T18:25:43.511Z",
    }
  ]
}

Authentication/Login

POST auth/login

Request

{
  "email": "Email of the user",
  "password": "Password of the user"
}

All fields mandatory

Return

Code 401

When authentication fails

200 Code

If registration is successful

{
  "token": "Token for the user"
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.