Skip to content

Commit f559142

Browse files
Merge pull request #656 from US-EPA-CAMD/fix/json-hijack-v2
fixed endpoints that still returned an Array []
2 parents 479eca7 + bb4b90f commit f559142

14 files changed

+62
-34
lines changed

src/app-e-correlation-test-run-workspace/app-e-correlation-test-run-workspace.controller.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ describe('AppECorrelationTestRunWorkspaceController', () => {
9393
testSumId,
9494
appECorrTestSumId,
9595
);
96-
expect(results).toEqual(appECorrelationTestRuns);
96+
expect(results).toEqual({ items: appECorrelationTestRuns });
9797
expect(service.getAppECorrelationTestRuns).toHaveBeenCalled();
9898
});
9999
});

src/app-e-correlation-test-run-workspace/app-e-correlation-test-run-workspace.controller.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { AppECorrelationTestRunWorkspaceService } from './app-e-correlation-test
2222
import { AppECorrelationTestRunChecksService } from './app-e-correlation-test-run-checks.service';
2323
import { LookupType } from '@us-epa-camd/easey-common/enums';
2424
import { ApiExcludeControllerByEnv } from '../decorators/swagger-decorator';
25+
import { ArrayResponse } from '@us-epa-camd/easey-common/interfaces/common.interface';
2526

2627
@Controller()
2728
@ApiSecurity('APIKey')
@@ -56,8 +57,10 @@ export class AppECorrelationTestRunWorkspaceController {
5657
@Param('locId') _locationId: string,
5758
@Param('testSumId') _testSumId: string,
5859
@Param('appECorrTestSumId') appECorrTestSumId: string,
59-
) {
60-
return this.service.getAppECorrelationTestRuns(appECorrTestSumId);
60+
) : Promise<ArrayResponse<AppECorrelationTestRunBaseDTO>> {
61+
const appECorrelationTestRunBaseDTOS = await this.service.getAppECorrelationTestRuns(appECorrTestSumId);
62+
63+
return { items: appECorrelationTestRunBaseDTOS };
6164
}
6265

6366
@Get(':id')

src/app-e-correlation-test-run/app-e-correlation-test-run.controller.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ describe('AppECorrelationTestRunController', () => {
4949
testSumId,
5050
appECorrTestSumId,
5151
);
52-
expect(results).toEqual(appECorrelationTestRuns);
52+
expect(results).toEqual({ items: appECorrelationTestRuns });
5353
expect(service.getAppECorrelationTestRuns).toHaveBeenCalled();
5454
});
5555
});

src/app-e-correlation-test-run/app-e-correlation-test-run.controller.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { Controller, Get, Param } from '@nestjs/common';
22
import { ApiOkResponse, ApiSecurity, ApiTags } from '@nestjs/swagger';
3-
import { AppECorrelationTestRunRecordDTO } from '../dto/app-e-correlation-test-run.dto';
3+
import { AppECorrelationTestRunBaseDTO, AppECorrelationTestRunRecordDTO } from '../dto/app-e-correlation-test-run.dto';
44
import { AppECorrelationTestRunService } from './app-e-correlation-test-run.service';
5+
import { ArrayResponse } from '@us-epa-camd/easey-common/interfaces/common.interface';
6+
import { TestExtensionExemptionRecordDTO } from '../dto/test-extension-exemption.dto';
57

68
@Controller()
79
@ApiSecurity('APIKey')
@@ -20,8 +22,10 @@ export class AppECorrelationTestRunController {
2022
@Param('locId') _locationId: string,
2123
@Param('testSumId') _testSumId: string,
2224
@Param('appECorrTestSumId') appECorrTestSumId: string,
23-
) {
24-
return this.service.getAppECorrelationTestRuns(appECorrTestSumId);
25+
) : Promise<ArrayResponse<AppECorrelationTestRunBaseDTO>> {
26+
const appECorrelationTestRunBaseDTOS = await this.service.getAppECorrelationTestRuns(appECorrTestSumId);
27+
28+
return { items: appECorrelationTestRunBaseDTOS };
2529
}
2630

2731
@Get(':id')

src/app-e-heat-input-from-gas-workspace/app-e-heat-input-from-gas-workspace.controller.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { AppEHeatInputFromGasWorkspaceService } from './app-e-heat-input-from-ga
2323
import { AppEHeatInputFromGasChecksService } from './app-e-heat-input-from-gas-checks.service';
2424
import { LookupType } from '@us-epa-camd/easey-common/enums';
2525
import { ApiExcludeControllerByEnv } from '../decorators/swagger-decorator';
26+
import { ArrayResponse } from '@us-epa-camd/easey-common/interfaces/common.interface';
2627

