Skip to content

Commit cd80279

Browse files
authored
Merge pull request #207 from hackmcgill/bugfix/resume
Remove input to resume link in create / patch
2 parents 1b5ead0 + 41d08a1 commit cd80279

3 files changed

Lines changed: 11 additions & 12 deletions

File tree

middlewares/validators/validator.helper.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,6 @@ function applicationValidator(fieldLocation, fieldname, optional = true) {
328328

329329
//helper object to iterate through the items in the application and track which items are not valid.
330330
const hasValid = {
331-
resume: false,
332331
github: false,
333332
dropler: false,
334333
personal: false,
@@ -345,7 +344,6 @@ function applicationValidator(fieldLocation, fieldname, optional = true) {
345344
checkFalsy: true
346345
}).custom(app => {
347346
const jobInterests = Constants.JOB_INTERESTS;
348-
hasValid.resume = (!app.portfolioURL.resume || typeof (app.portfolioURL.resume) === "string");
349347
hasValid.github = (!app.portfolioURL.github || typeof (app.portfolioURL.github) === "string");
350348
hasValid.dropler = (!app.portfolioURL.dropler || typeof (app.portfolioURL.dropler) === "string");
351349
hasValid.personal = (!app.portfolioURL.personal || typeof (app.portfolioURL.personal) === "string");
@@ -365,7 +363,6 @@ function applicationValidator(fieldLocation, fieldname, optional = true) {
365363
} else {
366364
return application.custom(app => {
367365
const jobInterests = Constants.JOB_INTERESTS;
368-
hasValid.resume = (typeof (app.portfolioURL.resume) === "string");
369366
hasValid.github = (!app.portfolioURL.github || typeof (app.portfolioURL.github) === "string");
370367
hasValid.dropler = (!app.portfolioURL.dropler || typeof (app.portfolioURL.dropler) === "string");
371368
hasValid.personal = (!app.portfolioURL.personal || typeof (app.portfolioURL.personal) === "string");
@@ -441,7 +438,7 @@ function jwtValidator(fieldLocation, fieldname, jwtSecret, optional = true) {
441438
* @param {"query" | "body" | "header" | "param"} fieldLocation the location where the field should be found
442439
* @param {string} fieldname name of the field that needs to be validated.
443440
*/
444-
function searchModelValidator(fieldLocation, fieldName){
441+
function searchModelValidator(fieldLocation, fieldName) {
445442
const paramChain = setProperValidationChainBuilder(fieldLocation, fieldName, "Must be a valid searchable model");
446443
return paramChain.exists().withMessage("Model must be provided")
447444
.isLowercase().withMessage("Model must be lower case")
@@ -456,9 +453,11 @@ function searchModelValidator(fieldLocation, fieldName){
456453
*/
457454
function searchValidator(fieldLocation, fieldname) {
458455
const search = setProperValidationChainBuilder(fieldLocation, fieldname, "Invalid search query");
459-
456+
460457
return search.exists().withMessage("Search query must be provided")
461-
.custom((value, {req}) => {
458+
.custom((value, {
459+
req
460+
}) => {
462461
//value is a serialized JSON
463462
value = JSON.parse(value);
464463
let modelString = req.params.model
@@ -506,7 +505,9 @@ function searchSortValidator(fieldLocation, fieldName) {
506505
return searchSort.optional({
507506
checkFalsy: true
508507
})
509-
.custom((value, {req}) => {
508+
.custom((value, {
509+
req
510+
}) => {
510511
let modelString = req.params.model
511512
if (modelString.equals("hacker")) {
512513
model = Models.Hacker;

models/hacker.model.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const HackerSchema = new mongoose.Schema({
3434
//gcloud bucket link
3535
resume: {
3636
type: String,
37+
default: ""
3738
},
3839
github: {
3940
type: String
@@ -118,10 +119,9 @@ HackerSchema.methods.isApplicationComplete = function () {
118119
*/
119120
HackerSchema.statics.searchableField = function (field) {
120121
const schemaField = HackerSchema.path(field)
121-
if(schemaField != undefined){
122+
if (schemaField != undefined) {
122123
return schemaField.instance
123-
}
124-
else{
124+
} else {
125125
return null;
126126
}
127127
};

routes/api/hacker.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ module.exports = {
6969
* @apiParamExample {Json} application:
7070
* {
7171
* "portfolioURL": {
72-
* "resume": "..."
7372
* "github": "...",
7473
* "dropler": "...",
7574
* "personal": "...",
@@ -194,7 +193,6 @@ module.exports = {
194193
* @apiParamExample {Json} application:
195194
* {
196195
* "portfolioURL": {
197-
* "resume": "..."
198196
* "github": "...",
199197
* "dropler": "...",
200198
* "personal": "...",

0 commit comments

Comments
 (0)