CrazyWearsPJs / UCRcareer

MIT License
3 stars 4 forks source link

Location field missing from employerRegister controller #8

Closed nllanura closed 10 years ago

nllanura commented 10 years ago

In the employerRegisterCtrl.js file

$scope.user = { 'companyName': {}, 'contact': {}, 'credentials': {}, 'personal': {} };

is missing 'location': {}, but if I try to place it, then when I try to register a new employer, the post request won't even be received. Without the field however, the post request is received but it won't save properly. For example, if I go to the register.js file in the router directory and do a console.log in the save function for employers,

newEmployer.save(function(err, newEmployerUpdated) { if(err) { console.log(err); console.log(newEmployer); console.log(newEmployerUpdated); err.status = 400; next(err); } else { req.session.employerUserId = newEmployerUpdated._id; res.status(200).end(); } });

and then i try to submit an employer, the error object is returned with

{ message: 'Validation failed', name: 'ValidationError', errors: { 'location.zip': { message: 'Path location.zip is required.', name: 'ValidatorError', path: 'location.zip', type: 'required', value: undefined } } }

but the newEmployer object returns

{ companyName: 'n', _id: 545d171a84d8eeee07632e6e, personal: { fName: 'n', mInit: 'n', lName: 'n' }, location: { address1: 'n', address2: 'n', city: 'n', state: 'n', country: 'n' }, contact: {}, credentials: { email: 'n@n', password: 'nnnnnnnn' } }

while the newEmployerUpdated object, which is supposed to be the saved object returns undefined. When I tested out the same thing with the applicant, this passed successfully.

dcastil1983 commented 10 years ago

Go into employerRegister.html and change name=ZipCode to name = zip on line 269. If that doesn't, then no clue