From ca38b4fb83c318e9b966c6036fbba57daf51b865 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81sd=C3=ADs=20Erna=20Gu=C3=B0mundsd=C3=B3ttir?= Date: Thu, 14 Nov 2024 14:50:36 +0000 Subject: [PATCH] fix(api): add ff to resolver (#16865) Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- .../src/lib/health-directorate.module.ts | 3 ++- .../src/lib/health-directorate.resolver.ts | 11 +++++++++-- libs/feature-flags/src/lib/features.ts | 3 ++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/libs/api/domains/health-directorate/src/lib/health-directorate.module.ts b/libs/api/domains/health-directorate/src/lib/health-directorate.module.ts index 23a06c73e96c..a4386cc36008 100644 --- a/libs/api/domains/health-directorate/src/lib/health-directorate.module.ts +++ b/libs/api/domains/health-directorate/src/lib/health-directorate.module.ts @@ -2,9 +2,10 @@ import { HealthDirectorateClientModule } from '@island.is/clients/health-directo import { Module } from '@nestjs/common' import { HealthDirectorateResolver } from './health-directorate.resolver' import { HealthDirectorateService } from './health-directorate.service' +import { FeatureFlagModule } from '@island.is/nest/feature-flags' @Module({ - imports: [HealthDirectorateClientModule], + imports: [HealthDirectorateClientModule, FeatureFlagModule], providers: [HealthDirectorateResolver, HealthDirectorateService], }) export class HealthDirectorateModule {} diff --git a/libs/api/domains/health-directorate/src/lib/health-directorate.resolver.ts b/libs/api/domains/health-directorate/src/lib/health-directorate.resolver.ts index 9961e0cd8328..9473cac0eca2 100644 --- a/libs/api/domains/health-directorate/src/lib/health-directorate.resolver.ts +++ b/libs/api/domains/health-directorate/src/lib/health-directorate.resolver.ts @@ -22,8 +22,12 @@ import { DonorInput, Organ, OrganDonation } from './models/organ-donation.model' import type { Locale } from '@island.is/shared/types' import { Vaccinations } from './models/vaccinations.model' import { HealthDirectorateService } from './health-directorate.service' - -@UseGuards(IdsUserGuard, ScopesGuard) +import { + FeatureFlag, + FeatureFlagGuard, + Features, +} from '@island.is/nest/feature-flags' +@UseGuards(IdsUserGuard, ScopesGuard, FeatureFlagGuard) @Scopes(ApiScope.internal) @Audit({ namespace: '@island.is/api/health-directorate' }) @Resolver(() => OrganDonation) @@ -35,6 +39,7 @@ export class HealthDirectorateResolver { name: 'healthDirectorateOrganDonation', }) @Audit() + @FeatureFlag(Features.servicePortalHealthOrganDonationPageEnabled) async getDonorStatus( @Args('locale', { type: () => String, nullable: true }) locale: Locale = 'is', @@ -58,6 +63,7 @@ export class HealthDirectorateResolver { name: 'healthDirectorateOrganDonationUpdateDonorStatus', }) @Audit() + @FeatureFlag(Features.servicePortalHealthOrganDonationPageEnabled) async updateDonorStatus( @Args('input') input: DonorInput, @Args('locale', { type: () => String, nullable: true }) @@ -72,6 +78,7 @@ export class HealthDirectorateResolver { name: 'healthDirectorateVaccinations', }) @Audit() + @FeatureFlag(Features.servicePortalHealthVaccinationsPageEnabled) getVaccinations( @Args('locale', { type: () => String, nullable: true }) locale: Locale = 'is', diff --git a/libs/feature-flags/src/lib/features.ts b/libs/feature-flags/src/lib/features.ts index 35d740f4ed3b..62e02d9d0f4d 100644 --- a/libs/feature-flags/src/lib/features.ts +++ b/libs/feature-flags/src/lib/features.ts @@ -44,7 +44,8 @@ export enum Features { servicePortalVehicleBulkMileagePageEnabled = 'isServicePortalVehicleBulkMileagePageEnabled', servicePortalSocialInsurancePageEnabled = 'isServicePortalSocialInsurancePageEnabled', servicePortalSocialInsuranceIncomePlanPageEnabled = 'isServicePortalSocialInsuranceIncomePlanPageEnabled', - + servicePortalHealthVaccinationsPageEnabled = 'isServicePortalHealthVaccinationsPageEnabled', + servicePortalHealthOrganDonationPageEnabled = 'isServicePortalHealthOrganDonationPageEnabled', ServicePortalNotificationsEnabled = 'isServicePortalNotificationsPageEnabled', servicePortalLawAndOrderModuleEnabled = 'isServicePortalLawAndOrderModuleEnabled', servicePortalDocumentsActionsEnabled = 'isServicePortalDocumentsActionsEnabled',