From 3a4c4c969881a61158d2a47787b24fd1a15c1b06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81sd=C3=ADs=20Erna=20Gu=C3=B0mundsd=C3=B3ttir?= Date: Tue, 1 Oct 2024 10:34:10 +0000 Subject: [PATCH 1/5] fix: health delegation bug and move logic to service --- .../documents/src/lib/documentV2.resolver.ts | 2 +- .../documents/src/lib/documentV2.service.ts | 29 ++++++++++++++----- .../documents/src/lib/helpers}/getBirthday.ts | 0 .../src/lib/models/v2/documents.input.ts | 5 ---- libs/auth/react/src/lib/auth/Auth.state.ts | 20 ++----------- .../react/src/lib/utils/getBirthday.spec.ts | 26 ----------------- .../documents/src/hooks/useDocumentList.ts | 15 ---------- 7 files changed, 26 insertions(+), 71 deletions(-) rename libs/{auth/react/src/lib/utils => api/domains/documents/src/lib/helpers}/getBirthday.ts (100%) delete mode 100644 libs/auth/react/src/lib/utils/getBirthday.spec.ts diff --git a/libs/api/domains/documents/src/lib/documentV2.resolver.ts b/libs/api/domains/documents/src/lib/documentV2.resolver.ts index 548c858f4ac5..61235c05eab4 100644 --- a/libs/api/domains/documents/src/lib/documentV2.resolver.ts +++ b/libs/api/domains/documents/src/lib/documentV2.resolver.ts @@ -75,7 +75,7 @@ export class DocumentResolverV2 { @Args('input') input: DocumentsInput, @CurrentUser() user: User, ): Promise { - return this.documentServiceV2.listDocuments(user.nationalId, input) + return this.documentServiceV2.listDocuments(user, input) } @ResolveField('categories', () => [Category]) diff --git a/libs/api/domains/documents/src/lib/documentV2.service.ts b/libs/api/domains/documents/src/lib/documentV2.service.ts index a55b1873eb34..89312473a96e 100644 --- a/libs/api/domains/documents/src/lib/documentV2.service.ts +++ b/libs/api/domains/documents/src/lib/documentV2.service.ts @@ -18,6 +18,10 @@ import { HEALTH_CATEGORY_ID } from './document.types' import { Type } from './models/v2/type.model' import { DownloadServiceConfig } from '@island.is/nest/config' import { DocumentV2MarkAllMailAsRead } from './models/v2/markAllMailAsRead.model' +import type { User } from '@island.is/auth-nest-tools' +import { AuthDelegationType } from '@island.is/shared/types' +import { getBirthday } from './helpers/getBirthday' +import differceInYears from 'date-fns/differenceInYears' const LOG_CATEGORY = 'documents-api-v2' @Injectable() @@ -75,7 +79,7 @@ export class DocumentServiceV2 { } async listDocuments( - nationalId: string, + user: User, input: DocumentsInput, ): Promise { //If a delegated user is viewing the mailbox, do not return any health related data @@ -83,14 +87,25 @@ export class DocumentServiceV2 { const { categoryIds, ...restOfInput } = input let mutableCategoryIds = categoryIds ?? [] - if (input.isLegalGuardian) { + const isLegalGuardian = user.delegationType?.includes( + AuthDelegationType.LegalGuardian, + ) + + const birthdate = getBirthday(user.nationalId) + let childAgeIsOver15 = false + if (birthdate) { + childAgeIsOver15 = differceInYears(new Date(), birthdate) > 15 + } + const hideHealthData = isLegalGuardian && childAgeIsOver15 + + if (hideHealthData) { if (!mutableCategoryIds.length) { - mutableCategoryIds = (await this.getCategories(nationalId, true)).map( - (c) => c.id, - ) + mutableCategoryIds = ( + await this.getCategories(user.nationalId, true) + ).map((c) => c.id) } else { mutableCategoryIds = mutableCategoryIds.filter( - (c) => c === HEALTH_CATEGORY_ID, + (c) => c !== HEALTH_CATEGORY_ID, ) } } @@ -98,7 +113,7 @@ export class DocumentServiceV2 { const documents = await this.documentService.getDocumentList({ ...restOfInput, categoryId: mutableCategoryIds.join(), - nationalId, + nationalId: user.nationalId, }) if (typeof documents?.totalCount !== 'number') { diff --git a/libs/auth/react/src/lib/utils/getBirthday.ts b/libs/api/domains/documents/src/lib/helpers/getBirthday.ts similarity index 100% rename from libs/auth/react/src/lib/utils/getBirthday.ts rename to libs/api/domains/documents/src/lib/helpers/getBirthday.ts diff --git a/libs/api/domains/documents/src/lib/models/v2/documents.input.ts b/libs/api/domains/documents/src/lib/models/v2/documents.input.ts index 2399bb3eadfe..f8615073aa99 100644 --- a/libs/api/domains/documents/src/lib/models/v2/documents.input.ts +++ b/libs/api/domains/documents/src/lib/models/v2/documents.input.ts @@ -101,9 +101,4 @@ export class DocumentsInput { @IsOptional() @IsInt() readonly pageSize?: number - - @Field({ nullable: true }) - @IsOptional() - @IsBoolean() - isLegalGuardian?: boolean } diff --git a/libs/auth/react/src/lib/auth/Auth.state.ts b/libs/auth/react/src/lib/auth/Auth.state.ts index 23ae5c0fa891..74a1b1f9b785 100644 --- a/libs/auth/react/src/lib/auth/Auth.state.ts +++ b/libs/auth/react/src/lib/auth/Auth.state.ts @@ -1,5 +1,4 @@ import { User } from '@island.is/shared/types' -import { getBirthday } from '../utils/getBirthday' export type AuthState = | 'logged-out' @@ -37,20 +36,6 @@ export const initialState: AuthReducerState = { isAuthenticated: false, } -// Add dateOfBirth Date object to user profile -const formatUser = (payload: User): User | null => { - const dateOfBirth = getBirthday(payload?.profile?.nationalId) - - return { - ...payload, - scopes: payload.scopes || [], - profile: { - ...payload.profile, - dateOfBirth, - }, - } -} - export const reducer = ( state: AuthReducerState, action: Action, @@ -64,7 +49,8 @@ export const reducer = ( case ActionType.SIGNIN_SUCCESS: return { ...state, - userInfo: formatUser(action.payload), + userInfo: action.payload, + authState: 'logged-in', isAuthenticated: true, } @@ -72,7 +58,7 @@ export const reducer = ( return state.isAuthenticated ? { ...state, - userInfo: formatUser(action.payload), + userInfo: action.payload, } : state case ActionType.SIGNIN_FAILURE: diff --git a/libs/auth/react/src/lib/utils/getBirthday.spec.ts b/libs/auth/react/src/lib/utils/getBirthday.spec.ts deleted file mode 100644 index 5f53f470fca5..000000000000 --- a/libs/auth/react/src/lib/utils/getBirthday.spec.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { getBirthday } from './getBirthday' - -describe('getBirthday', () => { - it('should return date of birth from kennitala born before 2000', () => { - const date = new Date('1980-01-01T00:00') - expect(getBirthday('010180-0009')).toEqual(date) - }) - - it('should return date of birth from kennitala born after 2000', () => { - const date = new Date('2020-02-02T00:00') - expect(getBirthday('020220-0000')).toEqual(date) - }) - - it('should return date of creation from kennitala for company', () => { - const date = new Date('2020-02-02T00:00') - expect(getBirthday('420220-0000')).toEqual(date) - }) - - it('should return undefined on bad string input', () => { - expect(getBirthday('NOT A NAT-ID!')).toEqual(undefined) - }) - - it('should return undefined on bad string input 2', () => { - expect(getBirthday('134')).toEqual(undefined) - }) -}) diff --git a/libs/service-portal/documents/src/hooks/useDocumentList.ts b/libs/service-portal/documents/src/hooks/useDocumentList.ts index 29f630344b8d..c70e089cc7b7 100644 --- a/libs/service-portal/documents/src/hooks/useDocumentList.ts +++ b/libs/service-portal/documents/src/hooks/useDocumentList.ts @@ -1,9 +1,6 @@ import { useEffect } from 'react' -import { AuthDelegationType } from '@island.is/api/schema' -import { useUserInfo } from '@island.is/auth/react' import { useDocumentContext } from '../screens/Overview/DocumentContext' import { useDocumentsV2Query } from '../screens/Overview/Overview.generated' -import differenceInYears from 'date-fns/differenceInYears' export const pageSize = 10 @@ -22,17 +19,6 @@ export const useDocumentList = (props?: UseDocumentListProps) => { setSendersAvailable, } = useDocumentContext() - const userInfo = useUserInfo() - const isLegal = userInfo.profile.delegationType?.includes( - AuthDelegationType.LegalGuardian, - ) - const dateOfBirth = userInfo?.profile.dateOfBirth - let isOver15 = false - if (dateOfBirth) { - isOver15 = differenceInYears(new Date(), dateOfBirth) > 15 - } - const hideHealthData = isOver15 && isLegal - const fetchObject = { input: { senderNationalId: filterValue.activeSenders, @@ -44,7 +30,6 @@ export const useDocumentList = (props?: UseDocumentListProps) => { opened: filterValue.showUnread ? false : null, page: page, pageSize: props?.defaultPageSize ?? pageSize, - isLegalGuardian: hideHealthData, archived: filterValue.archived, bookmarked: filterValue.bookmarked, }, From 3bbeebc485d4f82406037a305da728e2ab709d18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81sd=C3=ADs=20Erna=20Gu=C3=B0mundsd=C3=B3ttir?= Date: Fri, 18 Oct 2024 10:08:20 +0000 Subject: [PATCH 2/5] feat: hide law and order and health data if certain delegation --- .../documents/src/lib/document.types.ts | 1 + .../documents/src/lib/documentV2.resolver.ts | 15 ++- .../documents/src/lib/documentV2.service.ts | 113 +++++++++++------- .../src/lib/documentsClientV2.service.ts | 10 ++ .../src/lib/dto/listDocuments.input.ts | 1 + .../documents/src/hooks/useDocumentListV3.ts | 16 +-- .../src/hooks/documents/useListDocuments.ts | 2 - 7 files changed, 90 insertions(+), 68 deletions(-) diff --git a/libs/api/domains/documents/src/lib/document.types.ts b/libs/api/domains/documents/src/lib/document.types.ts index d004b9fea796..ed32b058620b 100644 --- a/libs/api/domains/documents/src/lib/document.types.ts +++ b/libs/api/domains/documents/src/lib/document.types.ts @@ -1,6 +1,7 @@ import { FileType } from './models/v2/documentContent.model' export const HEALTH_CATEGORY_ID = '3' +export const LAW_AND_ORDER_CATEGORY_ID = '10' export class DocumentTypeFilter { senderName!: string diff --git a/libs/api/domains/documents/src/lib/documentV2.resolver.ts b/libs/api/domains/documents/src/lib/documentV2.resolver.ts index 221a2e87225f..e65ffcab0c92 100644 --- a/libs/api/domains/documents/src/lib/documentV2.resolver.ts +++ b/libs/api/domains/documents/src/lib/documentV2.resolver.ts @@ -36,6 +36,7 @@ import { DocumentV2MarkAllMailAsRead } from './models/v2/markAllMailAsRead.model import type { Locale } from '@island.is/shared/types' import { DocumentConfirmActionsInput } from './models/v2/confirmActions.input' import { DocumentConfirmActions } from './models/v2/confirmActions.model' +import { isDefined } from '@island.is/shared/utils' const LOG_CATEGORY = 'documents-resolver' @@ -95,9 +96,8 @@ export class DocumentResolverV2 { @CurrentUser() user: User, ): Promise { const ffEnabled = await this.getFeatureFlag() - if (ffEnabled) - return this.documentServiceV2.listDocumentsV3(user.nationalId, input) - return this.documentServiceV2.listDocuments(user.nationalId, input) + if (ffEnabled) return this.documentServiceV2.listDocumentsV3(user, input) + return this.documentServiceV2.listDocuments(user, input) } @Scopes(DocumentsScope.main) @@ -121,8 +121,13 @@ export class DocumentResolverV2 { } @ResolveField('categories', () => [Category]) - documentCategories(@CurrentUser() user: User): Promise> { - return this.documentServiceV2.getCategories(user.nationalId) + async documentCategories( + @CurrentUser() user: User, + ): Promise> { + const categories = await this.documentServiceV2.getCategories(user) + if (!isDefined(categories)) { + return [] + } else return categories } @ResolveField('senders', () => [Sender]) diff --git a/libs/api/domains/documents/src/lib/documentV2.service.ts b/libs/api/domains/documents/src/lib/documentV2.service.ts index db72fd348d06..370a56838b0c 100644 --- a/libs/api/domains/documents/src/lib/documentV2.service.ts +++ b/libs/api/domains/documents/src/lib/documentV2.service.ts @@ -18,7 +18,7 @@ import { DocumentsInput } from './models/v2/documents.input' import { PaperMailPreferences } from './models/v2/paperMailPreferences.model' import { Sender } from './models/v2/sender.model' import { FileType } from './models/v2/documentContent.model' -import { HEALTH_CATEGORY_ID } from './document.types' +import { HEALTH_CATEGORY_ID, LAW_AND_ORDER_CATEGORY_ID } from './document.types' import { Type } from './models/v2/type.model' import { DownloadServiceConfig } from '@island.is/nest/config' import { DocumentV2MarkAllMailAsRead } from './models/v2/markAllMailAsRead.model' @@ -153,29 +153,17 @@ export class DocumentServiceV2 { //Category is now "1,2,3,...,n" const { categoryIds, ...restOfInput } = input let mutableCategoryIds = categoryIds ?? [] - - const isLegalGuardian = user.delegationType?.includes( - AuthDelegationType.LegalGuardian, - ) - - const birthdate = getBirthday(user.nationalId) - let childAgeIsOver15 = false - if (birthdate) { - childAgeIsOver15 = differceInYears(new Date(), birthdate) > 15 - } - const hideHealthData = isLegalGuardian && childAgeIsOver15 - - if (hideHealthData) { - if (!mutableCategoryIds.length) { - mutableCategoryIds = ( - await this.getCategories(user.nationalId, true) - ).map((c) => c.id) - } else { - mutableCategoryIds = mutableCategoryIds.filter( - (c) => c !== HEALTH_CATEGORY_ID, - ) + if (!mutableCategoryIds.length) { + const filteredCategories = await this.getCategories(user) + if (isDefined(filteredCategories)) { + mutableCategoryIds = filteredCategories.map((c) => c.id) } } + // If categoryIds are provided, filter out correct data + else { + const hiddenCategoryIds = this.getHiddenCategoriesIDs(user) + mutableCategoryIds.filter((c) => !hiddenCategoryIds.includes(c)) + } const documents = await this.documentService.getDocumentList({ ...restOfInput, @@ -220,30 +208,32 @@ export class DocumentServiceV2 { } async listDocumentsV3( - nationalId: string, + user: User, input: DocumentsInput, ): Promise { //If a delegated user is viewing the mailbox, do not return any health related data //Category is now "1,2,3,...,n" const { categoryIds, ...restOfInput } = input + // If no categoryIds are provided, get all categories let mutableCategoryIds = categoryIds ?? [] - if (input.isLegalGuardian) { - if (!mutableCategoryIds.length) { - mutableCategoryIds = (await this.getCategories(nationalId, true)).map( - (c) => c.id, - ) - } else { - mutableCategoryIds = mutableCategoryIds.filter( - (c) => c === HEALTH_CATEGORY_ID, - ) + if (!mutableCategoryIds.length) { + const filteredCategories = await this.getCategories(user) + if (isDefined(filteredCategories)) { + mutableCategoryIds = filteredCategories.map((c) => c.id) } } + // If categoryIds are provided, filter out correct data + else { + const hiddenCategoryIds = this.getHiddenCategoriesIDs(user) + mutableCategoryIds.filter((c) => !hiddenCategoryIds.includes(c)) + } const documents = await this.documentService.getDocumentList({ ...restOfInput, categoryId: mutableCategoryIds.join(), - nationalId, + hiddenCategoryIds: this.getHiddenCategoriesIDs(user).join(), + nationalId: user.nationalId, }) if (typeof documents?.totalCount !== 'number') { @@ -273,7 +263,7 @@ export class DocumentServiceV2 { .filter(isDefined) ?? [] return { - data: documentData, + data: documentData, // if empty after category filter then return null totalCount: documents?.totalCount ?? 0, unreadCount: documents?.unreadCount, pageInfo: { @@ -282,27 +272,34 @@ export class DocumentServiceV2 { } } - async getCategories( - nationalId: string, - filterHealth = false, - ): Promise> { + async getCategories(user: User): Promise | null> { const categories = await this.documentService.getCustomersCategories( - nationalId, + user.nationalId, ) - return ( + const filterOutIds = this.getHiddenCategoriesIDs(user) ?? [] + + const filteredCategories = categories.categories ?.map((c) => { - if (!c.id || (filterHealth && c.id === HEALTH_CATEGORY_ID)) { + if ( + !c.id || + (filterOutIds.length > 0 && filterOutIds.includes(c.id)) + ) { + console.log('Filtering out:', c.id) return null - } - return { - id: c.id, - name: c.name, + } else { + console.log('else') + return { + id: c.id, + name: c.name, + } } }) .filter(isDefined) ?? [] - ) + if (filteredCategories.length === 0) return null + + return filteredCategories } async getTypes(nationalId: string): Promise> { @@ -518,4 +515,28 @@ export class DocumentServiceV2 { return mapped } + + private getHiddenCategoriesIDs = (user: User) => { + const isDelegated = isDefined(user.delegationType) + if (!isDelegated) return [] + + const isLegalGuardian = user.delegationType?.includes( + AuthDelegationType.LegalGuardian, + ) + const birthdate = getBirthday(user.nationalId) + const childAgeIs16OrOlder = birthdate + ? differceInYears(new Date(), birthdate) > 15 + : false + + // Hide health data if user is a legal guardian and child is 16 or older + const hideHealthData = isLegalGuardian && childAgeIs16OrOlder + // Hide law and order data if user is delegated + // commented out until we have correct category for law and order files + const hideLawAndOrderData = false //isDelegated + + return [ + ...(hideHealthData ? [HEALTH_CATEGORY_ID] : []), + ...(hideLawAndOrderData ? [LAW_AND_ORDER_CATEGORY_ID] : []), + ] + } } diff --git a/libs/clients/documents-v2/src/lib/documentsClientV2.service.ts b/libs/clients/documents-v2/src/lib/documentsClientV2.service.ts index f718345c4df1..84aeb57b4107 100644 --- a/libs/clients/documents-v2/src/lib/documentsClientV2.service.ts +++ b/libs/clients/documents-v2/src/lib/documentsClientV2.service.ts @@ -31,6 +31,7 @@ export class DocumentsClientV2Service { * @param input List input object. Example: { dateFrom: undefined, nationalId: '123' } * @returns List object sanitized of unnecessary values. Example: { nationalId: '123' } */ + const sanitizeObject = function ( obj: T, ): T { @@ -43,6 +44,15 @@ export class DocumentsClientV2Service { return sanitizedObj } + // If hiddenCats is not empty and categories are empty, the API will return no documents + if (input.hiddenCategoryIds !== '' && input.categoryId === '') { + return { + totalCount: 0, + unreadCount: 0, + documents: [], + } + } + const inputObject = sanitizeObject({ ...input, kennitala: input.nationalId, diff --git a/libs/clients/documents-v2/src/lib/dto/listDocuments.input.ts b/libs/clients/documents-v2/src/lib/dto/listDocuments.input.ts index fd305ad24846..3070a27c91ba 100644 --- a/libs/clients/documents-v2/src/lib/dto/listDocuments.input.ts +++ b/libs/clients/documents-v2/src/lib/dto/listDocuments.input.ts @@ -4,6 +4,7 @@ export type ListDocumentsInputDto = { dateFrom?: Date dateTo?: Date categoryId?: string + hiddenCategoryIds?: string typeId?: string subjectContains?: string archived?: boolean diff --git a/libs/service-portal/documents/src/hooks/useDocumentListV3.ts b/libs/service-portal/documents/src/hooks/useDocumentListV3.ts index 0ffe4e76bf20..654089eb388f 100644 --- a/libs/service-portal/documents/src/hooks/useDocumentListV3.ts +++ b/libs/service-portal/documents/src/hooks/useDocumentListV3.ts @@ -1,9 +1,6 @@ import { useEffect } from 'react' -import { AuthDelegationType } from '@island.is/api/schema' -import { useUserInfo } from '@island.is/auth/react' import { useDocumentContext } from '../screens/Overview/DocumentContext' import { useDocumentsV3Query } from '../screens/Overview/Overview.generated' -import differenceInYears from 'date-fns/differenceInYears' export const pageSize = 10 @@ -22,17 +19,6 @@ export const useDocumentListV3 = (props?: UseDocumentListProps) => { setSendersAvailable, } = useDocumentContext() - const userInfo = useUserInfo() - const isLegal = userInfo.profile.delegationType?.includes( - AuthDelegationType.LegalGuardian, - ) - const dateOfBirth = userInfo?.profile.dateOfBirth - let isOver15 = false - if (dateOfBirth) { - isOver15 = differenceInYears(new Date(), dateOfBirth) > 15 - } - const hideHealthData = isOver15 && isLegal - const fetchObject = { input: { senderNationalId: filterValue.activeSenders, @@ -44,7 +30,6 @@ export const useDocumentListV3 = (props?: UseDocumentListProps) => { opened: filterValue.showUnread ? false : null, page: page, pageSize: props?.defaultPageSize ?? pageSize, - isLegalGuardian: hideHealthData, archived: filterValue.archived, bookmarked: filterValue.bookmarked, }, @@ -81,6 +66,7 @@ export const useDocumentListV3 = (props?: UseDocumentListProps) => { }, [loading, data, sendersAvailable, categoriesAvailable]) const totalCount = data?.documentsV2?.totalCount || 0 + useEffect(() => { const pageCount = Math.ceil(totalCount / pageSize) if (pageCount !== totalPages && !loading) { diff --git a/libs/service-portal/graphql/src/hooks/documents/useListDocuments.ts b/libs/service-portal/graphql/src/hooks/documents/useListDocuments.ts index f83924fd689c..99d20c594a94 100644 --- a/libs/service-portal/graphql/src/hooks/documents/useListDocuments.ts +++ b/libs/service-portal/graphql/src/hooks/documents/useListDocuments.ts @@ -28,7 +28,6 @@ export const useListDocuments = ( opened, page, pageSize, - isLegalGuardian, archived, bookmarked, } = input ?? {} @@ -47,7 +46,6 @@ export const useListDocuments = ( opened, page, pageSize, - isLegalGuardian, archived, bookmarked, }, From 93c7604bec16eb21ee0d3f2fb2577649cf8f5872 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81sd=C3=ADs=20Erna=20Gu=C3=B0mundsd=C3=B3ttir?= Date: Fri, 18 Oct 2024 15:08:41 +0000 Subject: [PATCH 3/5] console --- libs/api/domains/documents/src/lib/documentV2.service.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/libs/api/domains/documents/src/lib/documentV2.service.ts b/libs/api/domains/documents/src/lib/documentV2.service.ts index 370a56838b0c..574733bbf171 100644 --- a/libs/api/domains/documents/src/lib/documentV2.service.ts +++ b/libs/api/domains/documents/src/lib/documentV2.service.ts @@ -286,10 +286,8 @@ export class DocumentServiceV2 { !c.id || (filterOutIds.length > 0 && filterOutIds.includes(c.id)) ) { - console.log('Filtering out:', c.id) return null } else { - console.log('else') return { id: c.id, name: c.name, From b262249818b4da4f4ad72a8540c1c475f35d12ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81sd=C3=ADs=20Erna=20Gu=C3=B0mundsd=C3=B3ttir?= Date: Tue, 22 Oct 2024 09:27:08 +0000 Subject: [PATCH 4/5] fix: add correct id --- libs/api/domains/documents/src/lib/document.types.ts | 2 +- libs/api/domains/documents/src/lib/documentV2.service.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/api/domains/documents/src/lib/document.types.ts b/libs/api/domains/documents/src/lib/document.types.ts index ed32b058620b..e67eefca5851 100644 --- a/libs/api/domains/documents/src/lib/document.types.ts +++ b/libs/api/domains/documents/src/lib/document.types.ts @@ -1,7 +1,7 @@ import { FileType } from './models/v2/documentContent.model' export const HEALTH_CATEGORY_ID = '3' -export const LAW_AND_ORDER_CATEGORY_ID = '10' +export const LAW_AND_ORDER_CATEGORY_ID = '12' export class DocumentTypeFilter { senderName!: string diff --git a/libs/api/domains/documents/src/lib/documentV2.service.ts b/libs/api/domains/documents/src/lib/documentV2.service.ts index fee8cbda18a0..339a61675863 100644 --- a/libs/api/domains/documents/src/lib/documentV2.service.ts +++ b/libs/api/domains/documents/src/lib/documentV2.service.ts @@ -540,7 +540,7 @@ export class DocumentServiceV2 { const hideHealthData = isLegalGuardian && childAgeIs16OrOlder // Hide law and order data if user is delegated // commented out until we have correct category for law and order files - const hideLawAndOrderData = false //isDelegated + const hideLawAndOrderData = isDelegated return [ ...(hideHealthData ? [HEALTH_CATEGORY_ID] : []), From 5b4e6b0798c12c5c5c272e5fa13b0ce4bf0f0855 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81sd=C3=ADs=20Erna=20Gu=C3=B0mundsd=C3=B3ttir?= Date: Fri, 25 Oct 2024 14:24:59 +0000 Subject: [PATCH 5/5] remove birthday use (v1 is deprecated) --- .../v1/HealthDirectorateDetail/HealthDirectorateDetail.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/libs/service-portal/occupational-licenses/src/screens/v1/HealthDirectorateDetail/HealthDirectorateDetail.tsx b/libs/service-portal/occupational-licenses/src/screens/v1/HealthDirectorateDetail/HealthDirectorateDetail.tsx index 051a4af284de..1a7598dee033 100644 --- a/libs/service-portal/occupational-licenses/src/screens/v1/HealthDirectorateDetail/HealthDirectorateDetail.tsx +++ b/libs/service-portal/occupational-licenses/src/screens/v1/HealthDirectorateDetail/HealthDirectorateDetail.tsx @@ -22,7 +22,6 @@ export const EducationDetail = () => { const { id } = useParams() as UseParams useNamespaces('sp.occupational-licenses') const user = useUserInfo() - const birthday = user.profile.dateOfBirth const { formatDateFns, formatMessage } = useLocale() const { data, loading, error } = useGetHealthDirectorateLicenseByIdQuery({ @@ -61,7 +60,6 @@ export const EducationDetail = () => { ? license.number : undefined } - dateOfBirth={birthday ? formatDateFns(birthday, 'dd.MM.yyyy') : undefined} profession={license.profession} licenseType={license.type} dateOfIssue={