User model
The first entity will be created, but now using Prisma instead of TypeORM.
Inside the file schema.prisma, we shall then create our first model, for User
. It is similar to the entity class that would receive TypeORM decorators. Let's then add the following.
Then, generate and run the respective migration.
Now, create the users resource once again.
And perform the following steps to finish its assembly
Exclude the entities folder
In the controller, use the
IdDto
whereverid
is being usedRemove the number conversion operator (
+
) below each occurrenceUse
PaginationDto
in thefindAll()
method (and also in the service)Default page size - 10
Commit - Creating user model
If you wish to have validation, follow the section in the Core module, as it's identical. The same can be done with pagination, and also with the following decorators (for better organization in subsequent lessons)
@IsCardinal()
@IsEntity()
@IsCurrency()
Commit - Auxiliary structure
Last updated