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.
 
 

37 lines
677 B

import {
Table,
Column,
ForeignKey,
BelongsTo,
DataType,
Model,
HasMany,
} from "sequelize-typescript";
import { User } from "../../users/entities/user.entity";
import { Cart } from "src/cart/entities/cart.entity";
@Table
export class Invoice extends Model<Invoice> {
@ForeignKey(() => User)
@Column
userId: number;
@BelongsTo(() => User, { onDelete: "CASCADE" })
user: User;
@HasMany(() => Cart)
carts: Cart[];
@Column({
type: DataType.INTEGER,
allowNull: false,
})
totalPaymentAmount: number;
@Column({
type: DataType.ENUM("pending", "paid"),
allowNull: false,
defaultValue: "pending",
})
status: string;
}