Giter VIP home page Giter VIP logo

kanban-1's Introduction

KANFUN (KANBAN APPLICATION)

Third Party

Google OAUTH

Server Documentation

Dependencies

Package Name Version
bcrypt ^2.4.3
cors ^2.8.5
dotenv ^8.2.0
express 4.17.1
googleapis ^39.2.0
jsonwebtoken ^8.5.1
pg ^7.18.1
sequelize ^5.21.3

Devpendencies

Package Name Version
dotenv ^8.2.0

Example .env

secret=cialobaobao

SENDGRID_API_KEY='SG.yW5JelmwQYCo6Dg6znEtCQ ZVmHemhvg0dKz22wvkJ2I6Xt9MoY5bPB6F-2WpVmzQw' PORT=3000

Default Port

SERVER = https://protected-savannah-10852.herokuapp.com
CLIENT = https://kanfun-1584103939567.firebaseapp.com/

Server

Tools: NodeJS, Express, sequelize, postgresql

Table Responses

Code Description
200 Response Sukses
201 Data berhasil ditambahkan
400 Request yang diberikan tidak lengkap atau salah
403 Tidak memiliki otoritas
404 Data tidak ditemukan / tidak ada
500 Error dari sisi server / tidak diduga-duga :v

USERS

Url Method Description
/users/register POST Menambahkan User baru
/users GET Mencari atau Melihat daftar Semua User
/users/login POST Mendapatkan token dan mengirim token ke client

1. POST / Users / register

Request header:

{
    "Content-Type": "application/json"
}

Example Input (Request Body) :

{
    "username": "marcel",
    "email": "[email protected]",
    "password": "123",	
}

Response (201, Data berhasil ditambahkan):

{
    "username": "marcel",
    "email": "[email protected]",
    "password": "1aojadoa2sdasd4adplalaxlasclsml",	
    "updatedAt": "2020-02-03T13:03:50.806Z",
    "createdAt": "2020-02-03T13:03:50.806Z"
}

Example Input (Request Body) :

{
    "username": "marcel",
    "email": "[email protected]",
    "password": "",	
}

Response ERROR (400, Request tidak lengkap):

{
	status: 400,
	msg: "Bad Request"
}

2. POST / users / login


Request header:

{
    "Content-Type": "application/json"
}

Example Input (Request Body) :

{
    "email": "[email protected]",
    "password": "123",	
}

Response (200, Respon Sukses ):

{
    "username": "marcel",
    "email": "[email protected]",
    "password": "1aojadoa2sdasd4adplalaxlasclsml",	
    "updatedAt": "2020-02-03T13:03:50.806Z",
    "createdAt": "2020-02-03T13:03:50.806Z"
}

Example Error Input (Request Body) :

{
    "username": "marcel",
    "email": "[email protected]",
    "password": "",	
}

Response ERROR(400, Data tidak lengkap):

{
	status: 400,
	msg: "Password cannot empty."
}

3. GET / users

Response (200, Respon Sukses):

[
  {
    "id": 1,
    "username": "marcelus",
    "email": "[email protected]",
    "password": "$2b$10$I2JXLSnEFazR50WQ4EiMPuNsYlOgoQBwJMgqG33Q0IrFEZY8HlrFG",
    "createdAt": "2020-03-05T10:51:42.750Z",
    "updatedAt": "2020-03-05T10:51:42.750Z"
  },
  {
    "id": 2,
    "username": "marcellll",
    "email": "[email protected]",
    "password": "$2b$10$WVYzEHBXfwd1X75iNUmA6OQMN80nrpXnp1VB7VZR/Gf8zGf3vGWlO",
    "createdAt": "2020-03-05T12:51:42.921Z",
    "updatedAt": "2020-03-05T12:51:42.921Z"
  }
]

If the "data" was empty, the response will be :

"[]";

4. PUT / users

Request header:

{
    "Content-Type": "application/json",
}

Example Input (Request Body) :

{
    "email": "[email protected]",
    "password": "123",	
}

