I am facing an issue with the relationship between my entities. I have tried everything, but I still encounter the same problem. Here are my scripts:
Company.entity.ts
export class Company extends AppBaseEntity {
@Column('text', { name: 'nom', nullable: true })
nom: string;
@Column('varchar', { name: 'type_entite', length: 255, nullable: true })
typeEntite?: CompanyEntityType;
@Column('text', { name: 'note', nullable: true })
note: string;
@Column('varchar', { name: 'color', length: 15, nullable: true })
color?: string;
@Column('text', { name: 'textMailInvoices', nullable: true })
textMailInvoices?: string;
@Column('varchar', { name: 'subjectMailInvoices', length: 255, nullable: true })
subjectMailInvoices?: string;
@Column('tinyint', { name: 'archived', nullable: false, default: 0 })
archived: boolean;
@OneToMany(() => CompanyTypesLinks, companyTypesLink => companyTypesLink.company, { cascade: true, onUpdate: 'CASCADE' })
public companyTypesLinks?: CompanyTypesLinks[];
and company-type-link.entity.ts
export class CompanyTypesLinks extends AppBaseEntity {
@Column('varchar', { name: 'typesId', length: 36, nullable: true })
typesId: string;
@ManyToOne(() => Company, company => company.companyTypesLinks, { cascade: true })
@JoinColumn({ name: 'companyId' })
public company?: Company;
@Column('varchar', { name: 'companyId', length: 36, nullable: true })
companyId: string;
@ManyToOne(() => CompanyTypes, companyTypes => companyTypes.companyTypesLinks)
@JoinColumn({ name: 'typesId' })
companyType?: CompanyTypes;
AppBaseEntity contains id