chore: change the real user abd legal user data

This commit is contained in:
mahyargdz
2025-03-02 17:59:02 +03:30
parent c559fdb9e8
commit 0da12b89eb
13 changed files with 203 additions and 187 deletions
+10 -11
View File
@@ -1,26 +1,25 @@
import { Column, Entity, JoinColumn, OneToOne, Unique } from "typeorm";
import { Column, Entity, JoinColumn, OneToOne } from "typeorm";
import { User } from "./user.entity";
import { BaseEntity } from "../../../common/entities/base.entity";
import { Address } from "../../address/entities/address.entity";
@Unique(["user"])
@Entity()
export class LegalUser extends BaseEntity {
@Column({ type: "varchar", length: 50, nullable: true })
@Column({ type: "varchar", length: 50, unique: true })
economicCode: string;
@Column({ type: "varchar", length: 50, nullable: true })
registrationId: string;
@Column({ type: "varchar", length: 50, unique: true })
registrationCode: string;
@Column({ type: "varchar", length: 100, nullable: true })
companyRegisteredName: string;
@Column({ type: "varchar", length: 100, unique: true })
registrationName: string;
@Column({ type: "varchar", length: 20, nullable: true })
nationalId: string;
@Column({ type: "varchar", length: 20, unique: true })
nationalIdentity: string;
@Column({ type: "varchar", length: 20, nullable: true })
number: string;
@Column({ type: "varchar", length: 20, unique: true })
phone: string;
@OneToOne(() => Address, { nullable: false, cascade: true })
@JoinColumn()
@@ -1,4 +1,4 @@
import { Column, Entity, JoinColumn, OneToOne, Unique } from "typeorm";
import { Column, Entity, JoinColumn, OneToOne } from "typeorm";
import { User } from "./user.entity";
import { BaseEntity } from "../../../common/entities/base.entity";
@@ -6,7 +6,6 @@ import { Address } from "../../address/entities/address.entity";
import { GenderEnum } from "../enums/gender-type.enum";
import { NationalityEnum } from "../enums/nationality.enum";
@Unique(["user"])
@Entity()
export class RealUser extends BaseEntity {
@Column({ type: "varchar", length: 150 })
@@ -1,27 +0,0 @@
import { Column, Entity, ManyToOne, Unique } from "typeorm";
import { User } from "./user.entity";
import { BaseEntity } from "../../../common/entities/base.entity";
import { FinancialType } from "../enums/financial-type.enum";
@Unique(["user", "type"])
@Entity()
export class UserFinancial extends BaseEntity {
@Column({ type: "enum", enum: FinancialType, default: FinancialType.REAL })
type: FinancialType;
@Column({ nullable: true })
economicCode: string;
@Column({ nullable: true })
registrationId: string;
@Column({ nullable: true })
nationalId: string;
@Column({ nullable: true })
number: string;
@ManyToOne(() => User)
user: User;
}
@@ -21,6 +21,7 @@ import { UserSubscription } from "../../subscriptions/entities/user-subscription
import { TicketMessage } from "../../tickets/entities/ticket-message.entity";
import { Ticket } from "../../tickets/entities/ticket.entity";
import { Wallet } from "../../wallets/entities/wallet.entity";
import { FinancialType } from "../enums/financial-type.enum";
@Entity()
export class User extends BaseEntity {
@@ -55,6 +56,9 @@ export class User extends BaseEntity {
@Column({ type: "boolean", default: false })
emailVerified: boolean;
@Column({ type: "enum", enum: FinancialType, nullable: true })
financialType: FinancialType | null;
//-----------------------------------------
@ManyToMany(() => Role, (role) => role.users)