You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

63 lines
1.1 KiB

import { Table, Column, ForeignKey, BelongsTo, DataType, Model } from "sequelize-typescript";
import { User } from "../../users/entities/user.entity";
@Table
export class Invoice extends Model<Invoice> {
@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;
}