-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d52fe63
Showing
4,446 changed files
with
678,762 additions
and
0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
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 @@ | ||
# sports-hub |
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,38 @@ | ||
const express = require('express') | ||
const Model = require('./models') | ||
const session = require('express-session') | ||
const favIcon = require('express-favicon') | ||
const app = express() | ||
const bodyParser = require('body-parser') | ||
|
||
const authLogin = require('./helpers/authLogin') | ||
const Person = require('./routes/person'); | ||
const Agenda = require('./routes/agenda'); | ||
const SportList = require('./routes/sport_list'); | ||
const Login = require('./routes/login'); | ||
const SignUp = require('./routes/signUp'); | ||
const Events = require('./routes/event') | ||
const Logout = require('./routes/logout'); | ||
|
||
app.use(bodyParser.urlencoded({ extended: false })) | ||
app.use(bodyParser.json()) | ||
app.use(session({ | ||
secret: 'key' | ||
})) | ||
|
||
app.set('views', './views') | ||
app.set('view engine', 'ejs') | ||
|
||
app.get('/', authLogin.checkLogin, function (req, res) { | ||
res.render('home') | ||
}) | ||
|
||
app.use('/login', Login) | ||
app.use('/signUp', SignUp) | ||
app.use('/logout', authLogin.checkLoginUser, Logout) | ||
app.use('/people', authLogin.checkLogin, Person) | ||
app.use('/agendas', authLogin.checkLogin, Agenda) | ||
app.use('/sport_lists', authLogin.checkLogin, SportList) | ||
app.use('/events', authLogin.checkLoginUser, Events) | ||
|
||
app.listen(3000, console.log(`Ready.. Set.. GO!`)) |
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 @@ | ||
{ | ||
"development": { | ||
"username": "saibmmag", | ||
"password": "I-by-vjMbyaHQzyfykhhbr3SP4u6zeTv", | ||
"database": "saibmmag", | ||
"host": "baasu.db.elephantsql.com", | ||
"dialect": "postgres" | ||
} | ||
} |
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,25 @@ | ||
function checkLogin(req, res, next) { | ||
let isLogin = req.session.isLogin | ||
// let isLogin = true | ||
if (isLogin) { | ||
next() | ||
} else { | ||
if (req.session.isLoginUser) { | ||
res.redirect('/events') | ||
} else { | ||
res.redirect('/login') | ||
} | ||
} | ||
} | ||
|
||
function checkLoginUser(req, res, next) { | ||
let isLoginUser = req.session.isLoginUser | ||
// let isLoginUser = true | ||
if (isLoginUser) { | ||
next() | ||
} else { | ||
res.redirect('/login') | ||
} | ||
} | ||
|
||
module.exports = {checkLogin, checkLoginUser}; |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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,47 @@ | ||
'use strict' | ||
const api_key = 'key-25fc0a73025b3329627740cc582f9021'; | ||
const domain = 'sandboxb33efd7116d9434ab04cbd7bc49c1833.mailgun.org'; | ||
const mailgun = require('mailgun-js')({apiKey: api_key, domain: domain}); | ||
const emailJoin = require('./email-join'); | ||
const emailFull = require('./email-full-booked'); | ||
|
||
function sendEmailToUser(person,agenda) { | ||
var data = { | ||
from: 'Sports Hub Fuadhi <[email protected]>', | ||
to: person.email, | ||
subject: 'Hello From Sports Hub!!', | ||
html: emailFull(person,agenda) | ||
}; | ||
mailgun.messages().send(data, function (error, body) { | ||
console.log('body ..',body); | ||
console.log('error ..',error); | ||
}); | ||
} | ||
|
||
function sendEmailToHost(person,agenda) { | ||
var data = { | ||
from: 'Sports Hub Fuadhi <[email protected]>', | ||
to: person.email, | ||
subject: 'Hello From Sports Hub!!', | ||
text: `Congrats! Your Hosted Event ${agenda.name} is fully booked` | ||
}; | ||
mailgun.messages().send(data, function (error, body) { | ||
console.log('body ..',body); | ||
console.log('error ..',error); | ||
}); | ||
} | ||
|
||
function sendEmailWhenJoin(person,agenda) { | ||
var data = { | ||
from: 'Sports Hub Fuadhi <[email protected]>', | ||
to: person.email, | ||
subject: 'Hello From Sports Hub!!', | ||
html: emailJoin(person, agenda) | ||
}; | ||
mailgun.messages().send(data, function (error, body) { | ||
console.log('body ..',body); | ||
console.log('error ..',error); | ||
}); | ||
} | ||
|
||
module.exports = {sendEmailToUser: sendEmailToUser, sendEmailToHost: sendEmailToHost, sendEmailWhenJoin: sendEmailWhenJoin}; |
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 @@ | ||
|
||
|
||
// var mailgun = new Mailgun({apiKey: api_key, domain: domain}); | ||
|
||
// var members = [ | ||
// { | ||
// address: "[email protected]" | ||
// } | ||
// ]; | ||
// //For the sake of this tutorial you need to create a mailing list on Mailgun.com/cp/lists and put its address below | ||
// mailgun.lists('[email protected]').members().add({ members: members, subscribed: true }, function (err, body) { | ||
// console.log('bodyyyyyy',body); | ||
// console.log('errrrrrrr',err); | ||
// if (err) { | ||
// console.log("Error - check console"); | ||
// } | ||
// else { | ||
// console.log("Added to mailing list"); | ||
// } | ||
// }); |
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,39 @@ | ||
'use strict'; | ||
module.exports = { | ||
up: (queryInterface, Sequelize) => { | ||
return queryInterface.createTable('People', { | ||
id: { | ||
allowNull: false, | ||
autoIncrement: true, | ||
primaryKey: true, | ||
type: Sequelize.INTEGER | ||
}, | ||
name: { | ||
type: Sequelize.STRING | ||
}, | ||
location: { | ||
type: Sequelize.STRING | ||
}, | ||
email: { | ||
type: Sequelize.STRING | ||
}, | ||
sport_interest: { | ||
type: Sequelize.STRING | ||
}, | ||
phone: { | ||
type: Sequelize.STRING | ||
}, | ||
createdAt: { | ||
allowNull: true, | ||
type: Sequelize.DATE | ||
}, | ||
updatedAt: { | ||
allowNull: true, | ||
type: Sequelize.DATE | ||
} | ||
}); | ||
}, | ||
down: (queryInterface, Sequelize) => { | ||
return queryInterface.dropTable('People'); | ||
} | ||
}; |
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 @@ | ||
'use strict'; | ||
module.exports = { | ||
up: (queryInterface, Sequelize) => { | ||
return queryInterface.createTable('Agendas', { | ||
id: { | ||
allowNull: false, | ||
autoIncrement: true, | ||
primaryKey: true, | ||
type: Sequelize.INTEGER | ||
}, | ||
name: { | ||
type: Sequelize.STRING | ||
}, | ||
place: { | ||
type: Sequelize.STRING | ||
}, | ||
date: { | ||
type: Sequelize.STRING | ||
}, | ||
time: { | ||
type: Sequelize.STRING | ||
}, | ||
max_player: { | ||
type: Sequelize.INTEGER | ||
}, | ||
SportId: { | ||
type: Sequelize.INTEGER | ||
}, | ||
createdAt: { | ||
allowNull: true, | ||
type: Sequelize.DATE | ||
}, | ||
updatedAt: { | ||
allowNull: true, | ||
type: Sequelize.DATE | ||
} | ||
}); | ||
}, | ||
down: (queryInterface, Sequelize) => { | ||
return queryInterface.dropTable('Agendas'); | ||
} | ||
}; |
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,30 @@ | ||
'use strict'; | ||
module.exports = { | ||
up: (queryInterface, Sequelize) => { | ||
return queryInterface.createTable('PeopleAgendas', { | ||
id: { | ||
allowNull: false, | ||
autoIncrement: true, | ||
primaryKey: true, | ||
type: Sequelize.INTEGER | ||
}, | ||
PeopleId: { | ||
type: Sequelize.INTEGER | ||
}, | ||
AgendaId: { | ||
type: Sequelize.INTEGER | ||
}, | ||
createdAt: { | ||
allowNull: true, | ||
type: Sequelize.DATE | ||
}, | ||
updatedAt: { | ||
allowNull: true, | ||
type: Sequelize.DATE | ||
} | ||
}); | ||
}, | ||
down: (queryInterface, Sequelize) => { | ||
return queryInterface.dropTable('PeopleAgendas'); | ||
} | ||
}; |
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,27 @@ | ||
'use strict'; | ||
module.exports = { | ||
up: (queryInterface, Sequelize) => { | ||
return queryInterface.createTable('SportLists', { | ||
id: { | ||
allowNull: false, | ||
autoIncrement: true, | ||
primaryKey: true, | ||
type: Sequelize.INTEGER | ||
}, | ||
name: { | ||
type: Sequelize.STRING | ||
}, | ||
createdAt: { | ||
allowNull: true, | ||
type: Sequelize.DATE | ||
}, | ||
updatedAt: { | ||
allowNull: true, | ||
type: Sequelize.DATE | ||
} | ||
}); | ||
}, | ||
down: (queryInterface, Sequelize) => { | ||
return queryInterface.dropTable('SportLists'); | ||
} | ||
}; |
18 changes: 18 additions & 0 deletions
18
migrations/20180129063046-change_sportId_column_at_agenda.js
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 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
up: (queryInterface, Sequelize) => { | ||
|
||
return queryInterface.renameColumn('Agendas', 'SportId', 'SportListId') | ||
}, | ||
|
||
down: (queryInterface, Sequelize) => { | ||
/* | ||
Add reverting commands here. | ||
Return a promise to correctly handle asynchronicity. | ||
Example: | ||
return queryInterface.dropTable('users'); | ||
*/ | ||
} | ||
}; |
24 changes: 24 additions & 0 deletions
24
migrations/20180129074114-add-column-password-at-people.js
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,24 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
up: (queryInterface, Sequelize) => { | ||
/* | ||
Add altering commands here. | ||
Return a promise to correctly handle asynchronicity. | ||
Example: | ||
*/ | ||
return queryInterface.addColumn('People', 'password', Sequelize.STRING) | ||
}, | ||
|
||
down: (queryInterface, Sequelize) => { | ||
return queryInterface.removeColumn('People', 'password', Sequelize.STRING) | ||
/* | ||
Add reverting commands here. | ||
Return a promise to correctly handle asynchronicity. | ||
Example: | ||
return queryInterface.dropTable('users'); | ||
*/ | ||
} | ||
}; |
24 changes: 24 additions & 0 deletions
24
migrations/20180129105422-rename-column-peopleId-to-PersonId.js
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,24 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
up: (queryInterface, Sequelize) => { | ||
/* | ||
Add altering commands here. | ||
Return a promise to correctly handle asynchronicity. | ||
Example: | ||
return queryInterface.createTable('users', { id: Sequelize.INTEGER }); | ||
*/ | ||
return queryInterface.renameColumn('PeopleAgendas', 'PeopleId', 'PersonId') | ||
}, | ||
|
||
down: (queryInterface, Sequelize) => { | ||
/* | ||
Add reverting commands here. | ||
Return a promise to correctly handle asynchronicity. | ||
Example: | ||
return queryInterface.dropTable('users'); | ||
*/ | ||
} | ||
}; |
25 changes: 25 additions & 0 deletions
25
migrations/20180130083846-add-column-host-id-at-table-agendas.js
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,25 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
up: (queryInterface, Sequelize) => { | ||
/* | ||
Add altering commands here. | ||
Return a promise to correctly handle asynchronicity. | ||
Example: | ||
return queryInterface.createTable('users', { id: Sequelize.INTEGER }); | ||
*/ | ||
return queryInterface.addColumn('Agendas', 'hostId', Sequelize.INTEGER) | ||
}, | ||
|
||
down: (queryInterface, Sequelize) => { | ||
return queryInterface.removeColumn('Agendas', 'hostId', Sequelize.INTEGER) | ||
/* | ||
Add reverting commands here. | ||
Return a promise to correctly handle asynchronicity. | ||
Example: | ||
return queryInterface.dropTable('users'); | ||
*/ | ||
} | ||
}; |
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,11 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
up: (queryInterface, Sequelize) => { | ||
return queryInterface.addColumn('Agendas','bookingId',Sequelize.INTEGER); | ||
}, | ||
|
||
down: (queryInterface, Sequelize) => { | ||
return queryInterface.removeColumn('Agendas','bookingId',Sequelize.INTEGER); | ||
} | ||
}; |
Oops, something went wrong.