import { Table, Column, ForeignKey, BelongsTo, DataType, Model } from "sequelize-typescript"; import { User } from "../../users/entities/user.entity"; @Table export class Invoice extends Model { @ForeignKey(() => User) @Column userId: number; @BelongsTo(() => User, { onDelete: "CASCADE" }) user: User; @Column({ type: DataType.STRING, allowNull: false, }) firstName: string; @Column({ type: DataType.STRING, allowNull: false, }) lastName: string; @Column({ type: DataType.STRING, allowNull: false, }) phoneNumber: string; @Column({ type: DataType.STRING, allowNull: false, unique: false, }) email: string; @Column totalAmount: number; @Column({ type: DataType.INTEGER, allowNull: false, }) productId: number; @Column({ type: DataType.INTEGER, allowNull: false, }) quantity: number; @Column({ type: DataType.DECIMAL(10, 2), allowNull: false, }) price: number; @Column({ type: DataType.STRING, allowNull: false, }) productName: string; }