From 1047eefa7362cb2a51323e4c4e8dd49a3e728794 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3n=20Bjarni=20=C3=93lafsson?= Date: Mon, 30 Sep 2024 08:56:12 +0000 Subject: [PATCH] Fixed PR comments. --- .../models/getUserInvolvedParties.response.ts | 12 ++++++------ .../src/screens/InvolvedPartyScreen.tsx | 6 ++---- .../src/lib/ojoiApplicationClient.service.ts | 19 ++++++++++++++----- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/libs/api/domains/official-journal-of-iceland-application/src/models/getUserInvolvedParties.response.ts b/libs/api/domains/official-journal-of-iceland-application/src/models/getUserInvolvedParties.response.ts index b9eb97e4bd2f..73a2f1b29386 100644 --- a/libs/api/domains/official-journal-of-iceland-application/src/models/getUserInvolvedParties.response.ts +++ b/libs/api/domains/official-journal-of-iceland-application/src/models/getUserInvolvedParties.response.ts @@ -1,19 +1,19 @@ import { Field, ObjectType } from '@nestjs/graphql' @ObjectType('OfficialJournalOfIcelandApplicationGetUserInvolvedParty') -export class InvovledParty { - @Field() +export class InvolvededParty { + @Field({ description: 'The id of the involved party' }) id!: string - @Field() + @Field({ description: 'The title of the involved party' }) title!: string - @Field() + @Field({ description: 'The slug of the involved party' }) slug!: string } @ObjectType('OfficialJournalOfIcelandApplicationGetUserInvolvedPartiesResponse') export class GetUserInvolvedPartiesResponse { - @Field(() => [InvovledParty]) - involvedParties!: InvovledParty[] + @Field(() => [InvolvededParty]) + involvedParties!: InvolvededParty[] } diff --git a/libs/application/templates/official-journal-of-iceland/src/screens/InvolvedPartyScreen.tsx b/libs/application/templates/official-journal-of-iceland/src/screens/InvolvedPartyScreen.tsx index 1529141f3833..ecdc8e23b6e6 100644 --- a/libs/application/templates/official-journal-of-iceland/src/screens/InvolvedPartyScreen.tsx +++ b/libs/application/templates/official-journal-of-iceland/src/screens/InvolvedPartyScreen.tsx @@ -26,7 +26,7 @@ export const InvolvedPartyScreen = ({ }, onComplete: (data) => { const involvedParties = - data?.officialJournalOfIcelandApplicationGetUserInvolvedParties + data.officialJournalOfIcelandApplicationGetUserInvolvedParties .involvedParties if (involvedParties.length === 0 || involvedParties.length > 1) { @@ -37,9 +37,7 @@ export const InvolvedPartyScreen = ({ data.officialJournalOfIcelandApplicationGetUserInvolvedParties .involvedParties.length === 1 ) { - const involvedParty = - data.officialJournalOfIcelandApplicationGetUserInvolvedParties - .involvedParties[0] + const involvedParty = involvedParties[0] setValue(InputFields.advert.involvedPartyId, involvedParty.id) diff --git a/libs/clients/official-journal-of-iceland/application/src/lib/ojoiApplicationClient.service.ts b/libs/clients/official-journal-of-iceland/application/src/lib/ojoiApplicationClient.service.ts index 0981282acea1..f9a6132dd3c5 100644 --- a/libs/clients/official-journal-of-iceland/application/src/lib/ojoiApplicationClient.service.ts +++ b/libs/clients/official-journal-of-iceland/application/src/lib/ojoiApplicationClient.service.ts @@ -181,10 +181,19 @@ export class OfficialJournalOfIcelandApplicationClientService { } async getUserInvolvedParties(params: GetInvolvedPartiesRequest, auth: Auth) { - const data = await this.ojoiApplicationApiWithAuth(auth).getInvolvedParties( - params, - ) - console.log(data) - return data + try { + const data = await this.ojoiApplicationApiWithAuth( + auth, + ).getInvolvedParties(params) + return data + } catch (error) { + this.logger.warn('Failed to get involved parties', { + error, + applicationId: params.id, + category: LOG_CATEGORY, + }) + + throw error + } } }