Skip to content

Commit e90b091

Browse files
Merge pull request #197 from WebJamApps/dev
Promote for IPU Release
2 parents 11ed0b9 + 63d8a0a commit e90b091

File tree

11 files changed

+182
-67
lines changed

11 files changed

+182
-67
lines changed

auth/google.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const peopleApiUrl = 'https://www.googleapis.com/plus/v1/people/me/openIdConnect
77

88
class Google {
99
static authenticate(req, res) {
10-
console.log(req);
10+
console.log(req.body);
1111
const params = {
1212
code: req.body.code,
1313
client_id: req.body.clientId,
@@ -38,6 +38,7 @@ class Google {
3838
const user = new User();
3939
user.name = profile.name;
4040
user.email = profile.email;
41+
user.isOhafUser = req.body.isOhafUser;
4142
user.save((err) => {
4243
console.log('token sent');
4344
res.send({ token: authUtils.createJWT(user) });

circle.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
machine:
22
node:
3-
version: 8.4.0
3+
version: 8.5.0
44
dependencies:
55
pre:
66
- npm install -g istanbul yarn codeclimate-test-reporter

lib/router-base.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
const Router = require('express').Router;
2+
const router = new Router();
3+
4+
module.exports = router;

model/charity/charity-router.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const controller = require('./charity-controller');
2-
const Router = require('express').Router;
3-
const router = new Router();
2+
// const Router = require('express').Router;
3+
const router = require('../../lib/router-base');
44

55
router.route('/create')
66
.post((...args) => controller.create(...args));

model/signup/signup-controller.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const Controller = require('../../lib/controller');
22
const signupModel = require('./signup-facade');
33

44
class SignupController extends Controller {
5-
find(req, res, next) {
5+
findByUserId(req, res, next) {
66
console.log('this is the user id: ' + req.params.id);
77
return this.model.find({ userId:req.params.id })
88
.then((collection) => {
@@ -32,6 +32,18 @@ class SignupController extends Controller {
3232
});
3333
}
3434

35+
removeByUserId(req, res, next) {
36+
console.log('this is the user id: ' + req.params.id);
37+
return this.model.remove({ userId:req.params.id })
38+
.then((doc) => {
39+
console.log(doc);
40+
// if (!doc) {
41+
// return res.status(404).send({ message: 'Delete id is invalid' });
42+
// }
43+
return res.status(204).end();
44+
});
45+
}
46+
3547
}
3648

3749
module.exports = new SignupController(signupModel);

model/signup/signup-router.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,15 @@ const router = new Router();
55
// router.route('/')
66
// .post((...args) => controller.find(...args));
77
//
8+
router.route('/getall')
9+
.get((...args) => controller.find(...args));
10+
11+
router.route('/remove/:id')
12+
.delete((...args) => controller.removeByUserId(...args));
13+
814
router.route('/:id')
915
// .put((...args) => controller.update(...args))
10-
.get((...args) => controller.find(...args)) // this is the user id
16+
.get((...args) => controller.findByUserId(...args)) // this is the user id
1117
.delete((...args) => controller.remove(...args)); // this is the event id
1218

1319
router.route('/create')

model/user/user-schema.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@ const Schema = mongoose.Schema;
55
const userSchema = new Schema({
66
name: { type: String, required: true },
77
email: { type: String, required: true, unique: true },
8+
isOhafUser: { type: Boolean, required: false },
89
userPhone: { type: Number, required: false },
910
userType: { type: String, required: false },
11+
userStreetAddress: { type: String, required: false },
1012
userCity: { type: String, required: false },
13+
userState: { type: String, required: false },
1114
userZip: { type: String, required: false },
1215
userDetails:{ type: String, required: false },
1316
volTravelDistMiles: { type: Number, required: false },

model/volOpp/volOpp-schema.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const volOppSchema = new Schema({
1111
voZipCode: { type: String, required: false },
1212
voStatus: { type: String, required: false },
1313
voNumPeopleNeeded: { type: Number, required: false },
14+
// voNumPeopleScheduled: { type: Number, required: false },
1415
voDescription: { type: String, required: false },
1516
voWorkTypes: { type: [String], required: false },
1617
voWorkTypeOther: { type: String, required: false },

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{
22
"name": "web-jam-back",
3-
"version": "0.7.1",
3+
"version": "0.7.2",
44
"description": "web-jam.com",
55
"main": "index.js",
66
"engines": {
7-
"node": "8.4.0",
8-
"npm": "5.4.1",
9-
"yarn": "1.0.1"
7+
"node": "8.5.0",
8+
"npm": "5.4.2",
9+
"yarn": "1.0.2"
1010
},
1111
"license": "MIT",
1212
"scripts": {
13-
"preinstall": "npm install -g yarn@1.0.1",
13+
"preinstall": "npm install -g yarn@1.0.2 && npm install -g npm",
1414
"postinstall": "./postinstall.sh",
1515
"dev": "nodemon index.js",
1616
"build:prod": "(cd frontend || exit; npm run vulc && npm start -- build)",

test/functional/signup_crud.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,17 @@ describe('The signup feature', () => {
3939
});
4040
});
4141

42+
it('should get all signups', (done) => {
43+
chai.request(server)
44+
.get('/signup/getall')
45+
.set({ origin: allowedUrl })
46+
.set('authorization', 'Bearer ' + authUtils.createJWT('foo2@example.com'))
47+
.end((err, res) => {
48+
expect(res).to.have.status(200);
49+
done();
50+
});
51+
});
52+
4253
it('should find the signups by event id', (done) => {
4354
chai.request(server)
4455
.get('/signup/event/1223')
@@ -66,6 +77,22 @@ describe('The signup feature', () => {
6677
});
6778
});
6879

80+
it('should delete a signup by user id', (done) => {
81+
const signup2 = new Signup1();
82+
signup2.voloppId = 'foo';
83+
signup2.userId = '12345';
84+
signup2.numPeople = 123;
85+
signup2.save();
86+
chai.request(server)
87+
.delete('/signup/remove/12345')
88+
.set({ origin: allowedUrl })
89+
.set('authorization', 'Bearer ' + authUtils.createJWT('foo2@example.com'))
90+
.end((err, res) => {
91+
expect(res).to.have.status(204);
92+
done();
93+
});
94+
});
95+
6996
// it('should not delete a signup with invalid event id', (done) => {
7097
// const signup2 = new Signup1();
7198
// signup2.voloppId = 'foo';

0 commit comments

Comments
 (0)