Created
August 20, 2020 10:43
-
-
Save nmchenry01/5d5e07091725abb2f6bd486b5156b66b to your computer and use it in GitHub Desktop.
Customer entity for "Prisma vs. TypeORM"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @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