Created
August 20, 2020 10:42
-
-
Save nmchenry01/d4ec2d7024c79c37164dad7d3f9903ee to your computer and use it in GitHub Desktop.
Product 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 Product { | |
| @PrimaryGeneratedColumn() | |
| id: number; | |
| @Column({ unique: true }) | |
| name: string; | |
| @Column({ nullable: true }) | |
| description?: string; | |
| @CreateDateColumn() | |
| createdAt: string; | |
| @ManyToOne(() => Company, (company) => company.products) | |
| @JoinColumn({ name: 'companyId' }) | |
| company: Company; | |
| @ManyToMany(() => Customer, (customer) => customer.products) | |
| customers: Customer[]; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment