Created
July 10, 2011 15:10
-
-
Save billywhizz/1074605 to your computer and use it in GitHub Desktop.
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
function handleFailure(err) { | |
next(new DbError(err)); | |
} | |
function findBlog(blog) { | |
function setUsers() { | |
// do stuff | |
} | |
function setBlog() { | |
project.setUsers(users).on("success", setUsers).on("failure", handleFailure); | |
} | |
function createProject(project) { | |
project.setBlog(blog).on("success", setBlog).on("failure", handleFailure); | |
} | |
function findAll(users) { | |
if (!users) return res.send({ errors: "Users do not exist."}); | |
Project.create(req.form.project).on("success", createProject).on("failure", handleFailure); | |
} | |
if (!exhibit) return res.send({ errors: "Blog does not exist."}); | |
User.findAll(req.form.users).on("success", findAll).on("failure", handleFailure); | |
} | |
Blog.find(req.form.blog).on("success", findBlog).on("failure", handleFailure); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment