Skip to content

Commit

Permalink
Merge pull request #1045 from bcgov/feature/ALCS-1176
Browse files Browse the repository at this point in the history
Public Fixes
  • Loading branch information
dhaselhan authored Oct 11, 2023
2 parents 2faca07 + 6457bc6 commit c89ace7
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[dataSource]="dataSource"
class="mat-elevation-z2 table"
matSort
matSortActive="dateSubmitted"
matSortActive="lastUpdate"
matSortDirection="desc"
matSortDisableClear
>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Component, EventEmitter, Input, OnDestroy, Output, ViewChild } from '@angular/core';
import { MatPaginator, PageEvent } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
import { Router } from '@angular/router';
import { Subject, takeUntil } from 'rxjs';
import { ApplicationStatusDto } from '../../../../services/application-submission/application-submission.dto';
Expand All @@ -21,7 +22,7 @@ export class ApplicationSearchTableComponent implements OnDestroy {
_applications: ApplicationSearchResultDto[] = [];
@Input() set applications(applications: ApplicationSearchResultDto[]) {
this._applications = applications;
this.dataSource = this.mapApplications(applications);
this.dataSource = new MatTableDataSource<SearchResult>(this.mapApplications(applications));
}

_totalCount = 0;
Expand All @@ -36,7 +37,7 @@ export class ApplicationSearchTableComponent implements OnDestroy {
@Output() tableChange = new EventEmitter<TableChange>();

displayedColumns = ['fileId', 'ownerName', 'type', 'portalStatus', 'lastUpdate', 'government'];
dataSource: SearchResult[] = [];
dataSource = new MatTableDataSource<SearchResult>();
pageIndex = 0;
itemsPerPage = 20;
total = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[dataSource]="dataSource"
class="mat-elevation-z2 table"
matSort
matSortActive="dateSubmitted"
matSortActive="lastUpdate"
matSortDirection="desc"
matSortDisableClear
>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { Component, EventEmitter, Input, OnDestroy, Output, ViewChild } from '@angular/core';
import { MatPaginator, PageEvent } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
import { Router } from '@angular/router';
import { Subject, takeUntil } from 'rxjs';
import { ApplicationStatusDto } from '../../../../services/application-submission/application-submission.dto';
import { ApplicationRegionDto, NoticeOfIntentTypeDto } from '../../../../services/code/code.dto';
import { NoticeOfIntentSubmissionStatusDto } from '../../../../services/notice-of-intent-submission/notice-of-intent-submission.dto';
import { NoticeOfIntentSearchResultDto } from '../../../../services/search/search.dto';
import { SearchResult, TableChange } from '../search.interface';

Expand All @@ -23,7 +22,7 @@ export class NoticeOfIntentSearchTableComponent implements OnDestroy {
_noticeOfIntents: NoticeOfIntentSearchResultDto[] = [];
@Input() set noticeOfIntents(noticeOfIntents: NoticeOfIntentSearchResultDto[]) {
this._noticeOfIntents = noticeOfIntents;
this.dataSource = this.mapNoticeOfIntent(noticeOfIntents);
this.dataSource = new MatTableDataSource<SearchResult>(this.mapNoticeOfIntent(noticeOfIntents));
}

_totalCount = 0;
Expand All @@ -36,7 +35,7 @@ export class NoticeOfIntentSearchTableComponent implements OnDestroy {
@Output() tableChange = new EventEmitter<TableChange>();

displayedColumns = ['fileId', 'ownerName', 'type', 'portalStatus', 'lastUpdate', 'government'];
dataSource: SearchResult[] = [];
dataSource = new MatTableDataSource<SearchResult>();
pageIndex = 0;
itemsPerPage = 20;
total = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[dataSource]="dataSource"
class="mat-elevation-z2 table"
matSort
matSortActive="dateSubmitted"
matSortActive="lastUpdate"
matSortDirection="desc"
matSortDisableClear
>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Component, EventEmitter, Input, OnDestroy, Output, ViewChild } from '@angular/core';
import { MatPaginator, PageEvent } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
import { Router } from '@angular/router';
import { Subject, takeUntil } from 'rxjs';
import { ApplicationStatusDto } from '../../../../services/application-submission/application-submission.dto';
Expand All @@ -24,7 +25,7 @@ export class NotificationSearchTableComponent implements OnDestroy {

@Input() set notifications(notifications: NotificationSearchResultDto[]) {
this._notifications = notifications;
this.dataSource = this.mapNotifications(notifications);
this.dataSource = new MatTableDataSource<SearchResult>(this.mapNotifications(notifications));
}

_totalCount = 0;
Expand All @@ -35,7 +36,7 @@ export class NotificationSearchTableComponent implements OnDestroy {
@Output() tableChange = new EventEmitter<TableChange>();

displayedColumns = ['fileId', 'ownerName', 'type', 'portalStatus', 'lastUpdate', 'government'];
dataSource: SearchResult[] = [];
dataSource = new MatTableDataSource<SearchResult>();
pageIndex = 0;
itemsPerPage = 20;
total = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { ApplicationPortalDecisionDto } from './application-decision.dto';
providedIn: 'root',
})
export class ApplicationDecisionService {
private serviceUrl = `${environment.apiUrl}/public/application/decision`;
private serviceUrl = `${environment.authUrl}/public/application/decision`;

constructor(private httpClient: HttpClient, private toastService: ToastService) {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { NoticeOfIntentPortalDecisionDto } from './notice-of-intent-decision.dto
providedIn: 'root',
})
export class NoticeOfIntentDecisionService {
private serviceUrl = `${environment.apiUrl}/public/notice-of-intent/decision`;
private serviceUrl = `${environment.authUrl}/public/notice-of-intent/decision`;

constructor(private httpClient: HttpClient, private toastService: ToastService) {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { mockKeyCloakProviders } from '../../../../test/mocks/mockTypes';
import { ApplicationDecisionV2Service } from '../../../alcs/application-decision/application-decision-v2/application-decision/application-decision-v2.service';
import { ApplicationDecision } from '../../../alcs/application-decision/application-decision.entity';
import { ApplicationDecisionProfile } from '../../../common/automapper/application-decision-v2.automapper.profile';
import { User } from '../../../user/user.entity';
import { ApplicationSubmissionService } from '../../application-submission/application-submission.service';
import { ApplicationDecisionController } from './application-decision.controller';

Expand Down Expand Up @@ -58,11 +57,7 @@ describe('ApplicationDecisionController', () => {
new ApplicationDecision(),
]);

const res = await controller.listDecisions('', {
user: {
entity: new User(),
},
});
const res = await controller.listDecisions('');

expect(res.length).toEqual(1);
expect(mockDecisionService.getForPortal).toHaveBeenCalledTimes(1);
Expand All @@ -71,11 +66,7 @@ describe('ApplicationDecisionController', () => {
it('should call through for loading files', async () => {
mockDecisionService.getDownloadUrl.mockResolvedValue('Mock Url');

const res = await controller.openFile('', {
user: {
entity: new User(),
},
});
const res = await controller.openFile('');

expect(res.url).toBeTruthy();
expect(mockDecisionService.getDownloadUrl).toHaveBeenCalledTimes(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,17 @@ import { ApplicationSubmissionService } from '../../application-submission/appli
import { ApplicationPortalDecisionDto } from './application-decision.dto';

@Public()
@Controller('application/decision')
@Controller('public/application/decision')
export class ApplicationDecisionController {
constructor(
private applicationSubmissionService: ApplicationSubmissionService,
private decisionService: ApplicationDecisionV2Service,
@InjectMapper() private mapper: Mapper,
) {}

@Get('/application/:fileNumber')
@Get('/:fileNumber')
async listDecisions(
@Param('fileNumber') fileNumber: string,
@Req() req,
): Promise<ApplicationPortalDecisionDto[]> {
const decisions = await this.decisionService.getForPortal(fileNumber);

Expand All @@ -31,11 +30,9 @@ export class ApplicationDecisionController {
}

@Get('/:uuid/open')
async openFile(@Param('uuid') fileUuid: string, @Req() req) {
async openFile(@Param('uuid') fileUuid: string) {
const url = await this.decisionService.getDownloadUrl(fileUuid);

//TODO: How do we know which documents applicant can access?

return { url };
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { mockKeyCloakProviders } from '../../../../test/mocks/mockTypes';
import { NoticeOfIntentDecisionV2Service } from '../../../alcs/notice-of-intent-decision/notice-of-intent-decision-v2/notice-of-intent-decision-v2.service';
import { NoticeOfIntentDecision } from '../../../alcs/notice-of-intent-decision/notice-of-intent-decision.entity';
import { NoticeOfIntentDecisionProfile } from '../../../common/automapper/notice-of-intent-decision.automapper.profile';
import { User } from '../../../user/user.entity';
import { NoticeOfIntentSubmission } from '../../notice-of-intent-submission/notice-of-intent-submission.entity';
import { NoticeOfIntentSubmissionService } from '../../notice-of-intent-submission/notice-of-intent-submission.service';
import { NoticeOfIntentDecisionController } from './notice-of-intent-decision.controller';
Expand Down Expand Up @@ -63,11 +62,7 @@ describe('NoticeOfIntentDecisionController', () => {
new NoticeOfIntentDecision(),
]);

const res = await controller.listDecisions('', {
user: {
entity: new User(),
},
});
const res = await controller.listDecisions('');

expect(res.length).toEqual(1);
expect(mockDecisionService.getForPortal).toHaveBeenCalledTimes(1);
Expand All @@ -76,11 +71,7 @@ describe('NoticeOfIntentDecisionController', () => {
it('should call through for loading files', async () => {
mockDecisionService.getDownloadUrl.mockResolvedValue('Mock Url');

const res = await controller.openFile('', {
user: {
entity: new User(),
},
});
const res = await controller.openFile('');

expect(res.url).toBeTruthy();
expect(mockDecisionService.getDownloadUrl).toHaveBeenCalledTimes(1);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { Mapper } from '@automapper/core';
import { InjectMapper } from '@automapper/nestjs';
import { Controller, Get, Param, Req } from '@nestjs/common';
import { Controller, Get, Param } from '@nestjs/common';
import { Public } from 'nest-keycloak-connect';
import { NoticeOfIntentDecisionV2Service } from '../../../alcs/notice-of-intent-decision/notice-of-intent-decision-v2/notice-of-intent-decision-v2.service';
import { NoticeOfIntentDecision } from '../../../alcs/notice-of-intent-decision/notice-of-intent-decision.entity';
import { NoticeOfIntentSubmissionService } from '../../notice-of-intent-submission/notice-of-intent-submission.service';
import { NoticeOfIntentPortalDecisionDto } from './notice-of-intent-decision.dto';

@Public()
@Controller('notice-of-intent/decision')
@Controller('public/notice-of-intent/decision')
export class NoticeOfIntentDecisionController {
constructor(
private noticeOfIntentSubmissionService: NoticeOfIntentSubmissionService,
Expand All @@ -19,7 +19,6 @@ export class NoticeOfIntentDecisionController {
@Get('/:fileNumber')
async listDecisions(
@Param('fileNumber') fileNumber: string,
@Req() req,
): Promise<NoticeOfIntentPortalDecisionDto[]> {
const decisions = await this.decisionService.getForPortal(fileNumber);

Expand All @@ -31,11 +30,9 @@ export class NoticeOfIntentDecisionController {
}

@Get('/:uuid/open')
async openFile(@Param('uuid') fileUuid: string, @Req() req) {
async openFile(@Param('uuid') fileUuid: string) {
const url = await this.decisionService.getDownloadUrl(fileUuid);

//TODO: How do we know which documents applicant can access?

return { url };
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class PublicNotificationSearchService {

default:
case 'lastUpdate':
return `"notificationSearch"."status" ->> 'effectiveDate' `;
return `"notificationSearch"."status" ->> 'effective_date' `;
}
}

Expand Down

0 comments on commit c89ace7

Please sign in to comment.