Category
We'll now create the Category
model, following the same protocol.
model Category {
id Int @id @default(autoincrement())
name String @unique
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
Then generate and run the migration, as the relations cannot be set yet.
yarn migrate:create create-category
yarn migrate:run
Create the categories resource
nest g res domain/categories
And perform the 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 - 30
Commit - Creating category model
Last updated