2728
@Controller()
2829
@ApiSecurity('APIKey')
@@ -58,8 +59,10 @@ export class AppEHeatInputFromGasWorkspaceController {
5859
@Param('testSumId') _testSumId: string,
5960
@Param('appECorrTestSumId') _appECorrTestSumId: string,
6061
@Param('appECorrTestRunId') appECorrTestRunId: string,
61-
) {
62-
return this.service.getAppEHeatInputFromGases(appECorrTestRunId);
62+
) : Promise<ArrayResponse<AppEHeatInputFromGasRecordDTO>> {
63+
const appEHeatInputFromGasRecordDTOS = await this.service.getAppEHeatInputFromGases(appECorrTestRunId);
64+
65+
return { items: appEHeatInputFromGasRecordDTOS };
6366
}
6467

6568
@Get(':id')

src/app-e-heat-input-from-gas/app-e-heat-input-from-gas.controller.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ describe('AppEHeatInputFromGasController', () => {
5757
appECorrTestSumId,
5858
appECorrTestRunId,
5959
),
60-
).toBe(appEHIGasRecords);
60+
).toStrictEqual( { items: appEHIGasRecords } );
6161
});
6262
});
6363

src/app-e-heat-input-from-gas/app-e-heat-input-from-gas.controller.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
import { ApiOkResponse, ApiSecurity, ApiTags } from '@nestjs/swagger';
1111
import { AppEHeatInputFromGasRecordDTO } from '../dto/app-e-heat-input-from-gas.dto';
1212
import { AppEHeatInputFromGasService } from './app-e-heat-input-from-gas.service';
13+
import { ArrayResponse } from '@us-epa-camd/easey-common/interfaces/common.interface';
1314

1415
@Controller()
1516
@ApiSecurity('APIKey')
@@ -29,8 +30,10 @@ export class AppEHeatInputFromGasController {
2930
@Param('testSumId') _testSumId: string,
3031
@Param('appECorrTestSumId') _appECorrTestSumId: string,
3132
@Param('appECorrTestRunId') appECorrTestRunId: string,
32-
) {
33-
return this.service.getAppEHeatInputFromGases(appECorrTestRunId);
33+
) : Promise<ArrayResponse<AppEHeatInputFromGasRecordDTO>> {
34+
const appEHeatInputFromGasRecordDTOS = await this.service.getAppEHeatInputFromGases(appECorrTestRunId);
35+
36+
return { items: appEHeatInputFromGasRecordDTOS };
3437
}
3538

3639
@Get(':id')

src/online-offline-calibration-workspace/online-offline-calibration.controller.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ describe('Online Offline Calibration Workspace Controller', () => {
9595
locId,
9696
testSumId,
9797
);
98-
expect(result).toEqual(onlineOfflineCalibrations);
98+
expect(result).toStrictEqual( { items: onlineOfflineCalibrations } );
9999
expect(service.getOnlineOfflineCalibrations).toHaveBeenCalled();
100100
});
101101
});

src/online-offline-calibration-workspace/online-offline-calibration.controller.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ import { AuditLog, RoleGuard, User } from '@us-epa-camd/easey-common/decorators'
1717
import { CurrentUser } from '@us-epa-camd/easey-common/interfaces';
1818
import { OnlineOfflineCalibrationWorkspaceService } from '../online-offline-calibration-workspace/online-offline-calibration.service';
1919
import {
20-
OnlineOfflineCalibrationBaseDTO,
20+
OnlineOfflineCalibrationBaseDTO, OnlineOfflineCalibrationDTO,
2121
OnlineOfflineCalibrationRecordDTO,
2222
} from '../dto/online-offline-calibration.dto';
2323
import { LookupType } from '@us-epa-camd/easey-common/enums';
2424
import { ApiExcludeControllerByEnv } from '../decorators/swagger-decorator';
25+
import { ArrayResponse } from '@us-epa-camd/easey-common/interfaces/common.interface';
2526

2627
@Controller()
2728
@ApiSecurity('APIKey')
@@ -51,11 +52,13 @@ export class OnlineOfflineCalibrationWorkspaceController {
5152
label: 'Retrieved online offline calibration records for test summary',
5253
requestParamsOutFields: ['locId', 'testSumId']
5354
})
54-
getOnlineOfflineCalibrations(
55+
async getOnlineOfflineCalibrations(
5556
@Param('locId') _locationId: string,
5657
@Param('testSumId') testSumId: string,
57-
) {
58-
return this.service.getOnlineOfflineCalibrations(testSumId);
58+
) : Promise<ArrayResponse<OnlineOfflineCalibrationDTO>> {
59+
const onlineOfflineCalibrationDTOS = await this.service.getOnlineOfflineCalibrations(testSumId);
60+
61+
return { items: onlineOfflineCalibrationDTOS };
5962
}
6063

6164
@Get(':id')

src/online-offline-calibration/online-offline-calibration.controller.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ describe('Online Offline Calibration Controller', () => {
5151
locId,
5252
testSumId,
5353
);
54-
expect(result).toEqual(onlineOfflineCalibrations);
54+
expect(result).toStrictEqual( { items: onlineOfflineCalibrations } );
5555
expect(service.getOnlineOfflineCalibrations).toHaveBeenCalled();
5656
});
5757
});

0 commit comments

Comments
 (0)