Response (200, Respon Sukses):

{
    "username": "marcel",
    "email": "[email protected]",
    "password": "1aojadoa2sdasd4adplalaxlasclsml",	
    "updatedAt": "2020-02-03T13:03:50.806Z",
    "createdAt": "2020-02-03T13:03:50.806Z"
}

Example Error Input (Request Body) :

{
    "username": "marcel",
    "email": "[email protected]",
    "password": "",	
}

Response ERROR(400, Data tidak lengkap):

{
	status: 400,
	msg: "Password cannot empty."
}

Kanban

Url Method Description
/kanbans POST Menambahkan kanbans baru kedalam kanbans list
/kanbans GET Mencari atau Melihat kanbans punya user
/kanbans/:id GET Mencari atau Melihat kanbans berdasarkan id
/kanbans/:id PUT Mengedit Data kanbans
/kanbans/:id DELETE Menghapus kanbans dari table favorite

1. POST /kanbans

Example Input (Request Body) :

{
"name": "Mandi"
"CategoryId": 1,
}

Response (201, data berhasil ditambahkan):

{
  "id": 26,
  "name": "mandi",
  "UserId": 1,
  "CategoryId": 1,
  "updatedAt": "2020-03-16T09:33:50.071Z",
  "createdAt": "2020-03-16T09:33:50.071Z"
}

Example ERROR Input (Request Body) :

{
"name": ""
"CategoryId": 1,
}

Response (400, Bad Request):

[
  "Kanban's Cannot Empty."
]

2. GET / kanbans

Response (200, response sukses):

[
  {
    "id": 22,
    "name": "Mengayak Tepung",
    "CategoryId": null,
    "UserId": 1,
    "createdAt": "2020-03-16T09:20:29.722Z",
    "updatedAt": "2020-03-16T09:20:29.722Z",
    "Category": null
  },
  {
    "id": 25,
    "name": "Owyeaaahhh!",
    "CategoryId": 3,
    "UserId": 1,
    "createdAt": "2020-03-16T09:25:29.123Z",
    "updatedAt": "2020-03-16T09:25:29.123Z",
    "Category": {
      "id": 3,
      "title": "Done",
      "createdAt": "2020-03-13T13:56:56.877Z",
      "updatedAt": "2020-03-13T13:56:56.877Z"
    }
  },
  {
    "id": 26,
    "name": "mandi",
    "CategoryId": null,
    "UserId": 1,
    "createdAt": "2020-03-16T09:33:50.071Z",
    "updatedAt": "2020-03-16T09:33:50.071Z",
    "Category": null
  }
]

3. PUT / kanbans /:id

Example Input (Request Body) :

{
    "name": "Mandi",
    "CategoryId": 2
}

Response (200, response sukses):

{
{
  "id": 26,
  "name": "mandi",
  "UserId": 1,
  "CategoryId": 2,
  "updatedAt": "2020-03-16T09:33:50.071Z",
  "createdAt": "2020-03-16T09:33:50.071Z"
}
}

If the ID wasn't found the respond will be (404, data not found):

{
  status: 404,
  msg: "data not found"
}

Example Input (Request Body) :

{
"name": "",
}

Response ERROR (400, data tidak lengkap):

{
  "status": 400,
  "msg": "Kanban cannot be empty."
}

4. DELETE / kanbans /:id

Example Input (Request Params) :

 req.params.id = 2

Response (200, response if success):

1

Example Error Input (Request Body) :

req.params.id = 2

Response ERROR (404, data not found):

{
  status: 404
  msg: 'Data not found'
}

5. GET / kanbans /:id

Example Input (Request Params) :

 req.params.id = 2

Response (200, response if success):

{
  {
    "id": 25,
    "name": "Owyeaaahhh!",
    "CategoryId": 3,
    "UserId": 1,
    "createdAt": "2020-03-16T09:25:29.123Z",
    "updatedAt": "2020-03-16T09:25:29.123Z",
    "Category": {
      "id": 3,
      "title": "Done",
      "createdAt": "2020-03-13T13:56:56.877Z",
      "updatedAt": "2020-03-13T13:56:56.877Z"
    }
  }

}

