Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add new condition in Terms of Conditions #938

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -251,6 +256,11 @@ module.exports = {
"application.other.ethnicity",
false
),
VALIDATOR.booleanValidator(
"body",
"application.other.sendEmail",
true
),
VALIDATOR.booleanValidator(
"body",
"application.other.privacyPolicy",
Expand Down
11 changes: 10 additions & 1 deletion middlewares/validators/validator.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,8 @@ function applicationValidator(fieldLocation, fieldname, optional = true) {
other: false,
ethnicity: false,
codeOfConduct: false,
privacyPolicy: false
privacyPolicy: false,
sendEmail: false
};

if (optional) {
Expand Down Expand Up @@ -445,6 +446,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 @@ -497,6 +501,7 @@ function applicationValidator(fieldLocation, fieldname, optional = true) {
hasValid.shirtSize &&
hasValid.other &&
hasValid.ethnicity &&
hasValid.sendEmail &&
hasValid.privacyPolicy &&
hasValid.codeOfConduct
);
Expand Down Expand Up @@ -551,6 +556,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 @@ -603,6 +611,7 @@ function applicationValidator(fieldLocation, fieldname, optional = true) {
hasValid.shirtSize &&
hasValid.other &&
hasValid.ethnicity &&
hasValid.sendEmail &&
hasValid.privacyPolicy &&
hasValid.codeOfConduct
);
Expand Down
3 changes: 3 additions & 0 deletions models/hacker.model.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ const HackerSchema = new mongoose.Schema({
],
required: true
},
sendEmail: {
type: Boolean
},
privacyPolicy: {
type: Boolean,
required: true
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions routes/api/hacker.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ module.exports = {
"other:" {
"gender": "male",
"ethnicity": "Asian or Pacific Islander",
"sendEmail": true,
"privacyPolicy": true,
"codeOfConduct": true,
}
Expand Down Expand Up @@ -170,6 +171,7 @@ module.exports = {
"other:" {
"gender": "male",
"ethnicity": "Asian or Pacific Islander",
"sendEmail": true,
"privacyPolicy": true,
"codeOfConduct": true,
}
Expand Down Expand Up @@ -466,6 +468,7 @@ module.exports = {
"other:" {
"gender": "male",
"ethnicity": "Asian or Pacific Islander",
"sendEmail": true,
"privacyPolicy": true,
"codeOfConduct": true,
}
Expand Down Expand Up @@ -514,6 +517,7 @@ module.exports = {
"other:" {
"gender": "male",
"ethnicity": "Asian or Pacific Islander",
"sendEmail": true,
"privacyPolicy": true,
"codeOfConduct": true,
}
Expand Down Expand Up @@ -591,6 +595,7 @@ module.exports = {
"other:" {
"gender": "male",
"ethnicity": "Asian or Pacific Islander",
"sendEmail": true,
"privacyPolicy": true,
"codeOfConduct": true,
}
Expand Down Expand Up @@ -664,6 +669,7 @@ module.exports = {
"other:" {
"gender": "male",
"ethnicity": "Asian or Pacific Islander",
"sendEmail": true,
"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 @@ -40,7 +40,8 @@ const TeamHacker0 = {
other: {
ethnicity: ["Native American"],
codeOfConduct: true,
privacyPolicy: true
privacyPolicy: true,
sendEmail: true
},
accommodation: {
dietaryRestrictions: ["Gluten-Free"],
Expand Down Expand Up @@ -82,7 +83,8 @@ const TeamHacker1 = {
other: {
ethnicity: ["European"],
codeOfConduct: true,
privacyPolicy: true
privacyPolicy: true,
sendEmail: false
},
accommodation: {
dietaryRestrictions: ["Gluten-Free"],
Expand Down Expand Up @@ -124,7 +126,8 @@ const TeamHacker2 = {
other: {
ethnicity: ["European"],
codeOfConduct: true,
privacyPolicy: true
privacyPolicy: true,
sendEmail: true
},
accommodation: {
dietaryRestrictions: ["Gluten-Free"],
Expand Down Expand Up @@ -166,7 +169,8 @@ const TeamHacker3 = {
other: {
ethnicity: ["European"],
codeOfConduct: true,
privacyPolicy: true
privacyPolicy: true,
sendEmail: false
},
accommodation: {
dietaryRestrictions: ["Gluten-Free"],
Expand Down Expand Up @@ -208,7 +212,8 @@ const TeamHacker4 = {
other: {
ethnicity: ["European"],
codeOfConduct: true,
privacyPolicy: true
privacyPolicy: true,
sendEmail: true
},
accommodation: {
dietaryRestrictions: ["Gluten-Free"],
Expand Down Expand Up @@ -250,7 +255,8 @@ const NoTeamHacker0 = {
other: {
ethnicity: ["European"],
codeOfConduct: true,
privacyPolicy: true
privacyPolicy: true,
sendEmail: true
},
accommodation: {
dietaryRestrictions: ["Gluten-Free"],
Expand Down Expand Up @@ -289,7 +295,8 @@ const newHacker0 = {
other: {
ethnicity: ["Caucasian"],
codeOfConduct: true,
privacyPolicy: true
privacyPolicy: true,
sendEmail: true
},
accommodation: {
dietaryRestrictions: ["Gluten-Free"],
Expand Down Expand Up @@ -328,7 +335,8 @@ const newHacker1 = {
other: {
ethnicity: ["African American"],
codeOfConduct: true,
privacyPolicy: true
privacyPolicy: true,
sendEmail: false
},
accommodation: {
dietaryRestrictions: ["Gluten-Free"],
Expand Down Expand Up @@ -369,7 +377,8 @@ const invalidHacker0 = {
ethnicity: ["Caucasian"],
// must accept code of conduct to be valid
codeOfConduct: false,
privacyPolicy: false
privacyPolicy: false,
sendEmail: true
},
accommodation: {
dietaryRestrictions: ["Gluten-Free"],
Expand Down Expand Up @@ -405,7 +414,8 @@ const invalidHacker1 = {
other: {
ethnicity: ["Caucasian"],
codeOfConduct: true,
privacyPolicy: true
privacyPolicy: true,
sendEmail: true
},
accommodation: {
dietaryRestrictions: ["Gluten-Free"],
Expand Down Expand Up @@ -447,7 +457,8 @@ const invalidHacker2 = {
other: {
ethnicity: ["Caucasian"],
codeOfConduct: true,
privacyPolicy: true
privacyPolicy: true,
sendEmail: false
},
accommodation: {
dietaryRestrictions: ["Gluten-Free"],
Expand Down Expand Up @@ -488,7 +499,8 @@ const invalidHacker3 = {
other: {
ethnicity: ["Caucasian"],
codeOfConduct: true,
privacyPolicy: true
privacyPolicy: true,
sendEmail: true
},
accommodation: {
dietaryRestrictions: ["Gluten-Free"],
Expand Down Expand Up @@ -530,7 +542,8 @@ const duplicateAccountLinkHacker0 = {
other: {
ethnicity: ["Caucasian"],
codeOfConduct: true,
privacyPolicy: true
privacyPolicy: true,
sendEmail: false
},
accommodation: {
dietaryRestrictions: ["Gluten-Free"],
Expand Down Expand Up @@ -571,7 +584,8 @@ const waitlistedHacker0 = {
other: {
ethnicity: ["European"],
codeOfConduct: true,
privacyPolicy: true
privacyPolicy: true,
sendEmail: true
},
accommodation: {
dietaryRestrictions: ["Gluten-Free"],
Expand Down Expand Up @@ -613,7 +627,8 @@ const unconfirmedAccountHacker0 = {
other: {
ethnicity: ["European"],
codeOfConduct: true,
privacyPolicy: true
privacyPolicy: true,
sendEmail: false
},
accommodation: {
dietaryRestrictions: ["Gluten-Free"],
Expand Down Expand Up @@ -654,7 +669,8 @@ const unconfirmedAccountHacker1 = {
other: {
ethnicity: ["European"],
codeOfConduct: true,
privacyPolicy: true
privacyPolicy: true,
sendEmail: true
},
accommodation: {
dietaryRestrictions: ["Gluten-Free"],
Expand Down
Loading