Skip to content

Commit

Permalink
Merge pull request #1358 from bcgov/feature/ALCS-974-2
Browse files Browse the repository at this point in the history
PDF Fixes
  • Loading branch information
dhaselhan authored Jan 30, 2024
2 parents 33df229 + f32b4ae commit aa20fbc
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ export class UpdateNoticeOfIntentDto {
@IsNumber()
dateSubmittedToAlc?: number;

@IsOptional()
@IsString()
typeCode?: string;

@IsOptional()
@IsBoolean()
hideFromPortal?: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import {
ServiceNotFoundException,
ServiceValidationException,
} from '@app/common/exceptions/base.exception';
import { Mapper } from 'automapper-core';
import { InjectMapper } from 'automapper-nestjs';
import { Injectable, Logger } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Mapper } from 'automapper-core';
import { InjectMapper } from 'automapper-nestjs';
import {
FindOptionsRelations,
FindOptionsWhere,
Expand All @@ -23,13 +23,13 @@ import { Board } from '../board/board.entity';
import { CARD_TYPE } from '../card/card-type/card-type.entity';
import { Card } from '../card/card.entity';
import { CardService } from '../card/card.service';
import { NoticeOfIntentType } from './notice-of-intent-type/notice-of-intent-type.entity';
import { CodeService } from '../code/code.service';
import { LocalGovernmentService } from '../local-government/local-government.service';
import { NOI_SUBMISSION_STATUS } from './notice-of-intent-submission-status/notice-of-intent-status.dto';
import { NoticeOfIntentSubmissionStatusService } from './notice-of-intent-submission-status/notice-of-intent-submission-status.service';
import { NoticeOfIntentSubmissionService } from './notice-of-intent-submission/notice-of-intent-submission.service';
import { NoticeOfIntentSubtype } from './notice-of-intent-subtype.entity';
import { NoticeOfIntentType } from './notice-of-intent-type/notice-of-intent-type.entity';
import {
CreateNoticeOfIntentServiceDto,
NoticeOfIntentDto,
Expand Down Expand Up @@ -333,6 +333,14 @@ export class NoticeOfIntentService {
noticeOfIntent.hideFromPortal,
);

if (updateDto.typeCode) {
noticeOfIntent.type = await this.typeRepository.findOneOrFail({
where: {
code: updateDto.typeCode,
},
});
}

await this.repository.save(noticeOfIntent);

await this.updateStatus(updateDto, noticeOfIntent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,15 @@ export class ApplicationSubmissionService {
);
}

if (!applicationSubmission.isDraft && updateDto.typeCode) {
await this.applicationService.updateByFileNumber(
applicationSubmission.fileNumber,
{
typeCode: updateDto.typeCode,
},
);
}

return this.getOrFailByUuid(submissionUuid, this.DEFAULT_RELATIONS);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,14 @@ export class NoticeOfIntentSubmissionService {
);
}

if (!noticeOfIntentSubmission.isDraft && updateDto.typeCode) {
await this.noticeOfIntentService.update(
noticeOfIntentSubmission.fileNumber,
{
typeCode: updateDto.typeCode,
},
);
}
return this.getByUuid(submissionUuid, user);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,11 @@ export class GenerateNoiSubmissionDocumentService {
submission.soilIsRemovingSoilForNewStructure,
),
soilProposedStructures: submission.soilProposedStructures.map(
(structure, index) => ({ ...structure, index }),
(structure, index) => ({
area: structure.area ?? NO_DATA,
type: structure.type ?? NO_DATA,
index: index + 1,
}),
),
soilStructureFarmUseReason: submission.soilStructureFarmUseReason,
soilStructureResidentialUseReason:
Expand Down

0 comments on commit aa20fbc

Please sign in to comment.