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.
32 lines
631 B
32 lines
631 B
import { |
|
Table, |
|
Column, |
|
Model, |
|
DataType, |
|
ForeignKey, |
|
BelongsTo, |
|
} from 'sequelize-typescript'; |
|
import { Product } from 'src/modules/products/entities/product.entity'; |
|
import { User } from 'src/modules/users/entities/user.entity'; |
|
|
|
@Table({ tableName: 'receipts', updatedAt: false }) |
|
export class Receipt extends Model<Receipt> { |
|
@Column({ |
|
type: DataType.FLOAT, |
|
allowNull: false, |
|
}) |
|
totalPrice: number; |
|
|
|
@Column({ |
|
type: DataType.ARRAY(DataType.INTEGER), |
|
allowNull: false, |
|
}) |
|
products: number[]; |
|
|
|
@ForeignKey(() => User) |
|
@Column |
|
userId: number; |
|
|
|
@BelongsTo(() => User) |
|
user: User; |
|
}
|
|
|