Skip to content

Instantly share code, notes, and snippets.

@nmchenry01
Created August 20, 2020 10:43
Show Gist options
  • Select an option

  • Save nmchenry01/5d5e07091725abb2f6bd486b5156b66b to your computer and use it in GitHub Desktop.

Select an option

Save nmchenry01/5d5e07091725abb2f6bd486b5156b66b to your computer and use it in GitHub Desktop.
Customer entity for "Prisma vs. TypeORM"
@Entity()
export class Customer {
@PrimaryGeneratedColumn()
id: number;
@Column({ unique: true })
username: string;
@Column({ unique: true })
email: string;
@CreateDateColumn()
createdAt: string;
@ManyToMany(() => Product, (product) => product.customers, { eager: true })
@JoinTable()
products: Product[];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment