import { Entity, Index, Property, OneToMany, Collection, PrimaryKey, OptionalProps } from '@mikro-orm/core'; import { BaseEntity } from '../../../common/entities/base.entity'; import { LearningProgress } from '../../learnings/entities/learning-progress.entity'; import { Criticism } from '../../criticisms/entities/criticism.entity'; @Entity({ tableName: 'users' }) export class User extends BaseEntity { [OptionalProps]?: 'createdAt' | 'deletedAt' @OneToMany(() => LearningProgress, (lp) => lp.user) learningProgress = new Collection(this); @OneToMany(() => Criticism, (c) => c.user) criticisms = new Collection(this); // @OneToMany(() => Order, order => order.user) // orders = new Collection(this); @Property({ nullable: true }) firstName?: string; @Property({ nullable: true }) lastName?: string; @Property({ unique: true }) phone: string @Property({ default: true }) isActive?: boolean = true; @Property({ default: true, nullable: true }) gender?: boolean; @Property({ default: 0 }) maxCredit: number; @Property({ type: 'string', nullable: true }) addresse?: string }