From 2ec8c66384d93d6ae9a50b222c9d81a9b9b61cf5 Mon Sep 17 00:00:00 2001 From: Daniel Searle <84069850+Daniel-Searle@users.noreply.github.com> Date: Tue, 20 Aug 2024 10:00:48 +0100 Subject: [PATCH] feat(CB2-13178): added in vef to the test station type and vulnerability (#415) * feat(CB2-13178): added in vef to the test station type and vulnerability * feat(CB2-13178): added in vef to the test station type and vulnerability * feat(CB2-13178): added in vef to the test station type and vulnerability * feat(CB2-13178): api spec * feat(CB2-13178): use type definitions type instead * feat(CB2-13178): use type definitions type instead * feat(CB2-13178): use type definitions type instead * feat(CB2-13178): use type definitions type instead * feat(CB2-13178): use type definition type inside test result model --- docs/test-results-api.yml | 1 + package-lock.json | 8 ++++---- package.json | 4 ++-- src/models/ITestResult.ts | 3 ++- src/models/validators/CommonSchema.ts | 6 +++--- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/docs/test-results-api.yml b/docs/test-results-api.yml index ed6b2856d..ddde8afdb 100644 --- a/docs/test-results-api.yml +++ b/docs/test-results-api.yml @@ -277,6 +277,7 @@ components: - gvts - hq - potf + - vef testerName: type: string maxLength: 60 diff --git a/package-lock.json b/package-lock.json index bd9a88c5c..b1a4a1c2a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,7 @@ "@aws-sdk/lib-dynamodb": "^3.552.0", "@aws-sdk/smithy-client": "^3.374.0", "@dvsa/cvs-microservice-common": "1.2.1", - "@dvsa/cvs-type-definitions": "6.0.0", + "@dvsa/cvs-type-definitions": "^7.4.0", "@smithy/smithy-client": "^2.5.1", "@smithy/util-utf8": "^2.3.0", "aws-lambda": "^1.0.7", @@ -3524,9 +3524,9 @@ } }, "node_modules/@dvsa/cvs-type-definitions": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/@dvsa/cvs-type-definitions/-/cvs-type-definitions-6.0.0.tgz", - "integrity": "sha512-jRPP2+J7ZWPUaSvHIaEjs6S2wO2Jd2SSAvEgGoVxKYZAmY0eyu6mIRXdhf2aRLAVXWsI/k4QLOr3ulE7ucUtZg==", + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/@dvsa/cvs-type-definitions/-/cvs-type-definitions-7.4.0.tgz", + "integrity": "sha512-MGiIQ2It0xBlu9n+RqgrnlEpsHWUoZFPqIGF4VcaMpTCgVzcNE9TriuJMmdGI6TiegzxByOIhYNNtjQYQ1x5cA==", "dependencies": { "ajv": "^8.12.0", "json-schema-deref-sync": "^0.14.0", diff --git a/package.json b/package.json index 0eea739bc..78823fc27 100644 --- a/package.json +++ b/package.json @@ -84,7 +84,8 @@ "@aws-sdk/client-lambda": "^3.552.0", "@aws-sdk/lib-dynamodb": "^3.552.0", "@aws-sdk/smithy-client": "^3.374.0", - "@dvsa/cvs-type-definitions": "6.0.0", + "@dvsa/cvs-microservice-common": "1.2.1", + "@dvsa/cvs-type-definitions": "^7.4.0", "@smithy/smithy-client": "^2.5.1", "@smithy/util-utf8": "^2.3.0", "aws-lambda": "^1.0.7", @@ -92,7 +93,6 @@ "joi": "^17.12.1", "js-yaml": "^3.14.1", "lodash": "^4.17.21", - "@dvsa/cvs-microservice-common": "1.2.1", "moment": "^2.29.4", "moment-timezone": "^0.5.40", "node-yaml": "^4.0.1", diff --git a/src/models/ITestResult.ts b/src/models/ITestResult.ts index 64b03bbfe..225553d81 100644 --- a/src/models/ITestResult.ts +++ b/src/models/ITestResult.ts @@ -1,4 +1,5 @@ import { InspectionType } from '@dvsa/cvs-type-definitions/types/required-standards/defects/get'; +import { TestStationTypes } from '@dvsa/cvs-type-definitions/types/v1/enums/testStationType.enum'; export interface ITestResult { testResultId: string; @@ -21,7 +22,7 @@ export interface ITestResult { preparerName: string; odometerReading: number; vehicleConfiguration: string; - testStationType: string; + testStationType: TestStationTypes; reasonForCancellation: string | null; testerName: string; vrm?: string; // Mandatory for PSV and HGV, not applicable to TRL diff --git a/src/models/validators/CommonSchema.ts b/src/models/validators/CommonSchema.ts index df35f436b..a65babbd4 100644 --- a/src/models/validators/CommonSchema.ts +++ b/src/models/validators/CommonSchema.ts @@ -1,6 +1,6 @@ import * as Joi from 'joi'; -import { ValidationErrorItem } from 'joi'; -import { TESTING_ERRORS, VEHICLE_TYPES } from '../../assets/Enums'; +import { TestStationTypes } from "@dvsa/cvs-type-definitions/types/v1/enums/testStationType.enum"; +import { VEHICLE_TYPES } from '../../assets/Enums'; const baseTestTypesCommonSchema = Joi.object().keys({ name: Joi.string().required(), @@ -138,7 +138,7 @@ export const testResultsCommonSchema = Joi.object().keys({ vin: Joi.string().min(1).max(21).required(), testStationName: Joi.string().max(999).required().allow('', null), testStationPNumber: Joi.string().max(20).required().allow('', null), - testStationType: Joi.string().valid('atf', 'gvts', 'hq', 'potf').required(), + testStationType: Joi.string().valid(...Object.values(TestStationTypes)).required(), testerName: Joi.string().max(60).required().allow('', null), testerEmailAddress: Joi.string().max(60).required().allow('', null), testerStaffId: Joi.string().max(36).required().allow(''),