remove unused modules
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
import { Entity, Index, Property, OneToMany, Collection, Cascade } from '@mikro-orm/core';
|
||||
import { BaseEntity } from '../../../common/entities/base.entity';
|
||||
import { UserAddress } from './user-address.entity';
|
||||
import { Order } from 'src/modules/order/entities/order.entity';
|
||||
import { normalizePhone } from '../../util/phone.util';
|
||||
|
||||
@Entity({ tableName: 'users' })
|
||||
@Index({ properties: ['isActive'] })
|
||||
export class User extends BaseEntity {
|
||||
@OneToMany(() => Order, order => order.user)
|
||||
orders = new Collection<Order>(this);
|
||||
|
||||
@Property()
|
||||
firstName!: string;
|
||||
|
||||
@Property({ nullable: true })
|
||||
lastName?: string;
|
||||
|
||||
private _phone!: string;
|
||||
|
||||
@Property({ unique: true })
|
||||
get phone(): string {
|
||||
return this._phone;
|
||||
}
|
||||
|
||||
set phone(value: string) {
|
||||
this._phone = normalizePhone(value);
|
||||
}
|
||||
|
||||
@Property({ default: null, type: 'date', nullable: true })
|
||||
birthDate?: Date;
|
||||
|
||||
@Property({ default: null, type: 'date', nullable: true })
|
||||
marriageDate?: Date;
|
||||
|
||||
@Property({ nullable: true })
|
||||
referrer?: string;
|
||||
|
||||
@Property({ default: true })
|
||||
isActive?: boolean = true;
|
||||
|
||||
@Property({ default: true, nullable: true })
|
||||
gender?: boolean;
|
||||
|
||||
@Property({ nullable: true })
|
||||
avatarUrl?: string;
|
||||
|
||||
@OneToMany(() => UserAddress, address => address.user, {
|
||||
cascade: [Cascade.ALL],
|
||||
orphanRemoval: true,
|
||||
})
|
||||
addresses = new Collection<UserAddress>(this);
|
||||
}
|
||||
Reference in New Issue
Block a user