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,
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.
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.