chore: first

This commit is contained in:
Mahyargdz
2025-05-11 10:27:30 +03:30
commit 4e563c497d
102 changed files with 18602 additions and 0 deletions
+51
View File
@@ -0,0 +1,51 @@
import { Collection, Entity, EntityRepositoryType, ManyToOne, OneToMany, Opt, Property } from "@mikro-orm/core";
import { RefreshToken } from "./refresh-token.entity";
import { Role } from "./role.entity";
import { BaseEntity } from "../../../common/entities/base.entity";
import { UserRepository } from "../repositories/user.repository";
@Entity({ repository: () => UserRepository })
export class User extends BaseEntity {
@Property({ type: "varchar", length: 150, nullable: true })
email?: string;
@Property({ type: "varchar", length: 11, unique: true, nullable: false })
phone!: string;
@Property({ type: "varchar", length: 50, unique: true, nullable: true })
userName!: string;
@Property({ type: "varchar", length: 150 })
password!: string;
@Property({ type: "varchar", length: 150 })
firstName!: string;
@Property({ type: "varchar", length: 200 })
lastName!: string;
@Property({ type: "varchar", length: 12, nullable: true })
birthDate?: string;
@Property({ type: "varchar", length: 100, unique: true, nullable: true })
nationalCode?: string;
@Property({ type: "varchar", length: 100, nullable: true })
profilePic?: string;
@Property({ type: "boolean", default: false })
emailVerified!: boolean & Opt;
//-----------------------------------
@ManyToOne(() => Role, { deleteRule: "restrict" })
role!: Role;
//-----------------------------------
@OneToMany(() => RefreshToken, (token) => token.user)
refreshTokens = new Collection<RefreshToken>(this);
[EntityRepositoryType]?: UserRepository;
}