Example Error Input (Request Body) :

req.params.id = 2

Response ERROR (404, data not found):

{
  status: 404
  msg: 'Data not found'
}

Category

Url Method Description
/Categories POST Menambahkan Categories baru kedalam Categories list
/Categories GET Mencari atau Melihat Categories punya user
/Categories/:id GET Mencari atau Melihat Categories berdasarkan id
/Categories/:id PUT Mengedit Data Categories
/Categories/:id DELETE Menghapus Categories dari table favorite

1. POST /Categories

Example Input (Request Body) :

{
  "title": "masyukk",
}

Response (201, data berhasil ditambahkan):

{
  "id": 5,
  "title": "masyukk",
  "updatedAt": "2020-03-16T09:44:26.188Z",
  "createdAt": "2020-03-16T09:44:26.188Z"
}

2. GET / Categories

Response (200, response sukses):

[
  {
    "id": 1,
    "title": "Backlog",
    "createdAt": "2020-03-13T13:56:56.877Z",
    "updatedAt": "2020-03-13T13:56:56.877Z",
    "Kanbans": []
  },
  {
    "id": 2,
    "title": "Todo",
    "createdAt": "2020-03-13T13:56:56.877Z",
    "updatedAt": "2020-03-13T13:56:56.877Z",
    "Kanbans": []
  },
  {
    "id": 3,
    "title": "Done",
    "createdAt": "2020-03-13T13:56:56.877Z",
    "updatedAt": "2020-03-13T13:56:56.877Z",
    "Kanbans": [
      {
        "id": 25,
        "name": "Owyeaaahhh!",
        "CategoryId": 3,
        "UserId": 1,
        "createdAt": "2020-03-16T09:25:29.123Z",
        "updatedAt": "2020-03-16T09:25:29.123Z"
      }
    ]
  },
  {
    "id": 4,
    "title": "Completed",
    "createdAt": "2020-03-13T13:56:56.877Z",
    "updatedAt": "2020-03-13T13:56:56.877Z",
    "Kanbans": []
  },
  {
    "id": 5,
    "title": "masyukk",
    "createdAt": "2020-03-16T09:44:26.188Z",
    "updatedAt": "2020-03-16T09:44:26.188Z",
    "Kanbans": []
  }
]

3. PUT / Categories /:id

Example Input (Request Body) :

{
    "title": "coba"
}

Response (200, response sukses):

[
  1,
  [
    {
      "id": 5,
      "title": "coba",
      "createdAt": "2020-03-16T09:44:26.188Z",
      "updatedAt": "2020-03-16T09:48:53.277Z"
    }
  ]
]

If the ID wasn't found the respond will be (404, data not found):

{
  status: 404,
  msg: "data not found"
}

Example Input (Request Body) :

{
"title": "Summer Paradise",
"artist": ""
}

Response ERROR (400, data tidak lengkap):

{
  "status": 400,
  "msg": "Artist cannot be empty."
}

4. DELETE / Categories /:id

Example Input (Request Params) :

 req.params.id = 2

Response (200, response if success):

1

Example Error Input (Request Body) :

req.params.id = 2

Response ERROR (404, data not found):

{
  status: 404
  msg: 'Data not found'
}

5. GET / Categories /:id

Example Input (Request Params) :

 req.params.id = 5

Response (200, response if success):

{
    "id": 5,
    "title": "coba",
    "createdAt": "2020-03-16T09:44:26.188Z",
    "updatedAt": "2020-03-16T09:48:53.277Z"
}

Example Error Input (Request Body) :

req.params.id = 5

Response ERROR (404, data not found):

{
  status: 404
  msg: 'Data not found'
}

kanban-1's People

Contributors

marcel-maruli avatar rubhiauliatirta avatar

Watchers

James Cloos avatar

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.