-
Notifications
You must be signed in to change notification settings - Fork 60
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
Milestone pull request submission #45
Open
empludo
wants to merge
21
commits into
wdi-sg:master
Choose a base branch
from
empludo:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 9 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
9be9c0e
Milestone commit
1fc6418
Update README.md
empludo d7aa89b
Update README.md
empludo 13770f9
Update README.md
empludo 1b1efb0
added gitignore
a266123
minor changes
50b7f76
minor change
d148d5a
1 change
62425e1
1 change
6e6d8c2
heroku test
1ebec2c
added delete function
e7b3ac1
readme stuff
84bbbd4
readme stuff
8374585
minor addons
e230694
updates
fdbfaf2
further changes
2a3a882
authentication
cccb878
minor change
147006f
upload
acc9a4c
Update README.md
empludo 9ac206e
Update README.md
empludo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
const bodyParser = require('body-parser') | ||
const cookieParser = require('cookie-parser') | ||
const express = require('express') | ||
const app = express() | ||
const session = require('express-session') | ||
const expressValidator = require('express-validator') | ||
const methodOverride = require('method-override') | ||
const mongoose = require('mongoose') | ||
const exphbs = require('express-handlebars') | ||
const path = require('path') | ||
const server = require("http").createServer(app)//sockets | ||
const io = require("socket.io")(server) | ||
const flash = require('connect-flash') | ||
const passport = require('passport') | ||
const port = process.env.PORT || 3000 | ||
|
||
const routes = require('./routes/routes') | ||
const dbConfig = require('./config/dbConfig') | ||
|
||
//db Configuration | ||
mongoose.Promise = global.Promise | ||
mongoose.connect(dbConfig.url, { useMongoClient : true }) | ||
.then(()=>{ console.log("-- Mongoose ok ---")}, (err) =>{ console.log(err) } ) | ||
|
||
app.use(cookieParser()); // read cookies (needed for auth) | ||
app.use(bodyParser.json())// get information from html forms | ||
app.use(bodyParser.urlencoded({ extended: true })) | ||
|
||
app.use(express.static(path.join(__dirname, 'public'))) //Set static path to public | ||
app.engine('handlebars', exphbs({ defaultLayout: 'main'})) | ||
app.set('view engine', 'handlebars') | ||
|
||
app.use(session({ secret: 'cogitoergoest', resave: false, | ||
saveUninitialized: true })); // session secret | ||
|
||
//Routes | ||
app.use('/', routes) | ||
|
||
|
||
app.listen(port, ()=>{ | ||
console.log('express-connected'); | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
"url" : "mongodb://localhost/ztest" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const User = require('../models/user') | ||
|
||
exports.login = (req, res) => { | ||
res.render('users/login') | ||
} | ||
|
||
exports.register = (req, res) => { | ||
res.render('users/register') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
// const User = require('../models/user'); | ||
|
||
//Index Home page | ||
exports.index = (req, res)=>{ | ||
res.render('home') | ||
} | ||
|
||
exports.positions = (req, res)=>{ | ||
res.render('positions') | ||
} | ||
|
||
exports.summary = (req, res)=>{ | ||
res.render('summary') | ||
} | ||
|
||
//Index Home page | ||
exports.home = (req, res)=>{ | ||
|
||
res.render('home') | ||
} |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const mongoose = require('mongoose') | ||
const Schema = mongoose.Schema | ||
|
||
const userSchema = new Schema({ | ||
name: { | ||
type: String, | ||
required: [true, 'Please type in your name'] | ||
}, | ||
email: { | ||
type: String, | ||
required: [true, 'Please type in your email'] | ||
}, | ||
password: { | ||
type: String, | ||
required: true | ||
} | ||
}) | ||
|
||
const User = mongoose.model('User', userSchema) | ||
module.exports = User |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,26 @@ | ||
{ | ||
"name": "project-2", | ||
"name": "ztest", | ||
"version": "1.0.0", | ||
"main": "index.js", | ||
"repository": "https://github.com/wdi-sg/project-2.git", | ||
"author": "Prima Aulia Gusta <primaulia@gmail.com>", | ||
"license": "MIT" | ||
"main": "app.js", | ||
"author": "fuckoff", | ||
"license": "MIT", | ||
"scripts": { | ||
"start": "node app.js" | ||
}, | ||
"dependencies": { | ||
"bcrypt": "^1.0.3", | ||
"body-parser": "^1.18.2", | ||
"bulma": "^0.6.1", | ||
"connect-flash": "^0.1.1", | ||
"cookie-parser": "^1.4.3", | ||
"express": "^4.16.2", | ||
"express-handlebars": "^3.0.0", | ||
"express-session": "^1.15.6", | ||
"express-validator": "^4.3.0", | ||
"method-override": "^2.3.10", | ||
"mongoose": "^4.13.7", | ||
"passport": "^0.4.0", | ||
"passport-local": "^1.0.0", | ||
"socket.io": "^2.0.4" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const express = require('express') | ||
const router = express.Router() | ||
|
||
//Controllers | ||
const homeController = require('../controllers/homeController.js') | ||
const authController = require('../controllers/authController.js') | ||
|
||
//Routes | ||
router.get('/', homeController.home) | ||
router.get('/positions',homeController.positions) | ||
router.get('/summary', homeController.summary) | ||
|
||
router.get('/users/login', authController.login) | ||
router.get('/users/register', authController.register) | ||
|
||
|
||
|
||
module.exports = router |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
|
||
<div class="container"> | ||
<h3 >Welcome </h3> | ||
|
||
A simple portfolio manager to help manage your investments | ||
|
||
<p > | ||
<br>Track your portfolio of stocks in real-time | ||
</p> | ||
|
||
|
||
</div> | ||
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Pirated Trade Hero Wannabe</title> | ||
|
||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
|
||
|
||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.6.1/css/bulma.min.css"> | ||
<body> | ||
|
||
<nav | ||
class="navbar is-dark" role="navigation" aria-label="main navigation" | ||
|
||
> | ||
<div class="navbar-brand"> | ||
|
||
<a class="navbar-item" href="/">Investment Assistant</a> | ||
|
||
</div> | ||
|
||
<div class="navbar-menu"> | ||
<div class="navbar-start"> | ||
<a class="navbar-item" href="/">Home</a> | ||
<a class="navbar-item" href="/summary">Summary</a> | ||
<a class="navbar-item" href="/positions">Stock Positions</a> | ||
|
||
</div> | ||
|
||
<div class="navbar-end"> | ||
<a class="navbar-item" href="/users/register">Register</a> | ||
<a class="navbar-item" href="/users/login">Login</a> | ||
|
||
</div> | ||
</div> | ||
</nav> | ||
<div > | ||
{{{ body }}} | ||
</div> | ||
<footer class="footer"> | ||
<div class="container"> | ||
<div class="content has-text-centered"> | ||
<p> | ||
Copyright 2017. API by <a href="https://www.alphavantage.co/">Alpha Vantage</a> | ||
</p> | ||
</div> | ||
</div> | ||
</footer> | ||
|
||
|
||
|
||
|
||
|
||
<script src="https://code.jquery.com/jquery-3.2.1.min.js" charset="utf-8"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.0/Chart.bundle.min.js" charset="utf-8"></script> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<br> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Try to reduce the usage of |
||
<strong>Positions Taken </strong> | ||
<br> | ||
<form action="/positions" method="post"> | ||
<label for="name">Name</label> | ||
<input type="text" name="position[name]" placeholder=""> | ||
|
||
<label for="ticker">Ticker Symbol</label> | ||
<input type="text" name="position[ticker]" placeholder=""> | ||
|
||
<label for="units">Unit Quantity</label> | ||
<input type="number" name="position[units]" placeholder=""> | ||
|
||
<label for="price">Price</label> | ||
<input type="number" name="position[price]" placeholder="USD"> | ||
|
||
<label for="buyDate">Buy Date</label> | ||
<input type="date" name="position[buyDate]" placeholder="dd/mm/yyyy"> | ||
|
||
|
||
|
||
|
||
<br> | ||
|
||
|
||
|
||
<br> | ||
<label for="closingPrice">Closing price</label> | ||
<input type="number" name="position[closingPrice]" placeholder="USD"> | ||
|
||
<button type="submit" name="button">Buy</button> | ||
|
||
</form> | ||
|
||
|
||
<table > | ||
|
||
<thead> | ||
<tr> | ||
<th>Name</th> | ||
<th>Ticker</th> | ||
<th>Buy date</th> | ||
<th>Sell date </th> | ||
<th>Units owned</th> | ||
<th>Price</th> | ||
<th>Amount Invested <br> (USD)</th> | ||
<th>Closing Price</th> | ||
<th>Current Price <br> (USD)</th> | ||
|
||
</tr> | ||
|
||
</thead> | ||
|
||
|
||
<tr> | ||
|
||
<th>Total Value</th> | ||
|
||
</tr> | ||
|
||
|
||
</table> | ||
|
||
<a href="/summary">Portfolio Summary</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<br> | ||
<strong>Portfolio Summary</strong> | ||
|
||
|
||
<table > | ||
|
||
<thead > | ||
<tr> | ||
<th>Total amount invested <br> (USD)</th> | ||
<th>Current Portfolio Value <br> (USD) </th> | ||
<th>Total Gain(Loss) <br> (USD) </th> | ||
|
||
|
||
</tr> | ||
</thead> | ||
|
||
|
||
|
||
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<strong>Login</strong> | ||
|
||
<form action="/login" method="post"> | ||
<br> | ||
|
||
|
||
<label for="email">Email :</label> | ||
|
||
<input type="email" name="user[email]" placeholder="e.g. ebereiweala@gmail.com"> | ||
<br> | ||
|
||
<label for="password">Password :</label> | ||
|
||
<input type="password" name="user[password]" placeholder="password"> | ||
<br> | ||
|
||
<button type="submit" name="button">Submit</button> | ||
</form> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this plugin for?