Skip to content
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/
npm-debug.log
.DS_Store
.env
310 changes: 308 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,308 @@
# fancy-to-do
Membuat App tentang hal - hal keren yang bisa dilakukan
## Fancy Todo
To Do Fancy API - a portofolio project for Hacktiv8 Phase 2. This app has RESTful endpoint for User and Todo Operation Used Technology:
* Express Js
* Sequelize
* Postgres
* Json Web Token
* Bcrypt JSON Formated Response
* Google OAUTH
When you create a new Todo, you will be notice on your authorized email on this app. This feature using technology:
* mailgun (limited recipients)
Also, you can send invitation to anyone who you want to share your favourite todo.
## RESTful endpoints
* GET /todos
* GET /todos/:id
* POST /todos
* PUT /todos/:id
* DELETE /todos/:id
* POST /login
* POST /register
* POST /googleSign

### Global Response

_Response (500)_
```
{
"message": "<internal server error>"
}
```
---
### GET /todos

> Get all todos

_Request Header_
```
{
"token": "<your access token>"
}
```

_Request Body_
```
not needed
```

_Response (200 - Ok)_
```
[
{
"id": 1,
"title": "<asset title>",
"description": "<asset description>",
"createdAt": "2020-03-20T07:15:12.149Z",
"updatedAt": "2020-03-20T07:15:12.149Z",
},
{
"id": 2,
"title": "<asset title>",
"description": "<asset description>",
"createdAt": "2020-03-20T07:15:12.149Z",
"updatedAt": "2020-03-20T07:15:12.149Z",
}, ...
]
```

_Response (400 - Bad Request)_
```
{
"message": "Invalid request"
}
```
---
### GET /todos/:id

> Get all todos

_Request Header_
```
{
"token": "<your access token>"
}
```

_Request Body_
```
not needed
```

_Response (200- Ok)_
```
{
"id": 1,
"title": "<asset title>",
"description": "<asset description>",
"createdAt": "2020-03-20T07:15:12.149Z",
"updatedAt": "2020-03-20T07:15:12.149Z",
}
```

_Response (404 - Not Found)_
```
{
"message": "Todo not Found"
}
```
---
### POST /todos

> Create new todos

_Request Header_
```
{
"token": "<your access token>"
}
```

_Request Body_
```
{
"titile": "<titile to get insert into>",
"description": "<description to get insert into>",
"status": "<status to get insert into">,
"due_date": "<due_date to get insert into">,
}
```

_Response (201 - Created)_
```
{
"id": <given id by system>,
"title": "<posted title>",
"description": "<posted description>",
"status": "<posted status>",
"due_date": "<posted due_date>",
"createdAt": "2020-03-20T07:15:12.149Z",
"updatedAt": "2020-03-20T07:15:12.149Z",
}
```

_Response (400 - Bad Request)_
```
{
"message": "Invalid requests"
}
```
---
### PUT /todos
> Edit Todo

_Request Header_
```
{
"token": "<your access token>"
}
```

_Request Body_
```
{
"titile": "<titile to get insert into>",
"description": "<description to get insert into>",
"status": "<status to get insert into">,
"due_date": "<due_date to get insert into">,
}
```
_Response (200 - Ok)_
```
{
"id": <given id by system>,
"title": "<posted title>",
"description": "<posted description>",
"status": "<posted status>",
"due_date": "<posted due_date>",
"createdAt": "2020-03-20T07:15:12.149Z",
"updatedAt": "2020-03-20T07:15:12.149Z",
}
```
_Response (400 - Bad Request)_
```
{
"message": "title cannot be empty || description cannot be empty || status cannot be empty || Due_date cannot be empty"
}
```
_Response (404 - Not Found)_
```
{
"message": "<Todo Not Found>"
}
```
---
### DELETE /todos/:id
> Delete Todo
_Request Header_
```
{
"token": "<your access token>"
}
```

_Request Body_
```
{
"<not needed>"
}
```
_Response (200 - Ok)_
```
{
"id": <given id by system>,
"title": "<posted title>",
"description": "<posted description>",
"status": "<posted status>",
"due_date": "<posted due_date>",
"createdAt": "2020-03-20T07:15:12.149Z",
"updatedAt": "2020-03-20T07:15:12.149Z",
}
```
_Response (404 - Not Found)_
```
{
"message": "<Todo Not Found>"
}
```
---
### POST /login
> Login User
_Request Header_
```
{
"<not needed>"
}
```
_Request Body_
```
{
"email": "<email to get insert into>"
"password": "<password to get insert into>"
}
```
_Response ( 200 - Ok )_
```
{
"access_token": "<access_token from JWT>"
}
```
_Response ( 400 - Bad Request )_
```
{
"message": "<invalid email or password>"
}
```
---
### POST /register
> Create new User
_Request Header_
```
{
"<not needed>"
}
```
_Request Body_
```
{
"email": "<email to get insert into>"
"password": "<password to get insert into>"
}
```
_Response ( 201 - Created )_
```
{
"id": <given id by system>,
"title": "<created title>",
"description": "<created description>",
"status": "<created status>",
"due_date": "<created due_date>",
"createdAt": "2020-03-20T07:15:12.149Z",
"updatedAt": "2020-03-20T07:15:12.149Z",
}
```
---

### POST /googleSign
> Sign in with Google, if not registered, then do register user aswell

_Request Header_
```
<not needed>
```
_Request Body_
```
{
"id_token" : "<id_token from google>"
}
```
_Response (200)_
```
{
"access_token": "<access_token JWT>"
}
```
_Response (404 - Not Found)_
```
{
"message": "data not found"
}
```
5 changes: 5 additions & 0 deletions client/.firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"projects": {
"default": "fancy-todo-392d7"
}
}
65 changes: 65 additions & 0 deletions client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
firebase-debug.log*

# Firebase cache
.firebase/

# Firebase config

# Uncomment this if you'd like others to create their own Firebase project.
# For a team working on the same Firebase project(s), it is recommended to leave
# it commented so all members can deploy to the same project(s) in .firebaserc.
# .firebaserc

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
Loading