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.
 

70 lines
1.1 KiB

import {
Table,
Column,
Model,
DataType,
HasMany,
HasOne,
} from 'sequelize-typescript';
import { Order } from '../../orders/entities/order.entity';
import { Wallet } from 'src/modules/wallets/entities/wallet.entity';
@Table({ tableName: 'users' })
export class User extends Model<User> {
@Column({
type: DataType.UUID,
allowNull: false,
defaultValue: DataType.UUIDV4,
})
uuid: string;
@Column({
type: DataType.STRING,
allowNull: false,
})
firstName: string;
@Column({
type: DataType.STRING,
allowNull: false,
})
lastName: string;
@Column({
type: DataType.STRING,
unique: true,
allowNull: false,
})
email: string;
@Column({
type: DataType.STRING,
allowNull: false,
})
password: string;
@Column({
type: DataType.STRING,
allowNull: true,
})
phoneNumber: string;
@Column({
type: DataType.STRING,
allowNull: true,
})
city: string;
@Column({
type: DataType.ENUM,
values: ['male', 'female'],
allowNull: true,
})
gender: string;
@HasMany(() => Order)
orders: Order[];
@HasOne(() => Wallet)
wallet: Wallet;
}