Skip to content

Commit ecb3acc

Browse files
authored
feat: Hacker location fields (#687)
* feat: add additional optional fields for hacker location * feat: update documentation to include hacker location
1 parent c279192 commit ecb3acc

File tree

5 files changed

+8353
-5
lines changed

5 files changed

+8353
-5
lines changed

docs/api/api_data.js

Lines changed: 4150 additions & 1 deletion
Large diffs are not rendered by default.

docs/api/api_data.json

Lines changed: 4150 additions & 1 deletion
Large diffs are not rendered by default.

middlewares/validators/hacker.validator.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,10 @@ module.exports = {
126126
100
127127
),
128128
VALIDATOR.mongoIdValidator("body", "application.team", true),
129-
VALIDATOR.mongoIdValidator("body", "teamId", true)
129+
VALIDATOR.stringValidator("body", "application.location.timeZone", true),
130+
VALIDATOR.stringValidator("body", "application.location.country", true),
131+
VALIDATOR.stringValidator("body", "application.location.city", true),
132+
VALIDATOR.mongoIdValidator("body", "teamId", true),
130133
],
131134

132135
updateConfirmationValidator: [
@@ -253,7 +256,10 @@ module.exports = {
253256
0,
254257
100
255258
),
256-
VALIDATOR.mongoIdValidator("body", "application.team", true)
259+
VALIDATOR.mongoIdValidator("body", "application.team", true),
260+
VALIDATOR.stringValidator("body", "application.location.timeZone", true),
261+
VALIDATOR.stringValidator("body", "application.location.country", true),
262+
VALIDATOR.stringValidator("body", "application.location.city", true),
257263
],
258264
updateStatusValidator: [
259265
VALIDATOR.enumValidator(

models/hacker.model.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,26 @@ const HackerSchema = new mongoose.Schema({
131131
team: {
132132
type: mongoose.Schema.Types.ObjectId,
133133
ref: "Team"
134+
},
135+
location: {
136+
timeZone: {
137+
type: String,
138+
default: ""
139+
},
140+
country: {
141+
type: String,
142+
default: ""
143+
},
144+
city: {
145+
type: String,
146+
default: ""
147+
}
134148
}
135149
},
136150
teamId: {
137151
type: mongoose.Schema.Types.ObjectId,
138152
ref: "Team"
139-
}
153+
},
140154
});
141155

142156
HackerSchema.methods.toJSON = function() {

routes/api/hacker.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,11 @@ module.exports = {
128128
"accomodation": {
129129
"travel": 0
130130
},
131+
"location": {
132+
"timeZone": "GMT-5",
133+
"country": "Canada",
134+
"city": "Montreal"
135+
}
131136
}
132137
133138
* }
@@ -171,6 +176,11 @@ module.exports = {
171176
"accomodation": {
172177
"travel": 0
173178
},
179+
"location": {
180+
"timeZone": "GMT-5",
181+
"country": "Canada",
182+
"city": "Montreal"
183+
}
174184
}
175185
* }
176186
@@ -461,6 +471,11 @@ module.exports = {
461471
"accomodation": {
462472
"travel": 0
463473
},
474+
"location": {
475+
"timeZone": "GMT-5",
476+
"country": "Canada",
477+
"city": "Montreal"
478+
}
464479
}
465480
}
466481
*
@@ -504,6 +519,11 @@ module.exports = {
504519
"accomodation": {
505520
"travel": 0
506521
},
522+
"location": {
523+
"timeZone": "GMT-5",
524+
"country": "Canada",
525+
"city": "Montreal"
526+
}
507527
}
508528
}
509529
* }
@@ -576,6 +596,11 @@ module.exports = {
576596
"accomodation": {
577597
"travel": 0
578598
},
599+
"location": {
600+
"timeZone": "GMT-5",
601+
"country": "Canada",
602+
"city": "Montreal"
603+
}
579604
}
580605
}
581606
}
@@ -644,6 +669,11 @@ module.exports = {
644669
"accomodation": {
645670
"travel": 0
646671
},
672+
"location": {
673+
"timeZone": "GMT-5",
674+
"country": "Canada",
675+
"city": "Montreal"
676+
}
647677
}
648678
}
649679
}

0 commit comments

Comments
 (0)