First of all, if you have downloaded the source code of the previous tutorial, compile and run the existing migrations.
Then open the
user.entity.ts file from the
src/app/entities directory. The
User entity is the main class used by the framework's authentication system.
password properties and the
setPassword method uses
hashPassword to hash passwords before storing them in the database. You must use this method to set a password instead of directly assigning a value to the
The Todo model defined in the previous tutorial now needs a
owner property to know which user it belongs to.
Replace the content of
In the database the
todo table will look like this:
The last step is to create/update the tables in the database. As in the first tutorial, you will use migrations for this.
Generate the migrations from the entities.
A new file is added in
Then run the new migration file.