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

Ayu Sudi Dwijayanti #18

Open
wants to merge 6 commits into
base: master
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
101 changes: 100 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,100 @@
# fancy-todo
# fancy-todo
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

biasanya readme dibuat di sisi server saja, karena sebagai API Documentation


```html
server:
http://localhost:3000/

client:
http://localhost:8080/
```
---

# **List of User Routes** :

| HTTP | Routes | Headers | Body | Description |
| --- | ----- | --- | --- | --- |
| POST | /create | none | name,emaild, password | Register new user |
| POST | /login | none | email,password | Login user |
| POST | /signGoogle | none | gooogleToken | Login user by google |

---

# **List of Todo Routes** :
| HTTP | Routes | Headers | Body | Description |
| --- | ----- | --- | --- | --- |
| POST | /create | token | name,description,dueDate | Create new todos (authentication) |
| GET | / | token | none | Get all user todos (authentication) |
| GET | /:id | token | none | Get one todo by id (authorization) |
| DELETE | /:id | token | none | Delete todo by id (authorization) |
| PATCH | /:id | token | name/description/dueDate/status | Update todo by id (authorization) |
| POST | /sendHtml | token | html | Send Picture of description Todo to user emai (authentication) |

---

# **API Third Party** :

| Name | Auth | CORS | HTTPS | Description |
| --------- | ------ | --- | --- | ---- |
| Google | apiKey | No | No | For Login Google |
| SendGrid | apiKey | Yes | ? | For Send html to email user |

---

# **Getting Started**

```
1. npm install
2. open terminal in file server
3. nodemon app.js
4. open terminal (new tab) in file client
5. live-server --host=localhost
6. open localhost:8080

```

# **List of Errors**

1. **Create User**
Route : /users/create
Method : POST

| Status | Message | Description |
| --------- | ------ | --- |
| 400 | User Validation failed | User model validation |
| 500 | Error Internal Server | Server Error |

---

2. **Login User**
Route : - /users/login
- /users/signGoogle
Method : POST

| Status | Message | Description |
| --------- | ------ | --- |
| 400 | Wrong email/password | - |
| 400 | Bad Request | Email/Password is required |
| 500 | Error Internal Server | Server Error |

---

3. **Any Route From Todo**

| Status | Message | Description |
| --------- | ------ | --- |
| 500 | Error Internal Server | Server Error |
| 400 | Bad Request | Validation Todo |
| 401 | Unathorized | Not Authorization |
| 403 | Forbidden Page | Not Authentication |
| 404 | Not Found | Not Authentication |

---
---

**.env Template**

- DEFAULT_PS=?
- JWT_KEY=?
- GOOGLE_CLIENT_ID=?
- SENDGRID_API_KEY=?

146 changes: 146 additions & 0 deletions client/css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
*{
margin : 0;
padding: 0;
font-family: "montserrat", sans-serif;
box-sizing: border-box;
}

body{
background: url(https://www.finestwallpaper.com/uploads/5/7/7/9/5779447/s774058804322417752_p214_i3_w1366.jpeg);
min-height: 100vh;
}
.container#register {
color: white;
background: rgba(231, 18, 178, 0.767);
position: initial;
margin-top: 3%;
right: 50%;
left: 50%;
bottom: 0;
margin: 20;
width: 500px;
height: 500px;
border-radius: 15px;
box-shadow: 1px 1px 50px #000;
}

.container#createTodo {
background: rgba(231, 18, 178, 0.767);
color: white;
position: initial;
margin-top: 3%;
right: 50%;
left: 50%;
bottom: 0;
margin-bottom: 6vw;
width: 600px;
height: 350px;
border-radius: 15px;
box-shadow: 1px 1px 50px #000;
}

.btn-group-lg>.btn, .btn-lg {
padding: 20px;
font-size: 1.25rem;
line-height: 1.5;
border-radius: .3rem;
}

.container#signin {
color: white;
background: rgba(17, 228, 210, 0.767);
position: initial;
margin-top: 3%;
right: 50%;
left: 50%;
bottom: 0;
margin: 20;
width: 500px;
height: 450px;
border-radius: 15px;
box-shadow: 1px 1px 50px #000;
}

.registerTodo {
padding-top: 6%;
}

.signInTodo {
padding-top: 6%;
}

.g-signin2{
width: 350;
height: 150;
}

.container{
position: initial;
max-width: 800px;
margin-top: 10%;
margin: auto;
padding: 10 px
}

.txtb{
width: 100%;
border: none;
border-bottom: 2px solid #000;
background: none;
padding: 10px;
outline: none;
font-size: 18px;
}

h3{
margin: 10px 0;

}

.task{
border-radius: 20px;
width: 100%;
background: rgba(244, 247, 51, 0.884);
padding: 18px;
margin: 6px 0;
overflow: hidden;
}

.task i {
margin: 1vw;
float: right;
cursor: pointer;
}

