> 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/user-model.md).

# User model

The first entity will be created, but now using Prisma instead of TypeORM.

Inside the file <mark style="color:purple;">schema.prisma</mark>, we shall then create our first **model**, for <mark style="color:blue;">`User`</mark>. It is similar to the entity class that would receive TypeORM decorators. Let's then add the following.

```prisma
model User {
  id Int @id @default(autoincrement())

  name     String
  email    String @unique
  phone    String @unique
  password String

  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
}
```

Then, generate and run the respective migration.

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

Now, create the users resource once again.

```sh
nest g res domain/users
```

{% hint style="info" %}
Remember the following options:

* Transport Layer - **REST API**
* CRUD entry points - **Yes**
  {% endhint %}

And perform the following 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 - 10

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

{% hint style="warning" %}
If you wish to have **validation**, follow the section in the **Core module**, as it's identical. The same can be done with **pagination**, and also with the following decorators (for better organization in subsequent lessons)

* <mark style="color:blue;">`@IsCardinal()`</mark>
* <mark style="color:blue;">`@IsEntity()`</mark>
* <mark style="color:blue;">`@IsCurrency()`</mark>
  {% endhint %}

<mark style="color:green;">**Commit**</mark> - Auxiliary structure
