Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Sequelize Model Validation!
You have completed Sequelize Model Validation!
Preview
Let's begin setting up validations and constraints for the User model to prevent invalid data from being entered into the database.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
As I demonstrated in the previous video,
0:00
null by default is an allowed value for
any attribute or column of a model.
0:02
Sending an empty post request or
even setting a property explicitly to
0:07
null allows User.create() to be
called here in the post users route and
0:12
successfully create a new user entry.
0:17
We don't want that.
0:19
First, we'll make sure that a null
value is not allowed for name,
0:21
email, birthday, and password using
the Sequelize allow null check.
0:25
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up