Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Muhammad Farhat Saputra #54

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
371 changes: 371 additions & 0 deletions API-DOCUMENTATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,371 @@
List of available endpoints:

---
- `POST /login`
- `POST /register`
- `GET /categories`
- `POST /categories`
- `DELETE /categories`
- `POST /tasks`
- `GET /tasks/:id`
- `PUT /tasks/:id`
- `PATCH /tasks/:id`
- `DELETE /tasks/:id`
---
### POST /login

Request:

- data:

```json
{
"email": "string",
"password": "string"
}
```

Success Response:

- status: 200
- body:

```json
{
"access_token": "jsonwebtoken string"
}
```

Error Response:

- status: 400
- body:

```json
{
"message": "Invalid Email"
}
```
OR
```json
{
"message": "Invalid Password"
}
```
### POST /register

Request:

- data:

```json
{
"name": "string",
"email": "string",
"password": "string"
}
```

Response:

- status: 201
- body:

```json
{
"id": 2,
"email": "[email protected]"
}
```

### GET /categories

description:
get all categories including tasks

Request:

- headers: access_token (string)

Response:

- status: 200
- body:

```json
{
"category": [
{
"id": 41,
"name": "Todo",
"createdAt": "2020-12-17T18:40:33.600Z",
"updatedAt": "2020-12-17T18:40:33.600Z",
"Tasks": [
{
"id": 61,
"name": "Belajar",
"UserId": 18,
"CategoryId": 41,
"createdAt": "2020-12-17T18:40:44.995Z",
"updatedAt": "2020-12-17T18:40:44.995Z"
}
]
},
{
"id": 42,
"name": "Ongoing",
"createdAt": "2020-12-17T18:40:38.192Z",
"updatedAt": "2020-12-17T18:40:38.192Z",
"Tasks": []
}
]
}
```

### POST /categories

description:
add new category

Request:
- headers: access_token (string)
- data:

```json
{
"name": "string"
}
```

Response:

- status: 200
- body:

```json
{
"id": 3,
"name": "Finish",
"updatedAt": "2020-12-17T18:46:58.205Z",
"createdAt": "2020-12-17T18:46:58.205Z"
}
```

### DELETE /categories/:id

description:
to delete category

Request:

- headers: access_token (string)
- params:
- id: "integer" required

Success Response:

- status: 200
- body:

```json
{
"message": "Category success to delete"
}
```
Error Response:

- status: 404
- body:

```json
{
"message": "Id not found"
}
```
### POST /tasks

description: add new task

Request:

- headers: access_token (string)
- data:

```json
{
"name": "string",
"CategoryId": "integer"
}
```
Response:

- status: 201
- body:

```json
{
"id": 10,
"name": "Membuat REST API",
"UserId": 2,
"CategoryId": 5,
"updatedAt": "2020-12-17T18:57:43.776Z",
"createdAt": "2020-12-17T18:57:43.776Z"
}
```

### GET /tasks/:id

description: get task by id

Request:

- headers: access_token (string)
- params:
- id: "integer" required

Success Response:

- status: 200
- body:

```json
{
"task": {
"id": 10,
"name": "Membuat REST API",
"UserId": 2,
"CategoryId": 5,
"createdAt": "2020-12-17T18:57:43.776Z",
"updatedAt": "2020-12-17T18:57:43.776Z"
}
}
```
Error Response:

- status: 404
- body:

```json
{
"message": "Data not found"
}
```
### PUT /tasks/:id

description: to update task name and category

Request:

- headers: access_token (string)
- params:
- id: "integer" required
- data:

```json
{
"name": "string",
"CategoryId": "integer"
}
```

Success Response:

- status: 200
- body:

```json
{
"id": 10,
"name": "Membuat REST API Doc",
"UserId": 2,
"CategoryId": 6,
"createdAt": "2020-12-17T18:57:43.776Z",
"updatedAt": "2020-12-17T18:57:43.776Z"
}
```
Error Response:

- status: 404
- body:

```json
{
"message": "Id not found"
}
```
### PATCH /tasks/:id

description: to update category

Request:

- headers: access_token (string)
- params:
- id: "integer" required
- data:

```json
{
"CategoryId": "integer"
}
```

Success Response:

- status: 200
- body:

```json
{
"id": 10,
"name": "Membuat REST API Doc",
"UserId": 2,
"CategoryId": 2,
"createdAt": "2020-12-17T18:57:43.776Z",
"updatedAt": "2020-12-17T18:57:43.776Z"
}
```
Error Response:

- status: 404
- body:

```json
{
"message": "Id not found"
}
```
### DELETE /tasks/:id

description: to delete task

Request:

- headers: access_token (string)
- params:
- id: "integer" required

Success Response:

- status: 200
- body:

```json
{
"message": "Task success to delete"
}
```
Error Response:

- status: 404
- body:

```json
{
"message": "Id not found"
}
```
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# kanban-app
# kanban-app
client : https://kanban-client-469d8.web.app/
server : https://kanban-server-h8rmt6.herokuapp.com/
15 changes: 15 additions & 0 deletions client-vue/.firebase/hosting.ZGlzdA.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
index.html,1608265997881,d35caf06584c5567c7400090344eed5e6d9e97910e0e54b740a8c42a59cd0511
style.3de17d47.css,1608265997883,1ba2c7d37d0ee7b8cc74a23ecbf799156aa2bcfd407624cf627abf66d8a60b59
style.3de17d47.css.map,1608265997888,6a44be2c250e59ce53eee2e994258e4059b56003a058447ce24cfe95ebd127ef
style.e308ff8e.css,1608265876205,4146ab91ecb5c09da8961b490a8fc694eae644b216f1266033a5e5436aef6468
style.e308ff8e.css.map,1608265876555,2f5156a91e01c12fca6f3b319aca88b03f134e7d3b6c136a888845a0eef0af2a
style.e308ff8e.js,1608265876534,12b70651d791df9f256b0222443cfa06407ce6fffa5f8dde0d1f0d1d419ec8a2
style.e308ff8e.js.map,1608265876548,1091d25d9158c3426fe41b808ac00929a677d13c2bba7b8a83b81aec2ccb89c8
main.7ffc9038.css,1608265997886,504ab417c11169cf9a227c5f9288d6c9ebec7330179eeb5acddea517e87987b8
main.1e43358e.css,1608265876212,8ff5e7990c2b3660efec34fc60b609a41545d65e8940c93ce209120f169646f1
main.7ffc9038.css.map,1608265997932,61352fb11b4b68b4b2cdc9e9bfafd85653d6023c57561d722722ee9c5d90edbc
main.1e43358e.css.map,1608265876270,88021aca764af00c7ba1c35da86d187da9c212b2d79439c00cc58d70e7ac5418
main.c67c006d.js,1608265998057,ad23ad68a12ff84b261dcd438e29826d1219a186f86221a0730b582d2bdbf56d
main.1e43358e.js,1608265876758,aef60d3cd63d961e10f19b3e603530fbe2658d63bc70540df92da5186bf3efff
main.c67c006d.js.map,1608265998312,c8ec7f5638a4fc5c424a632a5bd3f3ba1fad340689304647ec298e42673dc611
main.1e43358e.js.map,1608265877236,947d6f333096592273f61dd7fe9e3167577bac521e98e08016ddea765bbbb713
Loading