Skip to content

Commit

Permalink
add new condition in Terms of Conditions (#938)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
3 people authored Nov 15, 2024
1 parent 5b6abd6 commit 175271b
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 29 deletions.
12 changes: 6 additions & 6 deletions docs/api/api_data.js

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions docs/api/api_data.json

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions middlewares/validators/hacker.validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ module.exports = {
"application.other.ethnicity",
false
),
VALIDATOR.booleanValidator(
"body",
"application.other.sendEmail",
true
),
VALIDATOR.booleanValidator(
"body",
"application.other.privacyPolicy",
Expand Down Expand Up @@ -256,6 +261,11 @@ module.exports = {
"application.other.country",
false
),
VALIDATOR.booleanValidator(
"body",
"application.other.sendEmail",
true
),
VALIDATOR.booleanValidator(
"body",
"application.other.privacyPolicy",
Expand Down
12 changes: 11 additions & 1 deletion middlewares/validators/validator.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,8 @@ function applicationValidator(fieldLocation, fieldname, optional = true) {
ethnicity: false,
country: false,
codeOfConduct: false,
privacyPolicy: false
privacyPolicy: false,
sendEmail: false
};

if (optional) {
Expand Down Expand Up @@ -447,6 +448,9 @@ function applicationValidator(fieldLocation, fieldname, optional = true) {
hasValid.privacyPolicy = app.other.hasOwnProperty(
"privacyPolicy"
);
hasValid.sendEmail = app.other.hasOwnProperty(
"sendEmail"
);
}
// hasValid.github =
// !app.general.URL.github ||
Expand Down Expand Up @@ -499,6 +503,9 @@ function applicationValidator(fieldLocation, fieldname, optional = true) {
hasValid.shirtSize &&
hasValid.other &&
hasValid.ethnicity &&
hasValid.sendEmail &&
hasValid.country &&
hasValid.sendEmail &&
hasValid.country &&
hasValid.privacyPolicy &&
hasValid.codeOfConduct
Expand Down Expand Up @@ -555,6 +562,9 @@ function applicationValidator(fieldLocation, fieldname, optional = true) {
hasValid.privacyPolicy = app.other.hasOwnProperty(
"privacyPolicy"
);
hasValid.sendEmail = app.other.hasOwnProperty(
"sendEmail"
);
}
// hasValid.github =
// !app.general.URL.github ||
Expand Down
6 changes: 6 additions & 0 deletions models/hacker.model.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,16 @@ const HackerSchema = new mongoose.Schema({
],
required: true
},
sendEmail: {
type: Boolean
},
country: {
type: String,
required: true
},
sendEmail: {
type: Boolean
},
privacyPolicy: {
type: Boolean,
required: true
Expand Down
1 change: 1 addition & 0 deletions routes/api/hacker.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ module.exports = {
"other:" {
"gender": "male",
"ethnicity": "Asian or Pacific Islander",
"sendEmail": true,
"country": "Canada",
"privacyPolicy": true,
"codeOfConduct": true,
Expand Down
48 changes: 32 additions & 16 deletions tests/util/hacker.test.util.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ const TeamHacker0 = {
ethnicity: ["Native American"],
country: "Canada",
codeOfConduct: true,
privacyPolicy: true
privacyPolicy: true,
sendEmail: true
},
accommodation: {
dietaryRestrictions: ["Gluten-Free"],
Expand Down Expand Up @@ -84,7 +85,8 @@ const TeamHacker1 = {
ethnicity: ["European"],
country: "Canada",
codeOfConduct: true,
privacyPolicy: true
privacyPolicy: true,
sendEmail: false
},
accommodation: {
dietaryRestrictions: ["Gluten-Free"],
Expand Down Expand Up @@ -127,7 +129,8 @@ const TeamHacker2 = {
ethnicity: ["European"],
country: "Canada",
codeOfConduct: true,
privacyPolicy: true
privacyPolicy: true,
sendEmail: true
},
accommodation: {
dietaryRestrictions: ["Gluten-Free"],
Expand Down Expand Up @@ -170,7 +173,8 @@ const TeamHacker3 = {
ethnicity: ["European"],
country: "Canada",
codeOfConduct: true,
privacyPolicy: true
privacyPolicy: true,
sendEmail: false
},
accommodation: {
dietaryRestrictions: ["Gluten-Free"],
Expand Down Expand Up @@ -213,7 +217,8 @@ const TeamHacker4 = {
ethnicity: ["European"],
country: "Canada",
codeOfConduct: true,
privacyPolicy: true
privacyPolicy: true,
sendEmail: true
},
accommodation: {
dietaryRestrictions: ["Gluten-Free"],
Expand Down Expand Up @@ -256,7 +261,8 @@ const NoTeamHacker0 = {
ethnicity: ["European"],
country: "Canada",
codeOfConduct: true,
privacyPolicy: true
privacyPolicy: true,
sendEmail: true
},
accommodation: {
dietaryRestrictions: ["Gluten-Free"],
Expand Down Expand Up @@ -296,7 +302,8 @@ const newHacker0 = {
ethnicity: ["Caucasian"],
country: "Canada",
codeOfConduct: true,
privacyPolicy: true
privacyPolicy: true,
sendEmail: true
},
accommodation: {
dietaryRestrictions: ["Gluten-Free"],
Expand Down Expand Up @@ -336,7 +343,8 @@ const newHacker1 = {
ethnicity: ["African American"],
country: "Canada",
codeOfConduct: true,
privacyPolicy: true
privacyPolicy: true,
sendEmail: false
},
accommodation: {
dietaryRestrictions: ["Gluten-Free"],
Expand Down Expand Up @@ -378,7 +386,8 @@ const invalidHacker0 = {
country: "Canada",
// must accept code of conduct to be valid
codeOfConduct: false,
privacyPolicy: false
privacyPolicy: false,
sendEmail: true
},
accommodation: {
dietaryRestrictions: ["Gluten-Free"],
Expand Down Expand Up @@ -415,7 +424,8 @@ const invalidHacker1 = {
ethnicity: ["Caucasian"],
country: "Canada",
codeOfConduct: true,
privacyPolicy: true
privacyPolicy: true,
sendEmail: true
},
accommodation: {
dietaryRestrictions: ["Gluten-Free"],
Expand Down Expand Up @@ -458,7 +468,8 @@ const invalidHacker2 = {
ethnicity: ["Caucasian"],
country: "Canada",
codeOfConduct: true,
privacyPolicy: true
privacyPolicy: true,
sendEmail: false
},
accommodation: {
dietaryRestrictions: ["Gluten-Free"],
Expand Down Expand Up @@ -500,7 +511,8 @@ const invalidHacker3 = {
ethnicity: ["Caucasian"],
country: "Canada",
codeOfConduct: true,
privacyPolicy: true
privacyPolicy: true,
sendEmail: true
},
accommodation: {
dietaryRestrictions: ["Gluten-Free"],
Expand Down Expand Up @@ -543,7 +555,8 @@ const duplicateAccountLinkHacker0 = {
ethnicity: ["Caucasian"],
country: "Canada",
codeOfConduct: true,
privacyPolicy: true
privacyPolicy: true,
sendEmail: false
},
accommodation: {
dietaryRestrictions: ["Gluten-Free"],
Expand Down Expand Up @@ -585,7 +598,8 @@ const waitlistedHacker0 = {
ethnicity: ["European"],
country: "Canada",
codeOfConduct: true,
privacyPolicy: true
privacyPolicy: true,
sendEmail: true
},
accommodation: {
dietaryRestrictions: ["Gluten-Free"],
Expand Down Expand Up @@ -628,7 +642,8 @@ const unconfirmedAccountHacker0 = {
ethnicity: ["European"],
country: "Canada",
codeOfConduct: true,
privacyPolicy: true
privacyPolicy: true,
sendEmail: false
},
accommodation: {
dietaryRestrictions: ["Gluten-Free"],
Expand Down Expand Up @@ -670,7 +685,8 @@ const unconfirmedAccountHacker1 = {
ethnicity: ["European"],
country: "Canada",
codeOfConduct: true,
privacyPolicy: true
privacyPolicy: true,
sendEmail: true
},
accommodation: {
dietaryRestrictions: ["Gluten-Free"],
Expand Down

0 comments on commit 175271b

Please sign in to comment.