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 <noreply@anthropic.com>
This commit is contained in:
2026-02-26 08:53:54 -05:00
parent 76ab63a200
commit e156cf7c87
2 changed files with 7 additions and 7 deletions

View File

@@ -62,13 +62,13 @@ export class Organization {
planLevel: string; planLevel: string;
@Column({ name: 'payment_date', type: 'date', nullable: true }) @Column({ name: 'payment_date', type: 'date', nullable: true })
paymentDate: Date | null; paymentDate: Date;
@Column({ name: 'confirmation_number', nullable: true }) @Column({ name: 'confirmation_number', type: 'varchar', nullable: true })
confirmationNumber: string | null; confirmationNumber: string;
@Column({ name: 'renewal_date', type: 'date', nullable: true }) @Column({ name: 'renewal_date', type: 'date', nullable: true })
renewalDate: Date | null; renewalDate: Date;
@CreateDateColumn({ name: 'created_at', type: 'timestamptz' }) @CreateDateColumn({ name: 'created_at', type: 'timestamptz' })
createdAt: Date; createdAt: Date;

View File

@@ -65,9 +65,9 @@ export class OrganizationsService {
async updateSubscription(id: string, data: { paymentDate?: string; confirmationNumber?: string; renewalDate?: string }) { async updateSubscription(id: string, data: { paymentDate?: string; confirmationNumber?: string; renewalDate?: string }) {
const org = await this.orgRepository.findOne({ where: { id } }); const org = await this.orgRepository.findOne({ where: { id } });
if (!org) throw new NotFoundException('Organization not found'); if (!org) throw new NotFoundException('Organization not found');
if (data.paymentDate !== undefined) org.paymentDate = data.paymentDate ? new Date(data.paymentDate) : null; if (data.paymentDate !== undefined) (org as any).paymentDate = data.paymentDate ? new Date(data.paymentDate) : null;
if (data.confirmationNumber !== undefined) org.confirmationNumber = data.confirmationNumber || null; if (data.confirmationNumber !== undefined) (org as any).confirmationNumber = data.confirmationNumber || null;
if (data.renewalDate !== undefined) org.renewalDate = data.renewalDate ? new Date(data.renewalDate) : null; if (data.renewalDate !== undefined) (org as any).renewalDate = data.renewalDate ? new Date(data.renewalDate) : null;
return this.orgRepository.save(org); return this.orgRepository.save(org);
} }