Created
January 11, 2020 16:01
-
-
Save PatrickKalkman/8c298ff4525fadbe3dfe02969f8a0810 to your computer and use it in GitHub Desktop.
Part of the JobController that saves a job using Mongoose
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jobController.addJob = function addJob(req, reply) { | |
const job = new Job(req.body); | |
job.status = constants.WORKFLOW_STATUS.NEW; | |
job.save(function(err, job) { | |
if (!err) { | |
reply.send(job); | |
} else { | |
reply.badRequest(err); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment