Add all database tables with relations

This commit is contained in:
2024-09-04 17:06:41 +02:00
parent 955758ec4c
commit 7ca15a66b3
6 changed files with 114 additions and 2 deletions

View File

@@ -1,7 +1,14 @@
import { Table, Column, Model, PrimaryKey, AutoIncrement } from 'sequelize-typescript';
import { Table, Column, Model, BelongsTo, ForeignKey } from 'sequelize-typescript';
import { Products } from './products.model';
@Table
export class Categories extends Model {
@Column
name: string
@ForeignKey(() => Products)
productId: number
@BelongsTo(() => Products)
product: Products
}