> For the complete documentation index, see [llms.txt](https://kinesis-school-of-programming.gitbook.io/nestjs-unleashed/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kinesis-school-of-programming.gitbook.io/nestjs-unleashed/parallel-module-prisma/remaining-domain/models/product.md).

# Product

Now the <mark style="color:blue;">`Product`</mark> model, which has relations with <mark style="color:blue;">`Category`</mark> and <mark style="color:blue;">`Order`</mark>.

```prisma
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
}
```

<mark style="color:blue;">`Product`</mark> and <mark style="color:blue;">`Category`</mark> have a **many-to-many** relation, so we'll have in <mark style="color:blue;">`Product`</mark>

```prisma
categories Category[]
```

And in <mark style="color:blue;">`Category`</mark>

```prisma
products Product[]
```

Now, generate and run the migration

```sh
yarn migrate:create create-product
yarn migrate:run
```

Create the products resource

```sh
nest g res domain/products
```

And perform the steps to finish its assembly

* Exclude the <mark style="color:purple;">entities</mark> folder
* In the **controller**, use the <mark style="color:blue;">`IdDto`</mark> wherever <mark style="color:blue;">`id`</mark> is being used
* Remove the **number conversion operator** (<mark style="color:blue;">`+`</mark>) below each occurrence
* Use <mark style="color:blue;">`PaginationDto`</mark> in the <mark style="color:blue;">`findAll()`</mark> method (and also in the **service**)
  * Default page size - 20

<mark style="color:green;">**Commit**</mark> - Creating product model
