From e156cf7c87cf16ec33dd97efd370d7e6e675bec1 Mon Sep 17 00:00:00 2001 From: olsch01 Date: Thu, 26 Feb 2026 08:53:54 -0500 Subject: [PATCH] Fix TypeORM entity type for confirmationNumber column TypeORM needs explicit type: 'varchar' for nullable string columns to avoid reflecting the union type as Object. Co-Authored-By: Claude Opus 4.6 --- .../modules/organizations/entities/organization.entity.ts | 8 ++++---- .../src/modules/organizations/organizations.service.ts | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/backend/src/modules/organizations/entities/organization.entity.ts b/backend/src/modules/organizations/entities/organization.entity.ts index 3ef35ec..f3b38f3 100644 --- a/backend/src/modules/organizations/entities/organization.entity.ts +++ b/backend/src/modules/organizations/entities/organization.entity.ts @@ -62,13 +62,13 @@ export class Organization { planLevel: string; @Column({ name: 'payment_date', type: 'date', nullable: true }) - paymentDate: Date | null; + paymentDate: Date; - @Column({ name: 'confirmation_number', nullable: true }) - confirmationNumber: string | null; + @Column({ name: 'confirmation_number', type: 'varchar', nullable: true }) + confirmationNumber: string; @Column({ name: 'renewal_date', type: 'date', nullable: true }) - renewalDate: Date | null; + renewalDate: Date; @CreateDateColumn({ name: 'created_at', type: 'timestamptz' }) createdAt: Date; diff --git a/backend/src/modules/organizations/organizations.service.ts b/backend/src/modules/organizations/organizations.service.ts index b386dd9..8723d0e 100644 --- a/backend/src/modules/organizations/organizations.service.ts +++ b/backend/src/modules/organizations/organizations.service.ts @@ -65,9 +65,9 @@ export class OrganizationsService { async updateSubscription(id: string, data: { paymentDate?: string; confirmationNumber?: string; renewalDate?: string }) { const org = await this.orgRepository.findOne({ where: { id } }); if (!org) throw new NotFoundException('Organization not found'); - if (data.paymentDate !== undefined) org.paymentDate = data.paymentDate ? new Date(data.paymentDate) : null; - if (data.confirmationNumber !== undefined) org.confirmationNumber = data.confirmationNumber || null; - if (data.renewalDate !== undefined) org.renewalDate = data.renewalDate ? new Date(data.renewalDate) : null; + if (data.paymentDate !== undefined) (org as any).paymentDate = data.paymentDate ? new Date(data.paymentDate) : null; + if (data.confirmationNumber !== undefined) (org as any).confirmationNumber = data.confirmationNumber || null; + if (data.renewalDate !== undefined) (org as any).renewalDate = data.renewalDate ? new Date(data.renewalDate) : null; return this.orgRepository.save(org); }