Skip to content

Commit 3cfc560

Browse files
authored
Feat/669 previous hackathons [UPDATED] (#672)
* fix: change type of previousHackathons from enum to number * fix: change previousHackathons to enum of numbers * fix: fix failing tests and restore package.json
1 parent 61266c2 commit 3cfc560

File tree

8 files changed

+41
-41
lines changed

8 files changed

+41
-41
lines changed

constants/general.constant.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ const SPONSOR_T5 = "SponsorT5";
7676
// Enums (must match with frontend)
7777
const JOB_INTERESTS = ["Internship", "Full Time", "None"];
7878
const SHIRT_SIZES = ["XS", "S", "M", "L", "XL", "XXL"];
79-
const HACKATHONS_COUNT = ["0", "1", "2", "3", "4", "5+"];
79+
const PREVIOUS_HACKATHONS = [0, 1, 2, 3, 4, 5];
8080

8181
const ROLE_CATEGORIES = {
8282
SELF: ":self",
@@ -190,7 +190,7 @@ module.exports = {
190190
REQUEST_TYPES: REQUEST_TYPES,
191191
JOB_INTERESTS: JOB_INTERESTS,
192192
SHIRT_SIZES: SHIRT_SIZES,
193-
HACKATHONS_COUNT: HACKATHONS_COUNT,
193+
PREVIOUS_HACKATHONS: PREVIOUS_HACKATHONS,
194194
USER_TYPES: USER_TYPES,
195195
SPONSOR_TIERS: SPONSOR_TIERS,
196196
EXTENDED_USER_TYPES: EXTENDED_USER_TYPES,

docs/api/api_data.js

Lines changed: 6 additions & 6 deletions
Large diffs are not rendered by default.

docs/api/api_data.json

Lines changed: 6 additions & 6 deletions
Large diffs are not rendered by default.

middlewares/validators/hacker.validator.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ module.exports = {
9797
VALIDATOR.enumValidator(
9898
"body",
9999
"application.shortAnswer.previousHackathons",
100-
Constants.HACKATHONS_COUNT,
100+
Constants.PREVIOUS_HACKATHONS,
101101
false
102102
),
103103

@@ -225,7 +225,7 @@ module.exports = {
225225
VALIDATOR.enumValidator(
226226
"body",
227227
"application.shortAnswer.previousHackathons",
228-
Constants.HACKATHONS_COUNT,
228+
Constants.PREVIOUS_HACKATHONS,
229229
false
230230
),
231231

middlewares/validators/validator.helper.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ function applicationValidator(fieldLocation, fieldname, optional = true) {
478478
// typeof app.shortAnswer.question2 === "string";
479479
// hasValid.previousHackathons =
480480
// !!app.shortAnswer.previousHackathons &&
481-
// typeof app.shortAnswer.previousHackathons === "string";
481+
// typeof app.shortAnswer.previousHackathons === "number";
482482
// hasValid.team =
483483
// !app.team || mongoose.Types.ObjectId.isValid(app.team);
484484

@@ -584,7 +584,7 @@ function applicationValidator(fieldLocation, fieldname, optional = true) {
584584
// typeof app.shortAnswer.question2 === "string";
585585
// hasValid.previousHackathons =
586586
// !!app.shortAnswer.previousHackathons &&
587-
// typeof app.shortAnswer.previousHackathons === "string";
587+
// typeof app.shortAnswer.previousHackathons === "number";
588588
// hasValid.team =
589589
// !app.team || mongoose.Types.ObjectId.isValid(app.team);
590590
return (

models/hacker.model.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ const HackerSchema = new mongoose.Schema({
8888
required: true
8989
},
9090
previousHackathons: {
91-
type: String,
92-
enum: Constants.HACKATHONS_COUNT,
91+
type: Number,
92+
enum: Constants.PREVIOUS_HACKATHONS,
9393
required: true
9494
}
9595
},

routes/api/hacker.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ module.exports = {
116116
"skills":["Javascript","Typescript"],
117117
"question1": "I love McHacks",
118118
"question2":"Pls accept me",
119-
"previousHackathons": "5+",
119+
"previousHackathons": "5",
120120
"comments":"hi!",
121121
},
122122
"other:" {
@@ -159,7 +159,7 @@ module.exports = {
159159
"skills":["Javascript","Typescript"],
160160
"question1": "I love McHacks",
161161
"question2":"Pls accept me",
162-
"previousHackathons": "5+",
162+
"previousHackathons": "5",
163163
"comments":"hi!",
164164
},
165165
"other:" {
@@ -449,7 +449,7 @@ module.exports = {
449449
"skills":["Javascript","Typescript"],
450450
"question1": "I love McHacks",
451451
"question2":"Pls accept me",
452-
"previousHackathons": "5+",
452+
"previousHackathons": "5",
453453
"comments":"hi!",
454454
},
455455
"other:" {
@@ -492,7 +492,7 @@ module.exports = {
492492
"skills":["Javascript","Typescript"],
493493
"question1": "I love McHacks",
494494
"question2":"Pls accept me",
495-
"previousHackathons": "5+",
495+
"previousHackathons": "5",
496496
"comments":"hi!",
497497
},
498498
"other:" {
@@ -564,7 +564,7 @@ module.exports = {
564564
"skills":["Javascript","Typescript"],
565565
"question1": "I love McHacks",
566566
"question2":"Pls accept me",
567-
"previousHackathons": "5+",
567+
"previousHackathons": "5",
568568
"comments":"hi!",
569569
},
570570
"other:" {
@@ -632,7 +632,7 @@ module.exports = {
632632
"skills":["Javascript","Typescript"],
633633
"question1": "I love McHacks",
634634
"question2":"Pls accept me",
635-
"previousHackathons": "5+",
635+
"previousHackathons": "5",
636636
"comments":"hi!",
637637
},
638638
"other:" {

tests/util/hacker.test.util.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const TeamHacker0 = {
3535
skills: ["CSS", "HTML", "JS"],
3636
question1: "a",
3737
question2: "a",
38-
previousHackathons: "1"
38+
previousHackathons: 1
3939
},
4040
other: {
4141
ethnicity: ["Native American"],
@@ -76,7 +76,7 @@ const TeamHacker1 = {
7676
skills: ["CSS", "HTML", "JS"],
7777
question1: "a",
7878
question2: "a",
79-
previousHackathons: "2"
79+
previousHackathons: 2
8080
},
8181
other: {
8282
ethnicity: ["European"],
@@ -117,7 +117,7 @@ const TeamHacker2 = {
117117
skills: ["CSS", "HTML", "JS"],
118118
question1: "a",
119119
question2: "a",
120-
previousHackathons: "3"
120+
previousHackathons: 3
121121
},
122122
other: {
123123
ethnicity: ["European"],
@@ -158,7 +158,7 @@ const TeamHacker3 = {
158158
skills: ["CSS", "HTML", "JS"],
159159
question1: "a",
160160
question2: "a",
161-
previousHackathons: "4"
161+
previousHackathons: 4
162162
},
163163
other: {
164164
ethnicity: ["European"],
@@ -199,7 +199,7 @@ const TeamHacker4 = {
199199
skills: ["CSS", "HTML", "JS"],
200200
question1: "a",
201201
question2: "a",
202-
previousHackathons: "5+"
202+
previousHackathons: 5
203203
},
204204
other: {
205205
ethnicity: ["European"],
@@ -240,7 +240,7 @@ const NoTeamHacker0 = {
240240
skills: ["CSS", "HTML", "JS"],
241241
question1: "a",
242242
question2: "a",
243-
previousHackathons: "1"
243+
previousHackathons: 1
244244
},
245245
other: {
246246
ethnicity: ["European"],
@@ -278,7 +278,7 @@ const newHacker0 = {
278278
skills: ["CSS", "HTML", "JS"],
279279
question1: "a",
280280
question2: "a",
281-
previousHackathons: "2"
281+
previousHackathons: 2
282282
},
283283
other: {
284284
ethnicity: ["Caucasian"],
@@ -316,7 +316,7 @@ const newHacker1 = {
316316
skills: ["CSS", "HTML", "JS"],
317317
question1: "a",
318318
question2: "a",
319-
previousHackathons: "3"
319+
previousHackathons: 3
320320
},
321321
other: {
322322
ethnicity: ["African American"],
@@ -355,7 +355,7 @@ const invalidHacker0 = {
355355
skills: ["CSS", "HTML", "JS"],
356356
question1: "a",
357357
question2: "a",
358-
previousHackathons: "4"
358+
previousHackathons: 4
359359
},
360360
other: {
361361
ethnicity: ["Caucasian"],
@@ -391,7 +391,7 @@ const invalidHacker1 = {
391391
skills: ["CSS", "HTML", "JS"],
392392
question1: "a",
393393
question2: "a",
394-
previousHackathons: "5+"
394+
previousHackathons: 5
395395
},
396396
other: {
397397
ethnicity: ["Caucasian"],
@@ -430,7 +430,7 @@ const invalidHacker2 = {
430430
skills: ["CSS", "HTML", "JS"],
431431
question1: "a",
432432
question2: "a",
433-
previousHackathons: "1"
433+
previousHackathons: 1
434434
},
435435
other: {
436436
ethnicity: ["Caucasian"],
@@ -471,7 +471,7 @@ const duplicateAccountLinkHacker0 = {
471471
skills: ["CSS", "HTML", "JS"],
472472
question1: "a",
473473
question2: "a",
474-
previousHackathons: "2"
474+
previousHackathons: 2
475475
},
476476
other: {
477477
ethnicity: ["Caucasian"],
@@ -511,7 +511,7 @@ const waitlistedHacker0 = {
511511
skills: ["CSS", "HTML", "JS"],
512512
question1: "a",
513513
question2: "a",
514-
previousHackathons: "3"
514+
previousHackathons: 3
515515
},
516516
other: {
517517
ethnicity: ["European"],
@@ -552,7 +552,7 @@ const unconfirmedAccountHacker0 = {
552552
skills: ["CSS", "HTML", "JS"],
553553
question1: "a",
554554
question2: "a",
555-
previousHackathons: "4"
555+
previousHackathons: 4
556556
},
557557
other: {
558558
ethnicity: ["European"],
@@ -592,7 +592,7 @@ const unconfirmedAccountHacker1 = {
592592
skills: ["CSS", "HTML", "JS"],
593593
question1: "a",
594594
question2: "a",
595-
previousHackathons: "5+"
595+
previousHackathons: 5
596596
},
597597
other: {
598598
ethnicity: ["European"],

0 commit comments

Comments
 (0)