update : invoice entity

This commit is contained in:
2026-02-02 15:21:23 +03:30
parent 00f96f6b33
commit b3f9457c78
2 changed files with 16 additions and 2 deletions
@@ -0,0 +1,14 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class RemoveNotNullFromInvoicePurpose1770032438762 implements MigrationInterface {
name = 'RemoveNotNullFromInvoicePurpose1770032438762'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "invoice" ALTER COLUMN "purpose" DROP NOT NULL`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "invoice" ALTER COLUMN "purpose" SET NOT NULL`);
}
}
@@ -70,9 +70,9 @@ export class Invoice extends BaseEntity {
@Column({
type: 'enum',
enum: InvoicePurpose,
nullable: false,
nullable: true,
})
purpose: InvoicePurpose;
purpose?: InvoicePurpose;
get isOverdue(): boolean {
return this.status === InvoiceStatus.PENDING && new Date() > this.dueDate;