Skip to content

Commit ee70e11

Browse files
committed
ALCS-2560 Change MODI and RECON calls
1 parent 5d33d05 commit ee70e11

File tree

4 files changed

+30
-38
lines changed

4 files changed

+30
-38
lines changed

services/apps/alcs/src/alcs/application-decision/application-decision-condition/application-decision-condition.service.ts

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Injectable } from '@nestjs/common';
22
import { InjectRepository } from '@nestjs/typeorm';
3-
import { FindOptionsWhere, In, IsNull, Repository } from 'typeorm';
3+
import { FindOptionsRelations, FindOptionsWhere, In, IsNull, Repository } from 'typeorm';
44
import { ServiceValidationException } from '../../../../../../libs/common/src/exceptions/base.exception';
55
import { ApplicationDecisionConditionToComponentLot } from '../application-condition-to-component-lot/application-decision-condition-to-component-lot.entity';
66
import { ApplicationDecisionConditionComponentPlanNumber } from '../application-decision-component-to-condition/application-decision-component-to-condition-plan-number.entity';
@@ -32,6 +32,15 @@ export class ApplicationDecisionConditionService {
3232
assignee: true,
3333
};
3434

35+
private DEFAULT_APP_RELATIONS: FindOptionsRelations<ApplicationModification> = {
36+
application: {
37+
type: true,
38+
region: true,
39+
localGovernment: true,
40+
decisionMeetings: true,
41+
},
42+
};
43+
3544
constructor(
3645
@InjectRepository(ApplicationDecisionCondition)
3746
private repository: Repository<ApplicationDecisionCondition>,
@@ -109,19 +118,15 @@ export class ApplicationDecisionConditionService {
109118
const condition = this.mapper.map(c, ApplicationDecisionCondition, ApplicationDecisionConditionHomeDto);
110119
const decision = this.mapper.map(c.decision, ApplicationDecision, ApplicationDecisionHomeDto);
111120
const application = this.mapper.map(c.decision.application, Application, ApplicationHomeDto);
121+
112122
const appModifications = await this.modificationRepository.find({
113-
where: {
114-
modifiesDecisions: {
115-
uuid: c.decision?.uuid,
116-
},
117-
},
123+
where: { application: { fileNumber: condition?.decision?.application.fileNumber } },
124+
relations: this.DEFAULT_APP_RELATIONS,
118125
});
126+
119127
const appReconsiderations = await this.reconsiderationRepository.find({
120-
where: {
121-
reconsidersDecisions: {
122-
uuid: c.decision?.uuid,
123-
},
124-
},
128+
where: { application: { fileNumber: condition?.decision?.application.fileNumber } },
129+
relations: this.DEFAULT_APP_RELATIONS,
125130
});
126131

127132
return {

services/apps/alcs/src/alcs/home/home.controller.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -56,31 +56,13 @@ const DEFAULT_APP_RELATIONS: FindOptionsRelations<ApplicationModification> = {
5656
localGovernment: true,
5757
decisionMeetings: true,
5858
},
59-
card: {
60-
board: true,
61-
type: true,
62-
status: true,
63-
assignee: true,
64-
},
65-
modifiesDecisions: true,
66-
resultingDecision: true,
67-
reviewOutcome: true,
6859
};
6960

7061
const DEFAULT_NOI_RELATIONS: FindOptionsRelations<NoticeOfIntentModification> = {
7162
noticeOfIntent: {
7263
region: true,
7364
localGovernment: true,
7465
},
75-
card: {
76-
board: true,
77-
type: true,
78-
status: true,
79-
assignee: true,
80-
},
81-
modifiesDecisions: true,
82-
resultingDecision: true,
83-
reviewOutcome: true,
8466
};
8567

8668
@ApiOAuth2(config.get<string[]>('KEYCLOAK.SCOPES'))

services/apps/alcs/src/alcs/notice-of-intent-decision/notice-of-intent-decision-condition/notice-of-intent-decision-condition.dto.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export class NoticeOfIntentHomeDto {
116116
@AutoMap(() => NoticeOfIntentTypeDto)
117117
type: NoticeOfIntentTypeDto;
118118

119-
activeDays: number;
119+
activeDays?: number;
120120
paused: boolean;
121121
pausedDays: number;
122122
}
@@ -126,7 +126,7 @@ export class NoticeOfIntentDecisionHomeDto {
126126
uuid: string;
127127

128128
@AutoMap()
129-
application: NoticeOfIntentHomeDto;
129+
noticeOfIntent: NoticeOfIntentHomeDto;
130130
}
131131

132132
export class NoticeOfIntentDecisionConditionHomeDto {

services/apps/alcs/src/alcs/notice-of-intent-decision/notice-of-intent-decision-condition/notice-of-intent-decision-condition.service.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Injectable } from '@nestjs/common';
22
import { InjectRepository } from '@nestjs/typeorm';
3-
import { FindOptionsWhere, In, IsNull, Repository } from 'typeorm';
3+
import { FindOptionsRelations, FindOptionsWhere, In, IsNull, Repository } from 'typeorm';
44
import { ServiceValidationException } from '../../../../../../libs/common/src/exceptions/base.exception';
55
import { NoticeOfIntentDecisionComponent } from '../notice-of-intent-decision-component/notice-of-intent-decision-component.entity';
66
import { NoticeOfIntentDecisionConditionType } from './notice-of-intent-decision-condition-code.entity';
@@ -29,6 +29,14 @@ export class NoticeOfIntentDecisionConditionService {
2929
assignee: true,
3030
};
3131

32+
private DEFAULT_NOI_RELATIONS: FindOptionsRelations<NoticeOfIntentModification> = {
33+
noticeOfIntent: {
34+
type: true,
35+
region: true,
36+
localGovernment: true,
37+
},
38+
};
39+
3240
constructor(
3341
@InjectRepository(NoticeOfIntentDecisionCondition)
3442
private repository: Repository<NoticeOfIntentDecisionCondition>,
@@ -132,11 +140,8 @@ export class NoticeOfIntentDecisionConditionService {
132140
const decision = this.mapper.map(c.decision, NoticeOfIntentDecision, NoticeOfIntentDecisionHomeDto);
133141
const noticeOfIntent = this.mapper.map(c.decision.noticeOfIntent, NoticeOfIntent, NoticeOfIntentHomeDto);
134142
const appModifications = await this.modificationRepository.find({
135-
where: {
136-
modifiesDecisions: {
137-
uuid: c.decision?.uuid,
138-
},
139-
},
143+
where: { noticeOfIntent: { fileNumber: condition?.decision?.noticeOfIntent.fileNumber } },
144+
relations: this.DEFAULT_NOI_RELATIONS,
140145
});
141146

142147
return {
@@ -147,7 +152,7 @@ export class NoticeOfIntentDecisionConditionService {
147152
noticeOfIntent: {
148153
...noticeOfIntent,
149154
activeDays: undefined,
150-
pausedDays: timeMap.get(noticeOfIntent.uuid)?.pausedDays ?? null,
155+
pausedDays: timeMap.get(noticeOfIntent.uuid)!.pausedDays || 0,
151156
paused: timeMap.get(noticeOfIntent.uuid)?.pausedDays !== null,
152157
},
153158
},

0 commit comments

Comments
 (0)