This commit is contained in:
2025-09-18 02:44:24 +07:00
parent adf4026367
commit 81b55b27ab
3 changed files with 9 additions and 6 deletions

View File

@ -1,6 +1,6 @@
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, JoinColumn, ManyToOne } from "typeorm";
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, JoinColumn, ManyToOne, OneToMany } from "typeorm";
import { Status } from "../types/status";
import { TrxCompanyAccount } from "./trx_company_accounts";
@Entity("trx_companies", { schema: "trx" })
export class TrxCompany {
@ -47,6 +47,9 @@ export class TrxCompany {
})
pic_email: string;
@OneToMany(() => TrxCompanyAccount, (company_account) => company_account.company, { cascade: true, nullable: false })
company_account: TrxCompanyAccount[];
@Column()
@CreateDateColumn()
created_at: Date;

View File

@ -21,8 +21,8 @@ export class TrxCompanyAccount {
})
account_number: string;
@ManyToOne(() => TrxCompany, { onDelete: "NO ACTION", nullable: true })
@JoinTable()
@ManyToOne(() => TrxCompany, (company) => company.company_account, { onDelete: "NO ACTION" })
@JoinColumn()
company: TrxCompany;
@ManyToOne(() => TrxCif, { onDelete: "NO ACTION", nullable: true })

View File

@ -15,11 +15,11 @@ export class TrxRegistration {
})
code: string;
@ManyToOne(() => TrxCompany, { onDelete: "RESTRICT", nullable: true })
@ManyToOne(() => TrxCompany, { onDelete: "NO ACTION", nullable: true })
@JoinColumn()
company: TrxCompany;
@ManyToOne(() => TrxCif, { onDelete: "RESTRICT", nullable: true })
@ManyToOne(() => TrxCif, { onDelete: "NO ACTION", nullable: true })
@JoinColumn()
cif: TrxCif;