Skip to content

Commit 175271b

Browse files
JamieXiaoallennatangtektaxi
authored
add new condition in Terms of Conditions (#938)
* add new condition in Terms of Conditions * Updated package.json with Windows-specific commands * Changed hacker account's 'birthdate' field to 'age' #936 * Changed age type Number to type String * Added country of residence field to hacker application * add new condition in Terms of Conditions --------- Co-authored-by: allennatang <[email protected]> Co-authored-by: Tavi Pollard <[email protected]>
1 parent 5b6abd6 commit 175271b

File tree

7 files changed

+72
-29
lines changed

7 files changed

+72
-29
lines changed

docs/api/api_data.js

+6-6
Large diffs are not rendered by default.

docs/api/api_data.json

+6-6
Large diffs are not rendered by default.

middlewares/validators/hacker.validator.js

+10
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,11 @@ module.exports = {
112112
"application.other.ethnicity",
113113
false
114114
),
115+
VALIDATOR.booleanValidator(
116+
"body",
117+
"application.other.sendEmail",
118+
true
119+
),
115120
VALIDATOR.booleanValidator(
116121
"body",
117122
"application.other.privacyPolicy",
@@ -256,6 +261,11 @@ module.exports = {
256261
"application.other.country",
257262
false
258263
),
264+
VALIDATOR.booleanValidator(
265+
"body",
266+
"application.other.sendEmail",
267+
true
268+
),
259269
VALIDATOR.booleanValidator(
260270
"body",
261271
"application.other.privacyPolicy",

middlewares/validators/validator.helper.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,8 @@ function applicationValidator(fieldLocation, fieldname, optional = true) {
394394
ethnicity: false,
395395
country: false,
396396
codeOfConduct: false,
397-
privacyPolicy: false
397+
privacyPolicy: false,
398+
sendEmail: false
398399
};
399400

400401
if (optional) {
@@ -447,6 +448,9 @@ function applicationValidator(fieldLocation, fieldname, optional = true) {
447448
hasValid.privacyPolicy = app.other.hasOwnProperty(
448449
"privacyPolicy"
449450
);
451+
hasValid.sendEmail = app.other.hasOwnProperty(
452+
"sendEmail"
453+
);
450454
}
451455
// hasValid.github =
452456
// !app.general.URL.github ||
@@ -499,6 +503,9 @@ function applicationValidator(fieldLocation, fieldname, optional = true) {
499503
hasValid.shirtSize &&
500504
hasValid.other &&
501505
hasValid.ethnicity &&
506+
hasValid.sendEmail &&
507+
hasValid.country &&
508+
hasValid.sendEmail &&
502509
hasValid.country &&
503510
hasValid.privacyPolicy &&
504511
hasValid.codeOfConduct
@@ -555,6 +562,9 @@ function applicationValidator(fieldLocation, fieldname, optional = true) {
555562
hasValid.privacyPolicy = app.other.hasOwnProperty(
556563
"privacyPolicy"
557564
);
565+
hasValid.sendEmail = app.other.hasOwnProperty(
566+
"sendEmail"
567+
);
558568
}
559569
// hasValid.github =
560570
// !app.general.URL.github ||

models/hacker.model.js

+6
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,16 @@ const HackerSchema = new mongoose.Schema({
103103
],
104104
required: true
105105
},
106+
sendEmail: {
107+
type: Boolean
108+
},
106109
country: {
107110
type: String,
108111
required: true
109112
},
113+
sendEmail: {
114+
type: Boolean
115+
},
110116
privacyPolicy: {
111117
type: Boolean,
112118
required: true

routes/api/hacker.js

+1
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ module.exports = {
124124
"other:" {
125125
"gender": "male",
126126
"ethnicity": "Asian or Pacific Islander",
127+
"sendEmail": true,
127128
"country": "Canada",
128129
"privacyPolicy": true,
129130
"codeOfConduct": true,

tests/util/hacker.test.util.js

+32-16
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ const TeamHacker0 = {
4141
ethnicity: ["Native American"],
4242
country: "Canada",
4343
codeOfConduct: true,
44-
privacyPolicy: true
44+
privacyPolicy: true,
45+
sendEmail: true
4546
},
4647
accommodation: {
4748
dietaryRestrictions: ["Gluten-Free"],
@@ -84,7 +85,8 @@ const TeamHacker1 = {
8485
ethnicity: ["European"],
8586
country: "Canada",
8687
codeOfConduct: true,
87-
privacyPolicy: true
88+
privacyPolicy: true,
89+
sendEmail: false
8890
},
8991
accommodation: {
9092
dietaryRestrictions: ["Gluten-Free"],
@@ -127,7 +129,8 @@ const TeamHacker2 = {
127129
ethnicity: ["European"],
128130
country: "Canada",
129131
codeOfConduct: true,
130-
privacyPolicy: true
132+
privacyPolicy: true,
133+
sendEmail: true
131134
},
132135
accommodation: {
133136
dietaryRestrictions: ["Gluten-Free"],
@@ -170,7 +173,8 @@ const TeamHacker3 = {
170173
ethnicity: ["European"],
171174
country: "Canada",
172175
codeOfConduct: true,
173-
privacyPolicy: true
176+
privacyPolicy: true,
177+
sendEmail: false
174178
},
175179
accommodation: {
176180
dietaryRestrictions: ["Gluten-Free"],
@@ -213,7 +217,8 @@ const TeamHacker4 = {
213217
ethnicity: ["European"],
214218
country: "Canada",
215219
codeOfConduct: true,
216-
privacyPolicy: true
220+
privacyPolicy: true,
221+
sendEmail: true
217222
},
218223
accommodation: {
219224
dietaryRestrictions: ["Gluten-Free"],
@@ -256,7 +261,8 @@ const NoTeamHacker0 = {
256261
ethnicity: ["European"],
257262
country: "Canada",
258263
codeOfConduct: true,
259-
privacyPolicy: true
264+
privacyPolicy: true,
265+
sendEmail: true
260266
},
261267
accommodation: {
262268
dietaryRestrictions: ["Gluten-Free"],
@@ -296,7 +302,8 @@ const newHacker0 = {
296302
ethnicity: ["Caucasian"],
297303
country: "Canada",
298304
codeOfConduct: true,
299-
privacyPolicy: true
305+
privacyPolicy: true,
306+
sendEmail: true
300307
},
301308
accommodation: {
302309
dietaryRestrictions: ["Gluten-Free"],
@@ -336,7 +343,8 @@ const newHacker1 = {
336343
ethnicity: ["African American"],
337344
country: "Canada",
338345
codeOfConduct: true,
339-
privacyPolicy: true
346+
privacyPolicy: true,
347+
sendEmail: false
340348
},
341349
accommodation: {
342350
dietaryRestrictions: ["Gluten-Free"],
@@ -378,7 +386,8 @@ const invalidHacker0 = {
378386
country: "Canada",
379387
// must accept code of conduct to be valid
380388
codeOfConduct: false,
381-
privacyPolicy: false
389+
privacyPolicy: false,
390+
sendEmail: true
382391
},
383392
accommodation: {
384393
dietaryRestrictions: ["Gluten-Free"],
@@ -415,7 +424,8 @@ const invalidHacker1 = {
415424
ethnicity: ["Caucasian"],
416425
country: "Canada",
417426
codeOfConduct: true,
418-
privacyPolicy: true
427+
privacyPolicy: true,
428+
sendEmail: true
419429
},
420430
accommodation: {
421431
dietaryRestrictions: ["Gluten-Free"],
@@ -458,7 +468,8 @@ const invalidHacker2 = {
458468
ethnicity: ["Caucasian"],
459469
country: "Canada",
460470
codeOfConduct: true,
461-
privacyPolicy: true
471+
privacyPolicy: true,
472+
sendEmail: false
462473
},
463474
accommodation: {
464475
dietaryRestrictions: ["Gluten-Free"],
@@ -500,7 +511,8 @@ const invalidHacker3 = {
500511
ethnicity: ["Caucasian"],
501512
country: "Canada",
502513
codeOfConduct: true,
503-
privacyPolicy: true
514+
privacyPolicy: true,
515+
sendEmail: true
504516
},
505517
accommodation: {
506518
dietaryRestrictions: ["Gluten-Free"],
@@ -543,7 +555,8 @@ const duplicateAccountLinkHacker0 = {
543555
ethnicity: ["Caucasian"],
544556
country: "Canada",
545557
codeOfConduct: true,
546-
privacyPolicy: true
558+
privacyPolicy: true,
559+
sendEmail: false
547560
},
548561
accommodation: {
549562
dietaryRestrictions: ["Gluten-Free"],
@@ -585,7 +598,8 @@ const waitlistedHacker0 = {
585598
ethnicity: ["European"],
586599
country: "Canada",
587600
codeOfConduct: true,
588-
privacyPolicy: true
601+
privacyPolicy: true,
602+
sendEmail: true
589603
},
590604
accommodation: {
591605
dietaryRestrictions: ["Gluten-Free"],
@@ -628,7 +642,8 @@ const unconfirmedAccountHacker0 = {
628642
ethnicity: ["European"],
629643
country: "Canada",
630644
codeOfConduct: true,
631-
privacyPolicy: true
645+
privacyPolicy: true,
646+
sendEmail: false
632647
},
633648
accommodation: {
634649
dietaryRestrictions: ["Gluten-Free"],
@@ -670,7 +685,8 @@ const unconfirmedAccountHacker1 = {
670685
ethnicity: ["European"],
671686
country: "Canada",
672687
codeOfConduct: true,
673-
privacyPolicy: true
688+
privacyPolicy: true,
689+
sendEmail: true
674690
},
675691
accommodation: {
676692
dietaryRestrictions: ["Gluten-Free"],

0 commit comments

Comments
 (0)