Product
Now the Product model, which has relations with Category and Order.
model Product {
  id Int @id @default(autoincrement())
  name        String  @unique
  description String?
  price       Decimal @db.Decimal(6, 2)
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
}Product and Category have a many-to-many relation, so we'll have in Product
categories Category[]And in Category
products Product[]Now, generate and run the migration
yarn migrate:create create-product
yarn migrate:runCreate the products resource
nest g res domain/productsAnd perform the steps to finish its assembly
Exclude the entities folder
In the controller, use the
IdDtowhereveridis being usedRemove the number conversion operator (
+) below each occurrenceUse
PaginationDtoin thefindAll()method (and also in the service)Default page size - 20
Commit - Creating product model
Last updated