Skip to content

Commit

Permalink
chore(cb2-11271): aws sdk upgrade - resolving issue post update (#404)
Browse files Browse the repository at this point in the history
* feat(cb2-11271): change to marshall options and error

* feat(cb2-11271): fix failing test

* feat(cb2-11271): fix lint

* feat(cb2-11271): add log)

* feat(cb2-11271): linting fixes

* feat(cb2-11271): removes console log

* feat(cb2-11271): remove undefined values

* feat(cb2-11271): remove undefined values
  • Loading branch information
owen-corrigan authored May 2, 2024
1 parent 061ce09 commit 1e33f10
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
15 changes: 7 additions & 8 deletions src/handlers/VehicleTestController.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import { cloneDeep, mergeWith, differenceWith, isEqual } from 'lodash';
import { EPROTONOSUPPORT } from 'constants';
import { cloneDeep, differenceWith, isEqual, mergeWith } from 'lodash';
import * as enums from '../assets/Enums';
import * as utils from '../utils';
import * as models from '../models';
import { IVehicleTestController } from './IVehicleTestController';
import { IExpiryDateStrategy } from './expiry/IExpiryDateStrategy';
import { ExpiryDateStrategyFactory } from './expiry/ExpiryDateStrategyFactory';
import { TestType } from '../models';
import { TestTypeForExpiry } from '../models/TestTypeforExpiry';
import { Service } from '../models/injector/ServiceDecorator';
import { TestDataProvider } from './expiry/providers/TestDataProvider';
import * as utils from '../utils';
import { IVehicleTestController } from './IVehicleTestController';
import { ExpiryDateStrategyFactory } from './expiry/ExpiryDateStrategyFactory';
import { IExpiryDateStrategy } from './expiry/IExpiryDateStrategy';
import { DateProvider } from './expiry/providers/DateProvider';
import { TestType } from '../models';
import { TestDataProvider } from './expiry/providers/TestDataProvider';

@Service()
export class VehicleTestController implements IVehicleTestController {
Expand Down
9 changes: 8 additions & 1 deletion src/handlers/expiry/providers/TestDataProvider.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Service } from '../../../models/injector/ServiceDecorator';
import { ConditionalCheckFailedException } from '@aws-sdk/client-dynamodb';
import * as enums from '../../../assets/Enums';
import * as models from '../../../models';
import { Service } from '../../../models/injector/ServiceDecorator';
import * as utils from '../../../utils';
import { DateProvider } from './DateProvider';
import { ITestDataProvider } from './ITestDataProvider';
Expand Down Expand Up @@ -241,6 +242,12 @@ export class TestDataProvider implements ITestDataProvider {
return result.Attributes as models.ITestResult[];
} catch (error) {
console.error('TestDataProvider.insertTestResult -> ', error);
if (
error instanceof ConditionalCheckFailedException &&
error.$response?.statusCode
) {
throw new models.HTTPError(error.$response?.statusCode, error.message);
}
throw error;
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/models/TestResultsDAO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ export class TestResultsDAO {
constructor() {
const config = Configuration.getInstance().getDynamoDBConfig();
const translateConfig = {
marshallOptions: { removeUndefinedValues: true },
marshallOptions: {
convertEmptyValues: true,
removeUndefinedValues: true,
},
};

this.tableName = config.table;
Expand Down

0 comments on commit 1e33f10

Please sign in to comment.