From 6ff19c1ce3a51c706196b5858a1525f331d02017 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Albert=20Loftsson?= Date: Fri, 4 Oct 2024 14:50:57 +0000 Subject: [PATCH 1/7] check if 65 renewal is possible --- .../src/lib/drivingLicense.service.ts | 16 +- .../src/lib/drivingLicense.type.ts | 1 + .../EligibilitySummary/extractReasons.ts | 7 + .../EligibilitySummary/useEligibility.ts | 74 +- .../prerequisites/sectionApplicationFor.ts | 9 +- .../driving-license/src/lib/constants.ts | 14 + .../driving-license/src/lib/messages.ts | 10 + .../driving-license/src/lib/types.ts | 1 + .../src/lib/drivingLicenseApi.service.ts | 17 + .../driving-license/src/v5/clientConfig.json | 1465 +++++------------ 10 files changed, 550 insertions(+), 1064 deletions(-) diff --git a/libs/api/domains/driving-license/src/lib/drivingLicense.service.ts b/libs/api/domains/driving-license/src/lib/drivingLicense.service.ts index 13cd2086ac21..1ff9450c263e 100644 --- a/libs/api/domains/driving-license/src/lib/drivingLicense.service.ts +++ b/libs/api/domains/driving-license/src/lib/drivingLicense.service.ts @@ -355,8 +355,20 @@ export class DrivingLicenseService { } } - async canApplyFor(type: 'B-full' | 'B-temp' | 'BE', token: string) { - if (type === 'B-full') { + async canApplyFor( + type: 'B-full' | 'B-temp' | 'BE' | 'B-full-renewal-65', + token: string, + ) { + console.log('type', type) + if (type === 'B-full-renewal-65') { + const bla = await this.drivingLicenseApi.getCanApplyForRenewal65({ + token, + }) + console.log('bla', bla) + return this.drivingLicenseApi.getCanApplyForRenewal65({ + token, + }) + } else if (type === 'B-full') { return this.drivingLicenseApi.getCanApplyForCategoryFull({ category: 'B', token, diff --git a/libs/api/domains/driving-license/src/lib/drivingLicense.type.ts b/libs/api/domains/driving-license/src/lib/drivingLicense.type.ts index 24a6d5062b98..741ca9a09017 100644 --- a/libs/api/domains/driving-license/src/lib/drivingLicense.type.ts +++ b/libs/api/domains/driving-license/src/lib/drivingLicense.type.ts @@ -74,6 +74,7 @@ export enum RequirementKey { hasHadValidCategoryForFiveYearsOrMore = 'HasHadValidCategoryForFiveYearsOrMore', //TODO: Remove when RLS/SGS supports health certificate in BE license beRequiresHealthCertificate = 'beRequiresHealthCertificate', + noExtendedDrivingLicense = 'NoExtendedDrivingLicense', } export interface ApplicationEligibilityRequirement { diff --git a/libs/application/templates/driving-license/src/fields/EligibilitySummary/extractReasons.ts b/libs/application/templates/driving-license/src/fields/EligibilitySummary/extractReasons.ts index cc3009187f2c..d0a48764228d 100644 --- a/libs/application/templates/driving-license/src/fields/EligibilitySummary/extractReasons.ts +++ b/libs/application/templates/driving-license/src/fields/EligibilitySummary/extractReasons.ts @@ -25,6 +25,8 @@ const getDeniedByServiceMessageDescription = ( case RequirementKey.HasDeprivation: case RequirementKey.HasPoints: return requirementsMessages.hasPointsOrDeprivation + case RequirementKey.NoExtendedDrivingLicense: + return requirementsMessages.noExtendedDrivingLicenseTitle default: return requirementsMessages.rlsDefaultDeniedDescription } @@ -85,6 +87,11 @@ const requirementKeyToStep = ( title: requirementsMessages.beLicenseQualityPhotoTitle, description: requirementsMessages.beLicenseQualityPhotoDescription, } + case RequirementKey.NoExtendedDrivingLicense: + return { + title: requirementsMessages.noExtendedDrivingLicenseTitle, + description: requirementsMessages.noExtendedDrivingLicenseDescription, + } default: throw new Error('Unknown requirement reason - should not happen') } diff --git a/libs/application/templates/driving-license/src/fields/EligibilitySummary/useEligibility.ts b/libs/application/templates/driving-license/src/fields/EligibilitySummary/useEligibility.ts index 5a0b3eabb96e..d02389e46514 100644 --- a/libs/application/templates/driving-license/src/fields/EligibilitySummary/useEligibility.ts +++ b/libs/application/templates/driving-license/src/fields/EligibilitySummary/useEligibility.ts @@ -4,11 +4,14 @@ import { ApplicationEligibility, RequirementKey } from '../../types/schema' import { useQuery, gql } from '@apollo/client' import { B_FULL, + B_FULL_RENEWAL_65, BE, + codesExtendedLicenseCategories, codesRequiringHealthCertificate, DrivingLicenseApplicationFor, DrivingLicenseFakeData, otherLicenseCategories, + remarksCannotRenew65, YES, } from '../../lib/constants' import { fakeEligibility } from './fakeEligibility' @@ -111,13 +114,14 @@ export const useEligibility = ( } } + const eligibility = + data.drivingLicenseApplicationEligibility === undefined + ? [] + : (data.drivingLicenseApplicationEligibility as ApplicationEligibility) + .requirements + //TODO: Remove when RLS/SGS supports health certificate in BE license if (application.answers.applicationFor === BE) { - const eligibility = - data.drivingLicenseApplicationEligibility === undefined - ? [] - : (data.drivingLicenseApplicationEligibility as ApplicationEligibility) - .requirements return { loading: loading, eligibility: { @@ -143,6 +147,66 @@ export const useEligibility = ( } } + if (application.answers.applicationFor === B_FULL_RENEWAL_65) { + const licenseB = currentLicense?.categories?.find( + (license) => license.nr === 'B', + ) + + const drivingLicenseIssued = licenseB?.issued + + let hasExtendedDrivingLicense = false + + if (drivingLicenseIssued) { + const relevantCategories = currentLicense?.categories?.filter((x) => + codesExtendedLicenseCategories.includes(x.nr), + ) + + if (relevantCategories?.length) { + // if the user has any categories that indicate an extended driving license + hasExtendedDrivingLicense = true + + // if any of the issued dates are exactly the same, they were most likely + // created 1993 (or around that time) and are not considered extended + // drivers licenses in that case + hasExtendedDrivingLicense = !relevantCategories.some( + (x) => x.issued === drivingLicenseIssued, + ) + } + } + + const hasAnyInvalidRemarks = currentLicense?.remarks?.some((remark) => + remarksCannotRenew65.includes(remark.code), + ) + + const requirements = [ + ...eligibility, + { + key: RequirementKey.HasNoPhoto, + requirementMet: hasQualityPhoto, + }, + ] + + if (hasExtendedDrivingLicense) { + requirements.push({ + key: RequirementKey.NoExtendedDrivingLicense, + requirementMet: false, + }) + } + + return { + loading: loading, + eligibility: { + isEligible: loading + ? undefined + : (data.drivingLicenseApplicationEligibility?.isEligible ?? false) && + hasQualityPhoto && + !hasExtendedDrivingLicense && + !hasAnyInvalidRemarks, + requirements, + }, + } + } + return { loading, eligibility: data.drivingLicenseApplicationEligibility, diff --git a/libs/application/templates/driving-license/src/forms/prerequisites/sectionApplicationFor.ts b/libs/application/templates/driving-license/src/forms/prerequisites/sectionApplicationFor.ts index 5fd395596f55..a5ba5d014713 100644 --- a/libs/application/templates/driving-license/src/forms/prerequisites/sectionApplicationFor.ts +++ b/libs/application/templates/driving-license/src/forms/prerequisites/sectionApplicationFor.ts @@ -43,7 +43,7 @@ export const sectionApplicationFor = ( 'currentLicense.data', ) ?? { categories: null } - const age = + let age = getValueViaPath( app.externalData, 'nationalRegistry.data.age', @@ -53,6 +53,7 @@ export const sectionApplicationFor = ( app.answers, 'fakeData', ) + if (fakeData?.useFakeData === 'yes') { currentLicense = fakeData.currentLicense ?? null categories = @@ -66,6 +67,8 @@ export const sectionApplicationFor = ( { nr: 'BE', validToCode: 9 }, ] : [] + + age = fakeData?.age } let options = [ @@ -91,9 +94,7 @@ export const sectionApplicationFor = ( subLabel: m.applicationForRenewalLicenseDescription.defaultMessage, value: B_FULL_RENEWAL_65, - disabled: - !currentLicense || - (fakeData && fakeData.age ? fakeData.age < 65 : age < 65), + disabled: !currentLicense || age < 65, }) } diff --git a/libs/application/templates/driving-license/src/lib/constants.ts b/libs/application/templates/driving-license/src/lib/constants.ts index 27df9cbee563..672776f7bf29 100644 --- a/libs/application/templates/driving-license/src/lib/constants.ts +++ b/libs/application/templates/driving-license/src/lib/constants.ts @@ -26,6 +26,20 @@ export const CHARGE_ITEM_CODES: Record = { export const otherLicenseCategories = ['C', 'C1', 'CE', 'D', 'D1', 'DE'] export const codesRequiringHealthCertificate = ['400', '01.06'] +export const codesExtendedLicenseCategories = [ + 'C1', + 'C1E', + 'C', + 'CE', + 'D1', + 'D1E', + 'D', + 'DE', + 'Bfar', + 'Far', + 'FAR', +] +export const remarksCannotRenew65 = ['400', '450', '95'] export type DrivingLicenseApplicationFor = | typeof B_FULL diff --git a/libs/application/templates/driving-license/src/lib/messages.ts b/libs/application/templates/driving-license/src/lib/messages.ts index fdda81aaa35d..369944b3fb85 100644 --- a/libs/application/templates/driving-license/src/lib/messages.ts +++ b/libs/application/templates/driving-license/src/lib/messages.ts @@ -980,4 +980,14 @@ export const requirementsMessages = defineMessages({ description: 'requirement unmet api returned false for an unspecified reason', }, + noExtendedDrivingLicenseTitle: { + id: 'dl.application:requirementunmet.noExtendedDrivingLicenseTitle', + defaultMessage: 'Ekki hægt að sækja um endurnýjun á 65+ ökuskírteini.', + description: 'requirement unmet 65 plus renewal', + }, + noExtendedDrivingLicenseDescription: { + id: 'dl.application:requirementunmet.noExtendedDrivingLicenseDescription', + defaultMessage: 'Ekki hægt að sækja um endurnýjun á 65+ ökuskírteini.', + description: 'requirement unmet 65 plus renewal', + }, }) diff --git a/libs/application/templates/driving-license/src/lib/types.ts b/libs/application/templates/driving-license/src/lib/types.ts index 92efcfc15176..9c5d92b9a323 100644 --- a/libs/application/templates/driving-license/src/lib/types.ts +++ b/libs/application/templates/driving-license/src/lib/types.ts @@ -11,6 +11,7 @@ export type ConditionFn = (answer: FormValue) => boolean export type DrivingLicenseCategory = { nr: string validToCode: number + issued?: string } export interface Remark { diff --git a/libs/clients/driving-license/src/lib/drivingLicenseApi.service.ts b/libs/clients/driving-license/src/lib/drivingLicenseApi.service.ts index b503dff8fef7..0f2d17f8df81 100644 --- a/libs/clients/driving-license/src/lib/drivingLicenseApi.service.ts +++ b/libs/clients/driving-license/src/lib/drivingLicenseApi.service.ts @@ -372,6 +372,23 @@ export class DrivingLicenseApi { } } + public async getCanApplyForRenewal65(params: { + token: string + }): Promise> { + const response = await this.v5.apiDrivinglicenseV5CanapplyforRenewal65Get({ + apiVersion: v5.DRIVING_LICENSE_API_VERSION_V5, + apiVersion2: v5.DRIVING_LICENSE_API_VERSION_V5, + jwttoken: params.token, + }) + + return { + result: !!response.result, + errorCode: response.errorCode + ? (response.errorCode as CanApplyErrorCodeBFull) + : undefined, + } + } + public async getCanApplyForCategoryTemporary(params: { token: string }): Promise> { diff --git a/libs/clients/driving-license/src/v5/clientConfig.json b/libs/clients/driving-license/src/v5/clientConfig.json index eb4a547bab5f..3bd7edd48d20 100644 --- a/libs/clients/driving-license/src/v5/clientConfig.json +++ b/libs/clients/driving-license/src/v5/clientConfig.json @@ -2,11 +2,8 @@ "openapi": "3.0.1", "info": { "title": "RLS driver licence Rest API", - "description": "RESTFul services for driver licences. Programmed in ASP.NET Core 3 API ", - "contact": { - "name": "TMD", - "email": "tmd@tmd.is" - }, + "description": "RESTFul services for driver licences. Programmed in .NET 8", + "contact": { "name": "TMD", "email": "tmd@tmd.is" }, "version": "5.0" }, "paths": { @@ -19,29 +16,21 @@ "name": "jwttoken", "in": "header", "description": "JWT token", - "schema": { - "type": "string" - } + "schema": { "type": "string" } }, { "name": "api-version", "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "requestBody": { @@ -56,7 +45,7 @@ }, "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { "schema": { @@ -79,19 +68,13 @@ "description": "Bad Request", "content": { "text/plain": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } + "schema": { "$ref": "#/components/schemas/ProblemDetails" } }, "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } + "schema": { "$ref": "#/components/schemas/ProblemDetails" } }, "text/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } + "schema": { "$ref": "#/components/schemas/ProblemDetails" } } } } @@ -108,34 +91,26 @@ "in": "path", "description": "RLS application id", "required": true, - "schema": { - "type": "string" - } + "schema": { "type": "string" } }, { "name": "api-version", "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { "schema": { @@ -158,19 +133,13 @@ "description": "Bad Request", "content": { "text/plain": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } + "schema": { "$ref": "#/components/schemas/ProblemDetails" } }, "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } + "schema": { "$ref": "#/components/schemas/ProblemDetails" } }, "text/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } + "schema": { "$ref": "#/components/schemas/ProblemDetails" } } } } @@ -187,48 +156,36 @@ "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { "schema": { "type": "array", - "items": { - "$ref": "#/components/schemas/TegSviptingaDto" - } + "items": { "$ref": "#/components/schemas/TegSviptingaDto" } } }, "application/json": { "schema": { "type": "array", - "items": { - "$ref": "#/components/schemas/TegSviptingaDto" - } + "items": { "$ref": "#/components/schemas/TegSviptingaDto" } } }, "text/json": { "schema": { "type": "array", - "items": { - "$ref": "#/components/schemas/TegSviptingaDto" - } + "items": { "$ref": "#/components/schemas/TegSviptingaDto" } } } } @@ -246,48 +203,36 @@ "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { "schema": { "type": "array", - "items": { - "$ref": "#/components/schemas/TegundRettindaDto" - } + "items": { "$ref": "#/components/schemas/TegundRettindaDto" } } }, "application/json": { "schema": { "type": "array", - "items": { - "$ref": "#/components/schemas/TegundRettindaDto" - } + "items": { "$ref": "#/components/schemas/TegundRettindaDto" } } }, "text/json": { "schema": { "type": "array", - "items": { - "$ref": "#/components/schemas/TegundRettindaDto" - } + "items": { "$ref": "#/components/schemas/TegundRettindaDto" } } } } @@ -305,25 +250,19 @@ "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { "schema": { @@ -364,48 +303,36 @@ "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { "schema": { "type": "array", - "items": { - "$ref": "#/components/schemas/EmbaettiDto" - } + "items": { "$ref": "#/components/schemas/EmbaettiDto" } } }, "application/json": { "schema": { "type": "array", - "items": { - "$ref": "#/components/schemas/EmbaettiDto" - } + "items": { "$ref": "#/components/schemas/EmbaettiDto" } } }, "text/json": { "schema": { "type": "array", - "items": { - "$ref": "#/components/schemas/EmbaettiDto" - } + "items": { "$ref": "#/components/schemas/EmbaettiDto" } } } } @@ -422,52 +349,35 @@ "name": "jwttoken", "in": "header", "description": "Token with national id", - "schema": { - "type": "string" - } + "schema": { "type": "string" } }, { "name": "api-version", "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { - "schema": { - "type": "integer", - "format": "int32" - } + "schema": { "type": "integer", "format": "int32" } }, "application/json": { - "schema": { - "type": "integer", - "format": "int32" - } + "schema": { "type": "integer", "format": "int32" } }, "text/json": { - "schema": { - "type": "integer", - "format": "int32" - } + "schema": { "type": "integer", "format": "int32" } } } } @@ -483,52 +393,35 @@ "name": "jwttoken", "in": "header", "description": "Token with national id", - "schema": { - "type": "string" - } + "schema": { "type": "string" } }, { "name": "api-version", "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { - "schema": { - "type": "integer", - "format": "int32" - } + "schema": { "type": "integer", "format": "int32" } }, "application/json": { - "schema": { - "type": "integer", - "format": "int32" - } + "schema": { "type": "integer", "format": "int32" } }, "text/json": { - "schema": { - "type": "integer", - "format": "int32" - } + "schema": { "type": "integer", "format": "int32" } } } } @@ -544,58 +437,37 @@ "name": "jwttoken", "in": "header", "description": "Token with national id", - "schema": { - "type": "string" - } + "schema": { "type": "string" } }, { "name": "api-version", "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { - "schema": { - "type": "string", - "format": "byte" - } + "schema": { "type": "string", "format": "byte" } }, "application/json": { - "schema": { - "type": "string", - "format": "byte" - } + "schema": { "type": "string", "format": "byte" } }, - "text/json": { - "schema": { - "type": "string", - "format": "byte" - } - } + "text/json": { "schema": { "type": "string", "format": "byte" } } } }, - "204": { - "description": "No Content" - } + "204": { "description": "No Content" } } } }, @@ -608,58 +480,37 @@ "name": "jwttoken", "in": "header", "description": "Token with national id", - "schema": { - "type": "string" - } + "schema": { "type": "string" } }, { "name": "api-version", "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { - "schema": { - "type": "string", - "format": "byte" - } + "schema": { "type": "string", "format": "byte" } }, "application/json": { - "schema": { - "type": "string", - "format": "byte" - } + "schema": { "type": "string", "format": "byte" } }, - "text/json": { - "schema": { - "type": "string", - "format": "byte" - } - } + "text/json": { "schema": { "type": "string", "format": "byte" } } } }, - "204": { - "description": "No Content" - } + "204": { "description": "No Content" } } } }, @@ -673,34 +524,26 @@ "in": "path", "description": "Person social serial number", "required": true, - "schema": { - "type": "string" - } + "schema": { "type": "string" } }, { "name": "api-version", "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { "schema": { @@ -732,49 +575,35 @@ "name": "jwttoken", "in": "header", "description": "Token with national id", - "schema": { - "type": "string" - } + "schema": { "type": "string" } }, { "name": "api-version", "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { - "schema": { - "$ref": "#/components/schemas/DriverLicenseDto" - } + "schema": { "$ref": "#/components/schemas/DriverLicenseDto" } }, "application/json": { - "schema": { - "$ref": "#/components/schemas/DriverLicenseDto" - } + "schema": { "$ref": "#/components/schemas/DriverLicenseDto" } }, "text/json": { - "schema": { - "$ref": "#/components/schemas/DriverLicenseDto" - } + "schema": { "$ref": "#/components/schemas/DriverLicenseDto" } } } }, @@ -782,19 +611,13 @@ "description": "Bad Request", "content": { "text/plain": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } + "schema": { "$ref": "#/components/schemas/ProblemDetails" } }, "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } + "schema": { "$ref": "#/components/schemas/ProblemDetails" } }, "text/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } + "schema": { "$ref": "#/components/schemas/ProblemDetails" } } } } @@ -810,52 +633,36 @@ "name": "jwttoken", "in": "header", "description": "Token with national id", - "schema": { - "type": "string" - } + "schema": { "type": "string" } }, { "name": "api-version", "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "responses": { - "204": { - "description": "No Content" - }, + "204": { "description": "No Content" }, "400": { "description": "Bad Request", "content": { "text/plain": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } + "schema": { "$ref": "#/components/schemas/ProblemDetails" } }, "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } + "schema": { "$ref": "#/components/schemas/ProblemDetails" } }, "text/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } + "schema": { "$ref": "#/components/schemas/ProblemDetails" } } } } @@ -872,42 +679,32 @@ "in": "path", "description": "Category to check for (B, C, and so on)", "required": true, - "schema": { - "type": "string" - } + "schema": { "type": "string" } }, { "name": "jwttoken", "in": "header", "description": "Token with national id", - "schema": { - "type": "string" - } + "schema": { "type": "string" } }, { "name": "api-version", "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { "schema": { @@ -939,62 +736,43 @@ "in": "path", "description": "Category in license", "required": true, - "schema": { - "type": "string" - } + "schema": { "type": "string" } }, { "name": "api-version", "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "requestBody": { "description": "Model of application", "content": { "application/json": { - "schema": { - "$ref": "#/components/schemas/PostNewFinalLicense" - } + "schema": { "$ref": "#/components/schemas/PostNewFinalLicense" } } } }, "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { - "schema": { - "type": "integer", - "format": "int32" - } + "schema": { "type": "integer", "format": "int32" } }, "application/json": { - "schema": { - "type": "integer", - "format": "int32" - } + "schema": { "type": "integer", "format": "int32" } }, "text/json": { - "schema": { - "type": "integer", - "format": "int32" - } + "schema": { "type": "integer", "format": "int32" } } } }, @@ -1002,19 +780,13 @@ "description": "Bad Request", "content": { "text/plain": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } + "schema": { "$ref": "#/components/schemas/ProblemDetails" } }, "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } + "schema": { "$ref": "#/components/schemas/ProblemDetails" } }, "text/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } + "schema": { "$ref": "#/components/schemas/ProblemDetails" } } } } @@ -1030,38 +802,28 @@ "name": "jwttoken", "in": "header", "description": "JWT token", - "schema": { - "type": "string" - } + "schema": { "type": "string" } }, { "name": "api-version", "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "requestBody": { "description": "Model of application", "content": { "application/json": { - "schema": { - "$ref": "#/components/schemas/PostNewCollaborative" - } + "schema": { "$ref": "#/components/schemas/PostNewCollaborative" } } } }, @@ -1070,22 +832,13 @@ "description": "Created", "content": { "text/plain": { - "schema": { - "type": "integer", - "format": "int32" - } + "schema": { "type": "integer", "format": "int32" } }, "application/json": { - "schema": { - "type": "integer", - "format": "int32" - } + "schema": { "type": "integer", "format": "int32" } }, "text/json": { - "schema": { - "type": "integer", - "format": "int32" - } + "schema": { "type": "integer", "format": "int32" } } } }, @@ -1093,19 +846,13 @@ "description": "Bad Request", "content": { "text/plain": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } + "schema": { "$ref": "#/components/schemas/ProblemDetails" } }, "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } + "schema": { "$ref": "#/components/schemas/ProblemDetails" } }, "text/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } + "schema": { "$ref": "#/components/schemas/ProblemDetails" } } } } @@ -1121,49 +868,35 @@ "name": "jwttoken", "in": "header", "description": "Token with national id", - "schema": { - "type": "string" - } + "schema": { "type": "string" } }, { "name": "api-version", "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { - "schema": { - "$ref": "#/components/schemas/DeprivationDto" - } + "schema": { "$ref": "#/components/schemas/DeprivationDto" } }, "application/json": { - "schema": { - "$ref": "#/components/schemas/DeprivationDto" - } + "schema": { "$ref": "#/components/schemas/DeprivationDto" } }, "text/json": { - "schema": { - "$ref": "#/components/schemas/DeprivationDto" - } + "schema": { "$ref": "#/components/schemas/DeprivationDto" } } } } @@ -1180,29 +913,21 @@ "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "requestBody": { "description": "Model of application", "content": { "application/json": { - "schema": { - "$ref": "#/components/schemas/PostTemporaryLicense" - } + "schema": { "$ref": "#/components/schemas/PostTemporaryLicense" } } } }, @@ -1259,29 +984,21 @@ "name": "jwttoken", "in": "header", "description": "JWT token", - "schema": { - "type": "string" - } + "schema": { "type": "string" } }, { "name": "api-version", "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "requestBody": { @@ -1349,20 +1066,14 @@ "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "requestBody": { @@ -1377,7 +1088,7 @@ }, "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { "schema": { @@ -1428,49 +1139,35 @@ "name": "jwttoken", "in": "header", "description": "Token with national id", - "schema": { - "type": "string" - } + "schema": { "type": "string" } }, { "name": "api-version", "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { - "schema": { - "$ref": "#/components/schemas/PenaltyPointsDto" - } + "schema": { "$ref": "#/components/schemas/PenaltyPointsDto" } }, "application/json": { - "schema": { - "$ref": "#/components/schemas/PenaltyPointsDto" - } + "schema": { "$ref": "#/components/schemas/PenaltyPointsDto" } }, "text/json": { - "schema": { - "$ref": "#/components/schemas/PenaltyPointsDto" - } + "schema": { "$ref": "#/components/schemas/PenaltyPointsDto" } } } } @@ -1485,34 +1182,26 @@ { "name": "jwttoken", "in": "header", - "schema": { - "type": "string" - } + "schema": { "type": "string" } }, { "name": "api-version", "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { "schema": { @@ -1544,19 +1233,13 @@ "description": "Bad Request", "content": { "text/plain": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } + "schema": { "$ref": "#/components/schemas/ProblemDetails" } }, "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } + "schema": { "$ref": "#/components/schemas/ProblemDetails" } }, "text/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } + "schema": { "$ref": "#/components/schemas/ProblemDetails" } } } } @@ -1572,52 +1255,35 @@ "name": "jwttoken", "in": "header", "description": "Token with national id", - "schema": { - "type": "string" - } + "schema": { "type": "string" } }, { "name": "api-version", "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { - "schema": { - "type": "integer", - "format": "int32" - } + "schema": { "type": "integer", "format": "int32" } }, "application/json": { - "schema": { - "type": "integer", - "format": "int32" - } + "schema": { "type": "integer", "format": "int32" } }, "text/json": { - "schema": { - "type": "integer", - "format": "int32" - } + "schema": { "type": "integer", "format": "int32" } } } } @@ -1634,34 +1300,26 @@ "name": "jwttoken", "in": "header", "description": "Token with national id", - "schema": { - "type": "string" - } + "schema": { "type": "string" } }, { "name": "api-version", "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { "schema": { @@ -1692,52 +1350,35 @@ "name": "jwttoken", "in": "header", "description": "Token with national id", - "schema": { - "type": "string" - } + "schema": { "type": "string" } }, { "name": "api-version", "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { - "schema": { - "type": "integer", - "format": "int32" - } + "schema": { "type": "integer", "format": "int32" } }, "application/json": { - "schema": { - "type": "integer", - "format": "int32" - } + "schema": { "type": "integer", "format": "int32" } }, "text/json": { - "schema": { - "type": "integer", - "format": "int32" - } + "schema": { "type": "integer", "format": "int32" } } } } @@ -1753,52 +1394,35 @@ "name": "jwttoken", "in": "header", "description": "Token with national id", - "schema": { - "type": "string" - } + "schema": { "type": "string" } }, { "name": "api-version", "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { - "schema": { - "type": "integer", - "format": "int32" - } + "schema": { "type": "integer", "format": "int32" } }, "application/json": { - "schema": { - "type": "integer", - "format": "int32" - } + "schema": { "type": "integer", "format": "int32" } }, "text/json": { - "schema": { - "type": "integer", - "format": "int32" - } + "schema": { "type": "integer", "format": "int32" } } } } @@ -1814,58 +1438,37 @@ "name": "jwttoken", "in": "header", "description": "Token with national id", - "schema": { - "type": "string" - } + "schema": { "type": "string" } }, { "name": "api-version", "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { - "schema": { - "type": "string", - "format": "byte" - } + "schema": { "type": "string", "format": "byte" } }, "application/json": { - "schema": { - "type": "string", - "format": "byte" - } + "schema": { "type": "string", "format": "byte" } }, - "text/json": { - "schema": { - "type": "string", - "format": "byte" - } - } + "text/json": { "schema": { "type": "string", "format": "byte" } } } }, - "204": { - "description": "No Content" - } + "204": { "description": "No Content" } } } }, @@ -1878,58 +1481,37 @@ "name": "jwttoken", "in": "header", "description": "Token with national id", - "schema": { - "type": "string" - } + "schema": { "type": "string" } }, { "name": "api-version", "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { - "schema": { - "type": "string", - "format": "byte" - } + "schema": { "type": "string", "format": "byte" } }, "application/json": { - "schema": { - "type": "string", - "format": "byte" - } + "schema": { "type": "string", "format": "byte" } }, - "text/json": { - "schema": { - "type": "string", - "format": "byte" - } - } + "text/json": { "schema": { "type": "string", "format": "byte" } } } }, - "204": { - "description": "No Content" - } + "204": { "description": "No Content" } } } }, @@ -1941,34 +1523,26 @@ { "name": "jwttoken", "in": "header", - "schema": { - "type": "string" - } + "schema": { "type": "string" } }, { "name": "api-version", "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { "schema": { @@ -2000,20 +1574,14 @@ "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "requestBody": { @@ -2027,26 +1595,18 @@ } }, "responses": { - "204": { - "description": "No Content" - }, + "204": { "description": "No Content" }, "400": { "description": "Bad Request", "content": { "text/plain": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } + "schema": { "$ref": "#/components/schemas/ProblemDetails" } }, "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } + "schema": { "$ref": "#/components/schemas/ProblemDetails" } }, "text/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } + "schema": { "$ref": "#/components/schemas/ProblemDetails" } } } } @@ -2060,34 +1620,26 @@ "name": "jwttoken", "in": "header", "description": "Token with national id", - "schema": { - "type": "string" - } + "schema": { "type": "string" } }, { "name": "api-version", "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { "schema": { @@ -2110,19 +1662,13 @@ "description": "Not Found", "content": { "text/plain": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } + "schema": { "$ref": "#/components/schemas/ProblemDetails" } }, "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } + "schema": { "$ref": "#/components/schemas/ProblemDetails" } }, "text/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } + "schema": { "$ref": "#/components/schemas/ProblemDetails" } } } } @@ -2139,48 +1685,36 @@ "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { "schema": { "type": "array", - "items": { - "$ref": "#/components/schemas/InstructorDto" - } + "items": { "$ref": "#/components/schemas/InstructorDto" } } }, "application/json": { "schema": { "type": "array", - "items": { - "$ref": "#/components/schemas/InstructorDto" - } + "items": { "$ref": "#/components/schemas/InstructorDto" } } }, "text/json": { "schema": { "type": "array", - "items": { - "$ref": "#/components/schemas/InstructorDto" - } + "items": { "$ref": "#/components/schemas/InstructorDto" } } } } @@ -2199,49 +1733,35 @@ "in": "path", "description": "Driver license number", "required": true, - "schema": { - "type": "string" - } + "schema": { "type": "string" } }, { "name": "api-version", "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { - "schema": { - "$ref": "#/components/schemas/LicenseStatusDto" - } + "schema": { "$ref": "#/components/schemas/LicenseStatusDto" } }, "application/json": { - "schema": { - "$ref": "#/components/schemas/LicenseStatusDto" - } + "schema": { "$ref": "#/components/schemas/LicenseStatusDto" } }, "text/json": { - "schema": { - "$ref": "#/components/schemas/LicenseStatusDto" - } + "schema": { "$ref": "#/components/schemas/LicenseStatusDto" } } } } @@ -2258,67 +1778,48 @@ "in": "path", "description": "Category to check, optional, default B", "required": true, - "schema": { - "type": "string" - } + "schema": { "type": "string" } }, { "name": "drivinglicenseid", "in": "path", "description": "License id, optional, default persons newest license", "required": true, - "schema": { - "type": "integer", - "format": "int32" - } + "schema": { "type": "integer", "format": "int32" } }, { "name": "jwttoken", "in": "header", "description": "Token with national id", - "schema": { - "type": "string" - } + "schema": { "type": "string" } }, { "name": "api-version", "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { - "schema": { - "$ref": "#/components/schemas/CategoryValidDto" - } + "schema": { "$ref": "#/components/schemas/CategoryValidDto" } }, "application/json": { - "schema": { - "$ref": "#/components/schemas/CategoryValidDto" - } + "schema": { "$ref": "#/components/schemas/CategoryValidDto" } }, "text/json": { - "schema": { - "$ref": "#/components/schemas/CategoryValidDto" - } + "schema": { "$ref": "#/components/schemas/CategoryValidDto" } } } } @@ -2335,42 +1836,32 @@ "in": "path", "description": "License category", "required": true, - "schema": { - "type": "string" - } + "schema": { "type": "string" } }, { "name": "jwttoken", "in": "header", "description": "Token with national id", - "schema": { - "type": "string" - } + "schema": { "type": "string" } }, { "name": "api-version", "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { "schema": { @@ -2401,59 +1892,43 @@ "name": "jwttoken", "in": "header", "description": "Token with national id", - "schema": { - "type": "string" - } + "schema": { "type": "string" } }, { "name": "api-version", "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "requestBody": { "description": "Model with information about the practice permit", "content": { "application/json": { - "schema": { - "$ref": "#/components/schemas/PostPracticePermit" - } + "schema": { "$ref": "#/components/schemas/PostPracticePermit" } } } }, "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { - "schema": { - "$ref": "#/components/schemas/PracticePermitDto" - } + "schema": { "$ref": "#/components/schemas/PracticePermitDto" } }, "application/json": { - "schema": { - "$ref": "#/components/schemas/PracticePermitDto" - } + "schema": { "$ref": "#/components/schemas/PracticePermitDto" } }, "text/json": { - "schema": { - "$ref": "#/components/schemas/PracticePermitDto" - } + "schema": { "$ref": "#/components/schemas/PracticePermitDto" } } } }, @@ -2461,19 +1936,13 @@ "description": "Bad Request", "content": { "text/plain": { - "schema": { - "$ref": "#/components/schemas/PracticePermitDto" - } + "schema": { "$ref": "#/components/schemas/PracticePermitDto" } }, "application/json": { - "schema": { - "$ref": "#/components/schemas/PracticePermitDto" - } + "schema": { "$ref": "#/components/schemas/PracticePermitDto" } }, "text/json": { - "schema": { - "$ref": "#/components/schemas/PracticePermitDto" - } + "schema": { "$ref": "#/components/schemas/PracticePermitDto" } } } } @@ -2489,78 +1958,106 @@ "name": "jwttoken", "in": "header", "description": "Token with national id", - "schema": { - "type": "string" - } + "schema": { "type": "string" } }, { "name": "api-version", "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "requestBody": { "description": "Model with information about the practice permit", "content": { "application/json": { - "schema": { - "$ref": "#/components/schemas/PostPracticePermit" - } + "schema": { "$ref": "#/components/schemas/PostPracticePermit" } } } }, "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { - "schema": { - "$ref": "#/components/schemas/PracticePermitDto" - } + "schema": { "$ref": "#/components/schemas/PracticePermitDto" } }, "application/json": { - "schema": { - "$ref": "#/components/schemas/PracticePermitDto" - } + "schema": { "$ref": "#/components/schemas/PracticePermitDto" } }, "text/json": { - "schema": { - "$ref": "#/components/schemas/PracticePermitDto" - } + "schema": { "$ref": "#/components/schemas/PracticePermitDto" } } } }, "400": { "description": "Bad Request", + "content": { + "text/plain": { + "schema": { "$ref": "#/components/schemas/PracticePermitDto" } + }, + "application/json": { + "schema": { "$ref": "#/components/schemas/PracticePermitDto" } + }, + "text/json": { + "schema": { "$ref": "#/components/schemas/PracticePermitDto" } + } + } + } + } + } + }, + "/api/drivinglicense/v5/canapplyfor/renewal65": { + "get": { + "tags": ["Okuskirteini"], + "summary": "Check if person over 65 years old can apply for renewal of drivers license", + "parameters": [ + { + "name": "jwttoken", + "in": "header", + "description": "Token with person social security number", + "schema": { "type": "string" } + }, + { + "name": "api-version", + "in": "header", + "description": "The requested API version", + "required": true, + "schema": { "type": "string", "default": "5.0" } + }, + { + "name": "api-version", + "in": "query", + "description": "The requested API version", + "required": true, + "schema": { "type": "string", "default": "5.0" } + } + ], + "responses": { + "200": { + "description": "OK", "content": { "text/plain": { "schema": { - "$ref": "#/components/schemas/PracticePermitDto" + "$ref": "#/components/schemas/MayApplyForRenewal65" } }, "application/json": { "schema": { - "$ref": "#/components/schemas/PracticePermitDto" + "$ref": "#/components/schemas/MayApplyForRenewal65" } }, "text/json": { "schema": { - "$ref": "#/components/schemas/PracticePermitDto" + "$ref": "#/components/schemas/MayApplyForRenewal65" } } } @@ -2577,59 +2074,43 @@ "name": "jwttoken", "in": "header", "description": "Token with person social security number", - "schema": { - "type": "string" - } + "schema": { "type": "string" } }, { "name": "api-version", "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "requestBody": { "description": "Model with information about the person", "content": { "application/json": { - "schema": { - "$ref": "#/components/schemas/PostRenewal65AndOver" - } + "schema": { "$ref": "#/components/schemas/PostRenewal65AndOver" } } } }, "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { - "schema": { - "$ref": "#/components/schemas/Renewal65AndOver" - } + "schema": { "$ref": "#/components/schemas/Renewal65AndOver" } }, "application/json": { - "schema": { - "$ref": "#/components/schemas/Renewal65AndOver" - } + "schema": { "$ref": "#/components/schemas/Renewal65AndOver" } }, "text/json": { - "schema": { - "$ref": "#/components/schemas/Renewal65AndOver" - } + "schema": { "$ref": "#/components/schemas/Renewal65AndOver" } } } }, @@ -2637,19 +2118,13 @@ "description": "Bad Request", "content": { "text/plain": { - "schema": { - "$ref": "#/components/schemas/Renewal65AndOver" - } + "schema": { "$ref": "#/components/schemas/Renewal65AndOver" } }, "application/json": { - "schema": { - "$ref": "#/components/schemas/Renewal65AndOver" - } + "schema": { "$ref": "#/components/schemas/Renewal65AndOver" } }, "text/json": { - "schema": { - "$ref": "#/components/schemas/Renewal65AndOver" - } + "schema": { "$ref": "#/components/schemas/Renewal65AndOver" } } } } @@ -2666,47 +2141,33 @@ "in": "path", "description": "Year from", "required": true, - "schema": { - "type": "integer", - "format": "int32", - "default": 2022 - } + "schema": { "type": "integer", "format": "int32", "default": 2022 } }, { "name": "monthfrom", "in": "path", "description": "Month from", "required": true, - "schema": { - "type": "integer", - "format": "int32", - "default": 1 - } + "schema": { "type": "integer", "format": "int32", "default": 1 } }, { "name": "api-version", "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { "schema": { @@ -2747,47 +2208,33 @@ "in": "path", "description": "Year from", "required": true, - "schema": { - "type": "integer", - "format": "int32", - "default": 2022 - } + "schema": { "type": "integer", "format": "int32", "default": 2022 } }, { "name": "monthfrom", "in": "path", "description": "Month from", "required": true, - "schema": { - "type": "integer", - "format": "int32", - "default": 1 - } + "schema": { "type": "integer", "format": "int32", "default": 1 } }, { "name": "api-version", "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { "schema": { @@ -2828,47 +2275,33 @@ "in": "path", "description": "Year from", "required": true, - "schema": { - "type": "integer", - "format": "int32", - "default": 2022 - } + "schema": { "type": "integer", "format": "int32", "default": 2022 } }, { "name": "monthfrom", "in": "path", "description": "Month from", "required": true, - "schema": { - "type": "integer", - "format": "int32", - "default": 1 - } + "schema": { "type": "integer", "format": "int32", "default": 1 } }, { "name": "api-version", "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { "schema": { @@ -2909,47 +2342,33 @@ "in": "path", "description": "Year from", "required": true, - "schema": { - "type": "integer", - "format": "int32", - "default": 2022 - } + "schema": { "type": "integer", "format": "int32", "default": 2022 } }, { "name": "monthfrom", "in": "path", "description": "Month from", "required": true, - "schema": { - "type": "integer", - "format": "int32", - "default": 1 - } + "schema": { "type": "integer", "format": "int32", "default": 1 } }, { "name": "api-version", "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { "schema": { @@ -2990,47 +2409,33 @@ "in": "path", "description": "Year from", "required": true, - "schema": { - "type": "integer", - "format": "int32", - "default": 2022 - } + "schema": { "type": "integer", "format": "int32", "default": 2022 } }, { "name": "monthfrom", "in": "path", "description": "Month from", "required": true, - "schema": { - "type": "integer", - "format": "int32", - "default": 1 - } + "schema": { "type": "integer", "format": "int32", "default": 1 } }, { "name": "api-version", "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { "schema": { @@ -3071,47 +2476,33 @@ "in": "path", "description": "Year from", "required": true, - "schema": { - "type": "integer", - "format": "int32", - "default": 2022 - } + "schema": { "type": "integer", "format": "int32", "default": 2022 } }, { "name": "monthfrom", "in": "path", "description": "Month from", "required": true, - "schema": { - "type": "integer", - "format": "int32", - "default": 1 - } + "schema": { "type": "integer", "format": "int32", "default": 1 } }, { "name": "api-version", "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { "schema": { @@ -3151,67 +2542,50 @@ "name": "jwttoken", "in": "header", "description": "jwt token", - "schema": { - "type": "string" - } + "schema": { "type": "string" } }, { "name": "licenseid", "in": "path", "description": "License id", "required": true, - "schema": { - "type": "integer", - "format": "int32" - } + "schema": { "type": "integer", "format": "int32" } }, { "name": "api-version", "in": "header", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } }, { "name": "api-version", "in": "query", "description": "The requested API version", "required": true, - "schema": { - "type": "string", - "default": "5.0" - } + "schema": { "type": "string", "default": "5.0" } } ], "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "text/plain": { "schema": { "type": "array", - "items": { - "$ref": "#/components/schemas/MedferdDto" - } + "items": { "$ref": "#/components/schemas/MedferdDto" } } }, "application/json": { "schema": { "type": "array", - "items": { - "$ref": "#/components/schemas/MedferdDto" - } + "items": { "$ref": "#/components/schemas/MedferdDto" } } }, "text/json": { "schema": { "type": "array", - "items": { - "$ref": "#/components/schemas/MedferdDto" - } + "items": { "$ref": "#/components/schemas/MedferdDto" } } } } @@ -3220,19 +2594,13 @@ "description": "Bad Request", "content": { "text/plain": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } + "schema": { "$ref": "#/components/schemas/ProblemDetails" } }, "application/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } + "schema": { "$ref": "#/components/schemas/ProblemDetails" } }, "text/json": { - "schema": { - "$ref": "#/components/schemas/ProblemDetails" - } + "schema": { "$ref": "#/components/schemas/ProblemDetails" } } } } @@ -3410,20 +2778,12 @@ "DriverLicenseDto": { "type": "object", "properties": { - "id": { - "type": "integer", - "description": "Id", - "format": "int32" - }, + "id": { "type": "integer", "description": "Id", "format": "int32" }, "temporaryLicense": { "type": "boolean", "description": "Is this license marked as temporary" }, - "name": { - "type": "string", - "description": "Name", - "nullable": true - }, + "name": { "type": "string", "description": "Name", "nullable": true }, "socialSecurityNumber": { "type": "string", "description": "Persond id number", @@ -3462,17 +2822,13 @@ }, "categories": { "type": "array", - "items": { - "$ref": "#/components/schemas/CategoryDto" - }, + "items": { "$ref": "#/components/schemas/CategoryDto" }, "description": "Category list", "nullable": true }, "comments": { "type": "array", - "items": { - "$ref": "#/components/schemas/LicenseCommentsDto" - }, + "items": { "$ref": "#/components/schemas/LicenseCommentsDto" }, "description": "Remark list", "nullable": true }, @@ -3488,15 +2844,9 @@ "format": "int32", "nullable": true }, - "photo": { - "$ref": "#/components/schemas/ImageDto" - }, - "signature": { - "$ref": "#/components/schemas/ImageDto" - }, - "deprivation": { - "$ref": "#/components/schemas/DeprivationDto" - } + "photo": { "$ref": "#/components/schemas/ImageDto" }, + "signature": { "$ref": "#/components/schemas/ImageDto" }, + "deprivation": { "$ref": "#/components/schemas/DeprivationDto" } }, "additionalProperties": false, "description": "Licence entity" @@ -3504,16 +2854,8 @@ "DriverLicenseWithoutImagesDto": { "type": "object", "properties": { - "id": { - "type": "integer", - "description": "Id", - "format": "int32" - }, - "name": { - "type": "string", - "description": "Name", - "nullable": true - }, + "id": { "type": "integer", "description": "Id", "format": "int32" }, + "name": { "type": "string", "description": "Name", "nullable": true }, "socialSecurityNumber": { "type": "string", "description": "Persond id number", @@ -3552,9 +2894,7 @@ }, "categories": { "type": "array", - "items": { - "$ref": "#/components/schemas/CategoryDto" - }, + "items": { "$ref": "#/components/schemas/CategoryDto" }, "description": "Category list", "nullable": true }, @@ -3565,15 +2905,11 @@ }, "comments": { "type": "array", - "items": { - "$ref": "#/components/schemas/LicenseCommentsDto" - }, + "items": { "$ref": "#/components/schemas/LicenseCommentsDto" }, "description": "Remark list", "nullable": true }, - "deprivation": { - "$ref": "#/components/schemas/DeprivationDto" - } + "deprivation": { "$ref": "#/components/schemas/DeprivationDto" } }, "additionalProperties": false, "description": "Licence entity" @@ -3886,9 +3222,7 @@ "properties": { "images": { "type": "array", - "items": { - "$ref": "#/components/schemas/ImageFromThjodskraDto" - }, + "items": { "$ref": "#/components/schemas/ImageFromThjodskraDto" }, "description": "Array of all images from thjodskra", "nullable": true } @@ -3904,11 +3238,7 @@ "description": "Public identity number", "nullable": true }, - "name": { - "type": "string", - "description": "Name", - "nullable": true - }, + "name": { "type": "string", "description": "Name", "nullable": true }, "driverLicenseId": { "type": "integer", "description": "Númer ökuskírteinis ökukennara", @@ -4009,6 +3339,22 @@ "additionalProperties": false, "description": "Data transfer object for results for person applying for\r\nfull license" }, + "MayApplyForRenewal65": { + "type": "object", + "properties": { + "result": { + "type": "boolean", + "description": "Can person apply for full license for 65+ years old" + }, + "errorCode": { + "type": "string", + "description": "Error code if can not apply", + "nullable": true + } + }, + "additionalProperties": false, + "description": "Can person apply for renewal of license for 65+ years old" + }, "MayApplyForTemporaryLicenseDto": { "type": "object", "properties": { @@ -4150,6 +3496,14 @@ "type": "integer", "description": "Ordering district", "format": "int32" + }, + "contentList": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RLSApplicationContentModel" + }, + "description": "Content list", + "nullable": true } }, "additionalProperties": false, @@ -4467,10 +3821,7 @@ "description": "The instructor", "nullable": true }, - "isOk": { - "type": "boolean", - "description": "Is the record OK" - }, + "isOk": { "type": "boolean", "description": "Is the record OK" }, "errorCode": { "type": "string", "description": "Error code, if any", @@ -4483,29 +3834,45 @@ "ProblemDetails": { "type": "object", "properties": { - "type": { + "type": { "type": "string", "nullable": true }, + "title": { "type": "string", "nullable": true }, + "status": { "type": "integer", "format": "int32", "nullable": true }, + "detail": { "type": "string", "nullable": true }, + "instance": { "type": "string", "nullable": true } + }, + "additionalProperties": false + }, + "RLSApplicationContentModel": { + "type": "object", + "properties": { + "fileName": { "type": "string", + "description": "File name", "nullable": true }, - "title": { + "fileExtension": { "type": "string", + "description": "File extension", "nullable": true }, - "status": { - "type": "integer", - "format": "int32", + "contentType": { + "type": "string", + "description": "Content type", "nullable": true }, - "detail": { + "content": { "type": "string", + "description": "Content data", "nullable": true }, - "instance": { + "description": { "type": "string", + "description": "File description", "nullable": true } }, - "additionalProperties": false + "additionalProperties": false, + "description": "RLS Application content" }, "Renewal65AndOver": { "type": "object", @@ -4532,16 +3899,8 @@ "TegSviptingaDto": { "type": "object", "properties": { - "id": { - "type": "integer", - "description": "Id", - "format": "int32" - }, - "heiti": { - "type": "string", - "description": "Name", - "nullable": true - } + "id": { "type": "integer", "description": "Id", "format": "int32" }, + "heiti": { "type": "string", "description": "Name", "nullable": true } }, "additionalProperties": false, "description": "Dto for Tegund sviptinga" From 298773317c697f233fefc03638635d0484f47490 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Albert=20Loftsson?= Date: Mon, 7 Oct 2024 12:54:48 +0000 Subject: [PATCH 2/7] remove console log --- .../domains/driving-license/src/lib/drivingLicense.service.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/libs/api/domains/driving-license/src/lib/drivingLicense.service.ts b/libs/api/domains/driving-license/src/lib/drivingLicense.service.ts index 1ff9450c263e..a5fe82b588e3 100644 --- a/libs/api/domains/driving-license/src/lib/drivingLicense.service.ts +++ b/libs/api/domains/driving-license/src/lib/drivingLicense.service.ts @@ -359,7 +359,6 @@ export class DrivingLicenseService { type: 'B-full' | 'B-temp' | 'BE' | 'B-full-renewal-65', token: string, ) { - console.log('type', type) if (type === 'B-full-renewal-65') { const bla = await this.drivingLicenseApi.getCanApplyForRenewal65({ token, From 10a85b2af8b45dd61115231445b4bb70b332f4b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Albert=20Loftsson?= Date: Mon, 7 Oct 2024 12:55:21 +0000 Subject: [PATCH 3/7] cleanup --- .../domains/driving-license/src/lib/drivingLicense.service.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/libs/api/domains/driving-license/src/lib/drivingLicense.service.ts b/libs/api/domains/driving-license/src/lib/drivingLicense.service.ts index a5fe82b588e3..9cb539b8105c 100644 --- a/libs/api/domains/driving-license/src/lib/drivingLicense.service.ts +++ b/libs/api/domains/driving-license/src/lib/drivingLicense.service.ts @@ -360,10 +360,6 @@ export class DrivingLicenseService { token: string, ) { if (type === 'B-full-renewal-65') { - const bla = await this.drivingLicenseApi.getCanApplyForRenewal65({ - token, - }) - console.log('bla', bla) return this.drivingLicenseApi.getCanApplyForRenewal65({ token, }) From 1e66da8e9a7b7e77a11b782649d83d7758a02b40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Albert=20Loftsson?= Date: Mon, 7 Oct 2024 13:20:00 +0000 Subject: [PATCH 4/7] coderabbit tweaks --- .../src/lib/drivingLicense.type.ts | 1 - .../EligibilitySummary/useEligibility.ts | 25 +++++++++++-------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/libs/api/domains/driving-license/src/lib/drivingLicense.type.ts b/libs/api/domains/driving-license/src/lib/drivingLicense.type.ts index 741ca9a09017..24a6d5062b98 100644 --- a/libs/api/domains/driving-license/src/lib/drivingLicense.type.ts +++ b/libs/api/domains/driving-license/src/lib/drivingLicense.type.ts @@ -74,7 +74,6 @@ export enum RequirementKey { hasHadValidCategoryForFiveYearsOrMore = 'HasHadValidCategoryForFiveYearsOrMore', //TODO: Remove when RLS/SGS supports health certificate in BE license beRequiresHealthCertificate = 'beRequiresHealthCertificate', - noExtendedDrivingLicense = 'NoExtendedDrivingLicense', } export interface ApplicationEligibilityRequirement { diff --git a/libs/application/templates/driving-license/src/fields/EligibilitySummary/useEligibility.ts b/libs/application/templates/driving-license/src/fields/EligibilitySummary/useEligibility.ts index d02389e46514..38bf4e296c26 100644 --- a/libs/application/templates/driving-license/src/fields/EligibilitySummary/useEligibility.ts +++ b/libs/application/templates/driving-license/src/fields/EligibilitySummary/useEligibility.ts @@ -1,6 +1,10 @@ import { getValueViaPath } from '@island.is/application/core' import { Application } from '@island.is/application/types' -import { ApplicationEligibility, RequirementKey } from '../../types/schema' +import { + ApplicationEligibility, + ApplicationEligibilityRequirement, + RequirementKey, +} from '../../types/schema' import { useQuery, gql } from '@apollo/client' import { B_FULL, @@ -114,7 +118,7 @@ export const useEligibility = ( } } - const eligibility = + const eligibility: ApplicationEligibilityRequirement[] = data.drivingLicenseApplicationEligibility === undefined ? [] : (data.drivingLicenseApplicationEligibility as ApplicationEligibility) @@ -162,21 +166,19 @@ export const useEligibility = ( ) if (relevantCategories?.length) { - // if the user has any categories that indicate an extended driving license - hasExtendedDrivingLicense = true - - // if any of the issued dates are exactly the same, they were most likely - // created 1993 (or around that time) and are not considered extended - // drivers licenses in that case + // check if the user has any categories that indicate an extended driving license. + // if any of the issued dates are exactly the same, they were most likely created + // in 1993 (or around that time) and are not considered extended drivers licenses. hasExtendedDrivingLicense = !relevantCategories.some( (x) => x.issued === drivingLicenseIssued, ) } } - const hasAnyInvalidRemarks = currentLicense?.remarks?.some((remark) => - remarksCannotRenew65.includes(remark.code), - ) + const hasAnyInvalidRemarks = + currentLicense?.remarks?.some((remark) => + remarksCannotRenew65.includes(remark.code), + ) ?? false const requirements = [ ...eligibility, @@ -193,6 +195,7 @@ export const useEligibility = ( }) } + //Add type annotations to the returned object return { loading: loading, eligibility: { From ea0a7a8f7d12826cc243aa1dfb1050d49e44d9b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Albert=20Loftsson?= Date: Mon, 7 Oct 2024 14:36:11 +0000 Subject: [PATCH 5/7] coderabbit changes --- .../EligibilitySummary/useEligibility.ts | 59 ++++++++++--------- .../driving-license/src/lib/messages.ts | 2 +- 2 files changed, 31 insertions(+), 30 deletions(-) diff --git a/libs/application/templates/driving-license/src/fields/EligibilitySummary/useEligibility.ts b/libs/application/templates/driving-license/src/fields/EligibilitySummary/useEligibility.ts index 38bf4e296c26..c93f539d3b3d 100644 --- a/libs/application/templates/driving-license/src/fields/EligibilitySummary/useEligibility.ts +++ b/libs/application/templates/driving-license/src/fields/EligibilitySummary/useEligibility.ts @@ -97,6 +97,23 @@ export const useEligibility = ( ) } + const hasExtendedDrivingLicense = ( + currentLicense: DrivingLicense | undefined, + drivingLicenseIssued: string | undefined, + ): boolean => { + if (!drivingLicenseIssued) return false + + const relevantCategories = currentLicense?.categories?.filter((x) => + codesExtendedLicenseCategories.includes(x.nr), + ) + + if (!relevantCategories?.length) return false + + // Check if any category was issued on a different date than the 'B' license + // (indicating an extended license) + return relevantCategories.some((x) => x.issued !== drivingLicenseIssued) + } + if (usingFakeData) { return { loading: false, @@ -119,10 +136,7 @@ export const useEligibility = ( } const eligibility: ApplicationEligibilityRequirement[] = - data.drivingLicenseApplicationEligibility === undefined - ? [] - : (data.drivingLicenseApplicationEligibility as ApplicationEligibility) - .requirements + data.drivingLicenseApplicationEligibility?.requirements ?? [] //TODO: Remove when RLS/SGS supports health certificate in BE license if (application.answers.applicationFor === BE) { @@ -155,25 +169,12 @@ export const useEligibility = ( const licenseB = currentLicense?.categories?.find( (license) => license.nr === 'B', ) - const drivingLicenseIssued = licenseB?.issued - let hasExtendedDrivingLicense = false - - if (drivingLicenseIssued) { - const relevantCategories = currentLicense?.categories?.filter((x) => - codesExtendedLicenseCategories.includes(x.nr), - ) - - if (relevantCategories?.length) { - // check if the user has any categories that indicate an extended driving license. - // if any of the issued dates are exactly the same, they were most likely created - // in 1993 (or around that time) and are not considered extended drivers licenses. - hasExtendedDrivingLicense = !relevantCategories.some( - (x) => x.issued === drivingLicenseIssued, - ) - } - } + const hasExtendedLicense = hasExtendedDrivingLicense( + currentLicense, + drivingLicenseIssued, + ) const hasAnyInvalidRemarks = currentLicense?.remarks?.some((remark) => @@ -186,16 +187,16 @@ export const useEligibility = ( key: RequirementKey.HasNoPhoto, requirementMet: hasQualityPhoto, }, + ...(hasExtendedLicense + ? [ + { + key: RequirementKey.NoExtendedDrivingLicense, + requirementMet: false, + }, + ] + : []), ] - if (hasExtendedDrivingLicense) { - requirements.push({ - key: RequirementKey.NoExtendedDrivingLicense, - requirementMet: false, - }) - } - - //Add type annotations to the returned object return { loading: loading, eligibility: { diff --git a/libs/application/templates/driving-license/src/lib/messages.ts b/libs/application/templates/driving-license/src/lib/messages.ts index 369944b3fb85..5bb5c988c112 100644 --- a/libs/application/templates/driving-license/src/lib/messages.ts +++ b/libs/application/templates/driving-license/src/lib/messages.ts @@ -986,7 +986,7 @@ export const requirementsMessages = defineMessages({ description: 'requirement unmet 65 plus renewal', }, noExtendedDrivingLicenseDescription: { - id: 'dl.application:requirementunmet.noExtendedDrivingLicenseDescription', + id: 'dl.application:requirementunmet.noExtendedDrivingLicenseDescription#markdown', defaultMessage: 'Ekki hægt að sækja um endurnýjun á 65+ ökuskírteini.', description: 'requirement unmet 65 plus renewal', }, From 4d787ef3cdc5c38cc29e638c38fa33e365896ea1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Albert=20Loftsson?= Date: Mon, 7 Oct 2024 15:03:34 +0000 Subject: [PATCH 6/7] quick fix --- .../src/fields/EligibilitySummary/useEligibility.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/application/templates/driving-license/src/fields/EligibilitySummary/useEligibility.ts b/libs/application/templates/driving-license/src/fields/EligibilitySummary/useEligibility.ts index c93f539d3b3d..5c474ce38154 100644 --- a/libs/application/templates/driving-license/src/fields/EligibilitySummary/useEligibility.ts +++ b/libs/application/templates/driving-license/src/fields/EligibilitySummary/useEligibility.ts @@ -204,7 +204,7 @@ export const useEligibility = ( ? undefined : (data.drivingLicenseApplicationEligibility?.isEligible ?? false) && hasQualityPhoto && - !hasExtendedDrivingLicense && + !hasExtendedLicense && !hasAnyInvalidRemarks, requirements, }, From d26a1a9ff735b686ad1d624ca126410509fe280b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Albert=20Loftsson?= Date: Mon, 7 Oct 2024 18:45:09 +0000 Subject: [PATCH 7/7] add type? --- libs/api/domains/driving-license/src/lib/drivingLicense.type.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/api/domains/driving-license/src/lib/drivingLicense.type.ts b/libs/api/domains/driving-license/src/lib/drivingLicense.type.ts index 24a6d5062b98..741ca9a09017 100644 --- a/libs/api/domains/driving-license/src/lib/drivingLicense.type.ts +++ b/libs/api/domains/driving-license/src/lib/drivingLicense.type.ts @@ -74,6 +74,7 @@ export enum RequirementKey { hasHadValidCategoryForFiveYearsOrMore = 'HasHadValidCategoryForFiveYearsOrMore', //TODO: Remove when RLS/SGS supports health certificate in BE license beRequiresHealthCertificate = 'beRequiresHealthCertificate', + noExtendedDrivingLicense = 'NoExtendedDrivingLicense', } export interface ApplicationEligibilityRequirement {