59 lines
939 B
59 lines
939 B
import { Model, Table, Column, DataType } from "sequelize-typescript"; |
|
|
|
@Table |
|
export class Product extends Model<Product> { |
|
@Column({ |
|
type: DataType.STRING, |
|
allowNull: false, |
|
}) |
|
name: string; |
|
|
|
@Column({ |
|
type: DataType.STRING, |
|
allowNull: false, |
|
}) |
|
description: string; |
|
|
|
@Column({ |
|
type: DataType.INTEGER, |
|
allowNull: false, |
|
}) |
|
price: number; |
|
|
|
@Column({ |
|
type: DataType.STRING, |
|
allowNull: true, |
|
}) |
|
imageUrl: string; |
|
|
|
@Column({ |
|
type: DataType.ARRAY(DataType.STRING), |
|
allowNull: true, |
|
}) |
|
tags: string[]; |
|
|
|
@Column({ |
|
type: DataType.INTEGER, |
|
allowNull: false, |
|
defaultValue: 0, |
|
}) |
|
quantity: number; |
|
|
|
@Column({ |
|
type: DataType.STRING, |
|
allowNull: true, |
|
}) |
|
brand: string; |
|
|
|
@Column({ |
|
type: DataType.STRING, |
|
allowNull: true, |
|
}) |
|
color: string; |
|
|
|
@Column({ |
|
type: DataType.STRING, |
|
allowNull: false, |
|
}) |
|
category: string; |
|
}
|
|
|