This repository has been archived by the owner on Aug 14, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(checkin): added full model, base view, base controllers
- Loading branch information
1 parent
127aff5
commit ec8d160
Showing
12 changed files
with
161 additions
and
1 deletion.
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
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 @@ | ||
[ | ||
"Basement Lounge", | ||
"Center Table", | ||
"Glass Conference Room", | ||
"Left Side Table", | ||
"Left Side Lounge", | ||
"Other", | ||
"Right Side Lounge" | ||
] |
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 @@ | ||
[ | ||
"Meetup", | ||
"Friend", | ||
"Event", | ||
"Facebook", | ||
"Twitter", | ||
"Youtube", | ||
"Local Government" | ||
] |
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,35 @@ | ||
[ | ||
"Android (Java)", | ||
"AngularJS", | ||
"C++", | ||
"C#", | ||
"Django", | ||
"GIT", | ||
"Graphic Design", | ||
"Hibernate", | ||
"HTML/CSS", | ||
"iOS (Swift/Objective C)", | ||
"Java", | ||
"Javascript", | ||
"JSON", | ||
"Python", | ||
"Maya LT", | ||
"Marketing", | ||
"Mongo", | ||
"MySQL", | ||
"Node", | ||
".NET", | ||
"PHP", | ||
"Policy Work", | ||
"Project Management", | ||
"R", | ||
"Ruby", | ||
"Ruby on Rails", | ||
"Spring", | ||
"SQL", | ||
"Statistics/Machine Learning", | ||
"UI/UX Design", | ||
"Unity", | ||
"User Testing", | ||
"WordPress" | ||
] |
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,17 @@ | ||
const defaultSkills = require('../../config/defaultSkills.json') | ||
const defaultLocations = require('../../config/defaultLocations.json') | ||
const defaultReferredBy = require('../../config/defaultReferredBy.json') | ||
// TODO(therebelrobot): Move these into manage checkin page | ||
|
||
|
||
module.exports = function getCheckin (req, res, next) { | ||
res.render(res.locals.brigade.theme.slug + '/views/checkin/index', { | ||
title: 'Check in', | ||
view: 'checkin', | ||
brigade: res.locals.brigade, | ||
user: user || {}, | ||
locations: defaultLocations, | ||
skills: defaultSkills, | ||
referredBy: defaultReferredBy | ||
}) | ||
} |
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,4 @@ | ||
module.exports = { | ||
getCheckin: require('./getCheckin'), | ||
postCheckin: require('./postCheckin') | ||
} |
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 = function getCheckin (req, res, next) { | ||
|
||
} |
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 @@ | ||
var mongoose = require('mongoose') | ||
|
||
const Users = require('../Users') | ||
|
||
const schema = require('./schema') | ||
const syncUser = require('./syncUser') | ||
const createUser = require('./createUser') | ||
|
||
var checkinSchema = new mongoose.Schema(schema) | ||
|
||
checkinSchema.post('save', function (doc, next) { | ||
// check username presence + for corresponding user | ||
if (!doc.username || !doc.username.length) return next() | ||
Users.findOne({ username: doc.username }, (err, user) => { | ||
if (err) throw err | ||
if (!user) user = new Users() | ||
syncUser(doc, user).then(next) | ||
}) | ||
}) | ||
|
||
module.exports = mongoose.model('Checkins', checkinSchema) |
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 @@ | ||
module.exports = { | ||
date: { type: Date }, | ||
name: { type: String, default: '' }, | ||
email: { type: String, default: '' }, | ||
githubUsername: { type: String, default: '' }, // if present, sync to user model | ||
teams: { type: Array, default: [] }, | ||
mailingList: { type: Boolean, default: false }, | ||
referredBy: { type: String, default: '' }, | ||
skills: { type: Array, default: [] }, | ||
lead: { | ||
expectedAttendance: { type: Number, default: 0 }, | ||
reserve: { type: String, default: '' } | ||
} | ||
} |
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 @@ | ||
module.exports = function syncUser (doc, user) { | ||
return new Promise((resolve, reject) => { | ||
if(!user.username) user.username = doc.username // handle new account creation | ||
user.name = doc.name | ||
user.teams.projects = [ | ||
...user.teams.projects, | ||
doc.projects | ||
] | ||
user.lastCheckin = doc.date | ||
user.email = doc.email | ||
user.mailingList = doc.mailingList | ||
user.referredBy = doc.referredBy | ||
user.skills = doc.skills | ||
user.save(err => { | ||
if (err) return reject(err) | ||
resolve(doc) | ||
}) | ||
}) | ||
} |
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,16 @@ | ||
extends ../layout | ||
|
||
block content | ||
.row.breadcrumbs | ||
.col-sm-12 | ||
a(href='/')= brigade.name | ||
| / | ||
a(href='/checkin') Check In | ||
.row.page-header | ||
.col-sm-12 | ||
h1.page-title Hack Night Check In | ||
.row | ||
hr | ||
.container | ||
.row | ||
| Test Content here |