We'll create the Category resource following the same protocol.
Category
nest g res domain/categories
Define the entity's attributes.
id: number; name: string; registryDates: RegistryDates;
Then, execute the necessary steps to finish assembling the new resource:
In the controller, use the IdDto wherever id is being used
IdDto
id
Remove the number conversion operator (+) below each occurrence
+
Use PaginationDto in the findAll() method (and also in the service)
PaginationDto
findAll()
Default page size - 30
Add to the entity the ORM decorators (@Entity(), @Column(), etc)
@Entity()
@Column()
Define name as unique
name
unique
Register the entity inside the TypeOrmModule in the resource's own module
TypeOrmModule
Generate and run the migration create-category, as we cannot define the relations yet.
Commit - Creating category entity
Last updated 11 months ago