typeorm-unique-on-database
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

TyepORM Unique on Database

Validation to avoid duplicate entries in the entity.

Installation

npm i --save typeorm-unique-on-database

Usage

To use it, just import it into your application and use the decorator

import { UniqueOnDatabase } from 'typeorm-unique-on-database'; // import

...

@Entity()
export class Company extends BaseEntity {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ nullable: false })
  @ApiProperty()
  @MinLength(3)
  @UniqueOnDatabase(Company) // pass the entity
  name: string;
  
  ...

}

Package Sidebar

Install

npm i typeorm-unique-on-database

Weekly Downloads

0

Version

1.0.0

License

ISC

Unpacked Size

103 kB

Total Files

6

Last publish

Collaborators

  • bunker.dev