Category

We'll create the Category resource following the same protocol.

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

  • Remove the number conversion operator (+) below each occurrence

  • Use PaginationDto in the findAll() method (and also in the service)

    • Default page size - 30

  • Add to the entity the ORM decorators (@Entity(), @Column(), etc)

    • Define name as unique

  • Register the entity inside the TypeOrmModule in the resource's own module

Generate and run the migration create-category, as we cannot define the relations yet.

Commit - Creating category entity

Last updated