New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

nestjs-class-validator-db

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nestjs-class-validator-db

NestJS module db class validator

2.0.0
latest
Source
npm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

nestjs-class-validator-db

NPM version npm-typescript License

Installation

  npm install nestjs-class-validator-db
  or
  yarn add nestjs-class-validator-db

Usage :

// main.ts

import { useContainer } from 'class-validator'

async function bootstrap() {
    const app = await NestFactory.create(AppModule)
    app.useGlobalPipes(new ValidationPipe())
    useContainer(app.select(AppModule), { fallbackOnErrors: true })
    ...
}
bootstrap()
// app.module.ts

import { DbClassValidatorModule } from 'nestjs-class-validator-db'

@Module({
  imports: [
    ...
    DbClassValidatorModule
  ],
    ...
})
export class AppModule {}
// x.dto.ts

import { IsUnique } from 'nestjs-class-validator-db'
import { User } from '../entities/user.entity'

export class UserDto {
    @IsUnique(User)
    @IsEmail()
    email: string
}

Keywords

nestjs

FAQs

Package last updated on 24 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts