Skip to content

Commit

Permalink
Add completion date to condition dates
Browse files Browse the repository at this point in the history
  • Loading branch information
trslater committed Dec 2, 2024
1 parent 4f36f98 commit d684ea4
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ export class ApplicationDecisionConditionDateDto {
@IsDate()
date?: Date;

@IsDate()
completedDate?: Date;

@IsString()
comment?: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ export class ApplicationDecisionConditionDate extends Base {
@Column({ type: 'timestamptz' })
date: Date;

@AutoMap()
@Column({ type: 'timestamptz' })
completedDate: Date;

@AutoMap()
@ManyToOne(() => ApplicationDecisionCondition, {
cascade: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export class ApplicationDecisionConditionDateService {
}

date.date = dto.date ?? date.date;
date.completedDate = dto.completedDate ?? date.completedDate;
date.comment = dto.comment ?? date.comment;

return await this.repository.save(date);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ export class NoticeOfIntentDecisionConditionDateDto {
@IsDate()
date?: Date;

@IsDate()
completedDate?: Date;

@IsString()
comment?: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ export class NoticeOfIntentDecisionConditionDate extends Base {
@Column({ type: 'timestamptz' })
date: Date;

@AutoMap()
@Column({ type: 'timestamptz' })
completedDate: Date;

@AutoMap()
@ManyToOne(() => NoticeOfIntentDecisionCondition, {
cascade: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export class NoticeOfIntentDecisionConditionDateService {
}

date.date = dto.date ?? date.date;
date.completedDate = dto.completedDate ?? date.completedDate;
date.comment = dto.comment ?? date.comment;

return await this.repository.save(date);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { MigrationInterface, QueryRunner } from "typeorm";

export class AddConditionCompletionDate1733169971678 implements MigrationInterface {
name = 'AddConditionCompletionDate1733169971678'

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "alcs"."notice_of_intent_decision_condition_date" ADD "completed_date" TIMESTAMP WITH TIME ZONE NOT NULL`);
await queryRunner.query(`ALTER TABLE "alcs"."application_decision_condition_date" ADD "completed_date" TIMESTAMP WITH TIME ZONE NOT NULL`);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "alcs"."application_decision_condition_date" DROP COLUMN "completed_date"`);
await queryRunner.query(`ALTER TABLE "alcs"."notice_of_intent_decision_condition_date" DROP COLUMN "completed_date"`);
}

}

0 comments on commit d684ea4

Please sign in to comment.