.edit{
border-radius: 8px;
width: 100%;
background: rgba(17, 224, 224, 0.89);
padding: 1vh;
margin: 6px 0;
min-height: 200px;
overflow: hidden;
}

.box-desc{
min-height: 100px;
height: 90%;
width: 100%;
padding: 0;
margin: 3vw 1vw 0 0;
position: flex;
}

.desc{
width: 100%;
background: rgba(252, 252, 248, 0.966);
padding: 18px;
margin: 6px 0;
min-height: 200px;
overflow: hidden;
}


.completed .task{
background: rgba(167, 231, 62, 0.774)
}
133 changes: 133 additions & 0 deletions client/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.10.2/css/all.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="./css/style.css">
<script src="https://code.jquery.com/jquery-3.4.1.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
<meta name="google-signin-client_id"
content="413097102968-5esi6ggnd8o2s2pk1bdjhocuaboaehn8.apps.googleusercontent.com">
<script src="https://apis.google.com/js/platform.js" async defer></script>
<title>Fancy ToDo (ayusudi)</title>
</head>
<body>
<div class="navbar">
<nav class="navbar navbar-expand-lg navbar-light bg-warning fixed-top">
<a class="navbar-brand" href="#">Fancy Todo Ayusudi</a>
<div class="navbar-nav ml-auto">
<ul style="white-space:nowrap; display:inline;">
<div style="min-width:200px; text-align: right">
<a onclick="signOut()" class="signOut" style="display: none; margin-right:10px ">SignOut </a>
<a onclick="manualSign()" class="signIn" style="margin-right:10px">SignIn </a>
<a onclick="showRegist()" class="regist" style="margin-right:10px">Register </a>
</div>
</ul>
</div>
</nav>
</div>
<div class="errors"
style="display: none; color: rgb(253, 252, 252); background: rgba(0, 0, 0, 0.699); padding: 2% 0 2% 10px; margin-top: 2%">
<h4 style="color: rgb(247, 14, 14)"><b>Errors :</b></h4>
<div class="errorsList">
</div>
</div>
<br>
<div class="beforeLogin">
<div class="container" id="register">
<div class="registerTodo">
<center>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?? ini sudah tidak support di HTML5

<h1>Create an Account</h1>
<br>
<form id="registration_form">
<input type="text" name="name-Register" id="nameRegister" placeholder="Name">
<p class="error_form" id="username_error_message"></p>
<input type="email" name="email-Register" id="emailRegister" placeholder="E-mail">
<p class="error_form" id="email_error_message"></p>
<input type="password" name="pass-Register" id="passRegister" placeholder="Password">
<p class="error_form" id="password_error_message"></p>
<div
style="background-color: rgb(19, 102, 226); width: 100px; height: 40px; border-radius: 6px; padding-top: 2%">
<a href="#" onclick="register()" style="color:white;margin: 15px; margin-top:25px ">Sign Up</a>
</div>
<br>
</form>
</center>
</div>
<br>
<center>
<h5><b>Already have an account?</b>
<br>
<a style="color: yellow; text-decoration: underline" onclick="manualSign()">Sign In Here</a> <br>
or
</h5>
<div class="g-signin2" data-onsuccess="onSignIn"></div>
</center>
<br>
</div>
<br>
<div class="container" id="signin" style="display: none">
<div class="signInTodo">
<center>
<h1>Sign In</h1>
<br>
<form id="sign_form">
<input type="email" name="emailSign" id="emailSign" placeholder="E-mail">
<p class="error_form" id="email_error_message"></p>
<input type="password" name="passSign" id="passSign" placeholder="Password">
<p class="error_form" id="password_error_message"></p>
<div
style="background-color: rgb(19, 102, 226); width: 100px; height: 40px; border-radius: 6px; padding-top: 2%">
<a href="#" onclick="login()" style="color:white;margin: 15px; margin-top:25px ">Sign In</a>
</div>
<br>
</form>
</div>
</center>
<center>
<h5 style="text-decoration: underline"><b>Or</b></h5>
<br>
<div
style="background-color: rgb(11, 191, 223); width: 300px; height: 100px; padding: 10px; border-radius: 15px ">
<h6 style="color: rgb(247, 248, 252);">
Sign in with Google <br>
</h6>
<div class="g-signin2" data-onsuccess="onSignIn"></div>
</div>
</center>
<br>
</div>
<br>
</div>
<div class="afterLogin" style="display: none;">
<h1>hei</h1>
<div class="yourTodo" id="yourTodo">
<h3>HEEEEEOOOO</h3>
</div>
<div class="container" style="display: none">
<h3><mark>Uncompleted</mark></h3>
<div class="uncomplete">
</div>
<br>
<br>
<h3><mark>Completed</mark></h3>
<div class="completed">
</div>
</div>
</div>
<script src="./scripts/user.js"></script>
<script src="./scripts/getTodos.js"></script>
<script src="./scripts/createTodo.js"></script>
<script src="./scripts/showEdit.js"></script>
<script src="./scripts/htmlEmail.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous">
</script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous">
</script>
</body>
</html>
Loading