3.2.0 ā€¢ Published 4 months ago

nestjs-prisma-codegen v3.2.0

Weekly downloads
-
License
MIT
Repository
-
Last release
4 months ago

nestjs-prisma-codegen

npx nestjs-prisma-codegen ResourceName

nestjs-prisma-codegen šŸš€šŸ¦–

This package takes your resource name and generates all the tedious NestJS types that you'd otherwise write by hand.

Usage šŸ§™ā€ā™‚ļøšŸ’¼

No complicated spells or potions here. In your src/ directory, Just run the script with the required model name.

npx nestjs-prisma-codegen --graphql User
ā”œā”€ā”€ common
ā”‚   ā”œā”€ā”€ auth
ā”‚   ā”‚   ā”œā”€ā”€ auth.decorator.ts
ā”‚   ā”‚   ā”œā”€ā”€ auth.guard.ts
ā”‚   ā”‚   ā””ā”€ā”€ util.ts
ā”‚   ā”œā”€ā”€ dtos
ā”‚   ā”‚   ā””ā”€ā”€ common.input.ts
ā”‚   ā”œā”€ā”€ prisma
ā”‚   ā”‚   ā”œā”€ā”€ prisma.module.ts
ā”‚   ā”‚   ā””ā”€ā”€ prisma.service.ts
ā”‚   ā””ā”€ā”€ types
ā”‚       ā””ā”€ā”€ index.ts
ā”œā”€ā”€ models
ā”‚   ā””ā”€ā”€ users
ā”‚       ā”œā”€ā”€ dtos
ā”‚       ā”‚   ā”œā”€ā”€ create-user.input.ts
ā”‚       ā”‚   ā”œā”€ā”€ find.args.ts
ā”‚       ā”‚   ā”œā”€ā”€ order-by.args.ts
ā”‚       ā”‚   ā”œā”€ā”€ update-user.input.ts
ā”‚       ā”‚   ā””ā”€ā”€ where.args.ts
ā”‚       ā”œā”€ā”€ entity
ā”‚       ā”‚   ā””ā”€ā”€ user.entity.ts
ā”‚       ā”œā”€ā”€ users.module.ts
ā”‚       ā”œā”€ā”€ users.resolver.ts
ā”‚       ā””ā”€ā”€ users.service.ts
npx nestjs-prisma-codegen --rest User
.
ā”œā”€ā”€ common
ā”‚   ā”œā”€ā”€ auth
ā”‚   ā”‚   ā”œā”€ā”€ auth.decorator.ts
ā”‚   ā”‚   ā”œā”€ā”€ auth.guard.ts
ā”‚   ā”‚   ā””ā”€ā”€ util.ts
ā”‚   ā”œā”€ā”€ dtos
ā”‚   ā”‚   ā””ā”€ā”€ common.dto.ts
ā”‚   ā”œā”€ā”€ prisma
ā”‚   ā”‚   ā”œā”€ā”€ prisma.module.ts
ā”‚   ā”‚   ā””ā”€ā”€ prisma.service.ts
ā”‚   ā””ā”€ā”€ types
ā”‚       ā””ā”€ā”€ index.ts
ā”œā”€ā”€ models
ā”‚   ā””ā”€ā”€ users
ā”‚       ā”œā”€ā”€ dtos
ā”‚       ā”‚   ā”œā”€ā”€ create.dto.ts
ā”‚       ā”‚   ā”œā”€ā”€ query.dto.ts
ā”‚       ā”‚   ā””ā”€ā”€ update.dto.ts
ā”‚       ā”œā”€ā”€ entity
ā”‚       ā”‚   ā””ā”€ā”€ user.entity.ts
ā”‚       ā”œā”€ā”€ users.controller.ts
ā”‚       ā””ā”€ā”€ users.module.ts
npx nestjs-prisma-codegen --complete User
ā”œā”€ā”€ common
ā”‚   ā”œā”€ā”€ auth
ā”‚   ā”‚   ā”œā”€ā”€ auth.decorator.ts
ā”‚   ā”‚   ā”œā”€ā”€ auth.guard.ts
ā”‚   ā”‚   ā””ā”€ā”€ util.ts
ā”‚   ā”œā”€ā”€ dtos
ā”‚   ā”‚   ā”œā”€ā”€ common.dto.ts
ā”‚   ā”‚   ā””ā”€ā”€ common.input.ts
ā”‚   ā”œā”€ā”€ prisma
ā”‚   ā”‚   ā”œā”€ā”€ prisma.module.ts
ā”‚   ā”‚   ā””ā”€ā”€ prisma.service.ts
ā”‚   ā””ā”€ā”€ types
ā”‚       ā””ā”€ā”€ index.ts
ā”œā”€ā”€ models
ā”‚   ā””ā”€ā”€ users
ā”‚       ā”œā”€ā”€ graphql
ā”‚       ā”‚   ā”œā”€ā”€ dtos
ā”‚       ā”‚   ā”‚   ā”œā”€ā”€ create-user.input.ts
ā”‚       ā”‚   ā”‚   ā”œā”€ā”€ find.args.ts
ā”‚       ā”‚   ā”‚   ā”œā”€ā”€ order-by.args.ts
ā”‚       ā”‚   ā”‚   ā”œā”€ā”€ update-user.input.ts
ā”‚       ā”‚   ā”‚   ā””ā”€ā”€ where.args.ts
ā”‚       ā”‚   ā”œā”€ā”€ entity
ā”‚       ā”‚   ā”‚   ā””ā”€ā”€ user.entity.ts
ā”‚       ā”‚   ā”œā”€ā”€ users.resolver.ts
ā”‚       ā”‚   ā””ā”€ā”€ users.service.ts
ā”‚       ā”œā”€ā”€ rest
ā”‚       ā”‚   ā”œā”€ā”€ dtos
ā”‚       ā”‚   ā”‚   ā”œā”€ā”€ create.dto.ts
ā”‚       ā”‚   ā”‚   ā”œā”€ā”€ query.dto.ts
ā”‚       ā”‚   ā”‚   ā””ā”€ā”€ update.dto.ts
ā”‚       ā”‚   ā”œā”€ā”€ entity
ā”‚       ā”‚   ā”‚   ā””ā”€ā”€ user.entity.ts
ā”‚       ā”‚   ā””ā”€ā”€ users.controller.ts

Then you can implement the input types with the help of typescript. Also the custom RestrictProperties type will always keep the nest types in sync with the prisma schema.

Prisma module

For creating the prisma module and service, refer to the documentation https://docs.nestjs.com/recipes/prisma.

3.2.0

4 months ago

3.1.0

4 months ago

3.0.0

6 months ago

2.0.0

7 months ago

1.1.1

9 months ago

1.1.0

9 months ago

1.0.12

9 months ago

1.0.11

9 months ago

1.0.10

9 months ago

1.0.9

9 months ago

1.0.8

9 months ago

1.0.7

9 months ago

1.0.6

9 months ago

1.0.5

9 months ago

1.0.4

9 months ago

1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago