diff --git a/Apps/WebClient/src/ClientApp/src/ioc/container.ts b/Apps/WebClient/src/ClientApp/src/ioc/container.ts index b32589dd9d..45603dd833 100644 --- a/Apps/WebClient/src/ClientApp/src/ioc/container.ts +++ b/Apps/WebClient/src/ClientApp/src/ioc/container.ts @@ -6,8 +6,8 @@ interface IContainer { } class Container implements IContainer { - private mappings = new Map any>(); - private cachedMappings = new Map(); + private readonly mappings = new Map any>(); + private readonly cachedMappings = new Map(); public set(key: Identifier, factory: (c: Container) => T): void { this.mappings.set(key, factory); diff --git a/Apps/WebClient/src/ClientApp/src/models/timeline/bcCancerScreeningTimelineEntry.ts b/Apps/WebClient/src/ClientApp/src/models/timeline/bcCancerScreeningTimelineEntry.ts index c377d9060b..696420a149 100644 --- a/Apps/WebClient/src/ClientApp/src/models/timeline/bcCancerScreeningTimelineEntry.ts +++ b/Apps/WebClient/src/ClientApp/src/models/timeline/bcCancerScreeningTimelineEntry.ts @@ -17,7 +17,7 @@ export default class BcCancerScreeningTimelineEntry extends TimelineEntry { public fileName!: string; public eventText!: string; - private getComments: (entryId: string) => UserComment[] | null; + private readonly getComments: (entryId: string) => UserComment[] | null; public constructor( model: BcCancerScreening, diff --git a/Apps/WebClient/src/ClientApp/src/models/timeline/clinicalDocumentTimelineEntry.ts b/Apps/WebClient/src/ClientApp/src/models/timeline/clinicalDocumentTimelineEntry.ts index 31adcf23a6..7d8dffd95b 100644 --- a/Apps/WebClient/src/ClientApp/src/models/timeline/clinicalDocumentTimelineEntry.ts +++ b/Apps/WebClient/src/ClientApp/src/models/timeline/clinicalDocumentTimelineEntry.ts @@ -11,7 +11,7 @@ export default class ClinicalDocumentTimelineEntry extends TimelineEntry { public documentType: string; public facilityName: string; public discipline: string; - private getComments: (entyId: string) => UserComment[] | null; + private readonly getComments: (entyId: string) => UserComment[] | null; public constructor( model: ClinicalDocument, diff --git a/Apps/WebClient/src/ClientApp/src/models/timeline/covid19TestResultTimelineEntry.ts b/Apps/WebClient/src/ClientApp/src/models/timeline/covid19TestResultTimelineEntry.ts index c66d06b67d..b56440b7e7 100644 --- a/Apps/WebClient/src/ClientApp/src/models/timeline/covid19TestResultTimelineEntry.ts +++ b/Apps/WebClient/src/ClientApp/src/models/timeline/covid19TestResultTimelineEntry.ts @@ -25,7 +25,7 @@ export default class Covid19TestResultTimelineEntry extends TimelineEntry { public tests: Covid19TestData[]; - private getComments: (entyId: string) => UserComment[] | null; + private readonly getComments: (entyId: string) => UserComment[] | null; public constructor( model: Covid19LaboratoryOrder, diff --git a/Apps/WebClient/src/ClientApp/src/models/timeline/diagnosticImagingTimelineEntry.ts b/Apps/WebClient/src/ClientApp/src/models/timeline/diagnosticImagingTimelineEntry.ts index fb0c6dbcde..b3cb76964c 100644 --- a/Apps/WebClient/src/ClientApp/src/models/timeline/diagnosticImagingTimelineEntry.ts +++ b/Apps/WebClient/src/ClientApp/src/models/timeline/diagnosticImagingTimelineEntry.ts @@ -16,7 +16,7 @@ export default class DiagnosticImagingTimelineEntry extends TimelineEntry { public fileId: string | undefined; public examDate: StringISODate; - private getComments: (entryId: string) => UserComment[] | null; + private readonly getComments: (entryId: string) => UserComment[] | null; public constructor( model: DiagnosticImagingExam, diff --git a/Apps/WebClient/src/ClientApp/src/models/timeline/healthVisitTimelineEntry.ts b/Apps/WebClient/src/ClientApp/src/models/timeline/healthVisitTimelineEntry.ts index 5a2001362f..7678866e3c 100644 --- a/Apps/WebClient/src/ClientApp/src/models/timeline/healthVisitTimelineEntry.ts +++ b/Apps/WebClient/src/ClientApp/src/models/timeline/healthVisitTimelineEntry.ts @@ -12,7 +12,7 @@ export default class HealthVisitTimelineEntry extends TimelineEntry { public specialtyDescription: string; public clinic: ClinicViewModel; public showRollOffWarning: boolean; - private getComments: (entyId: string) => UserComment[] | null; + private readonly getComments: (entyId: string) => UserComment[] | null; public constructor( model: Encounter, diff --git a/Apps/WebClient/src/ClientApp/src/models/timeline/hospitalVisitTimelineEntry.ts b/Apps/WebClient/src/ClientApp/src/models/timeline/hospitalVisitTimelineEntry.ts index d2fc0db2fd..200785cf48 100644 --- a/Apps/WebClient/src/ClientApp/src/models/timeline/hospitalVisitTimelineEntry.ts +++ b/Apps/WebClient/src/ClientApp/src/models/timeline/hospitalVisitTimelineEntry.ts @@ -15,7 +15,7 @@ export default class HospitalVisitTimelineEntry extends TimelineEntry { public admitDateTime: DateWrapper; public endDateTime?: DateWrapper; - private getComments: (entyId: string) => UserComment[] | null; + private readonly getComments: (entyId: string) => UserComment[] | null; public constructor( model: HospitalVisit, diff --git a/Apps/WebClient/src/ClientApp/src/models/timeline/labResultTimelineEntry.ts b/Apps/WebClient/src/ClientApp/src/models/timeline/labResultTimelineEntry.ts index 88c8534ce8..6124f325a2 100644 --- a/Apps/WebClient/src/ClientApp/src/models/timeline/labResultTimelineEntry.ts +++ b/Apps/WebClient/src/ClientApp/src/models/timeline/labResultTimelineEntry.ts @@ -21,7 +21,7 @@ export default class LabResultTimelineEntry extends TimelineEntry { public tests: LaboratoryTestViewModel[]; - private getComments: (entyId: string) => UserComment[] | null; + private readonly getComments: (entyId: string) => UserComment[] | null; public constructor( model: LaboratoryOrder, diff --git a/Apps/WebClient/src/ClientApp/src/models/timeline/medicationTimelineEntry.ts b/Apps/WebClient/src/ClientApp/src/models/timeline/medicationTimelineEntry.ts index 63529f3046..e583f539ef 100644 --- a/Apps/WebClient/src/ClientApp/src/models/timeline/medicationTimelineEntry.ts +++ b/Apps/WebClient/src/ClientApp/src/models/timeline/medicationTimelineEntry.ts @@ -19,7 +19,7 @@ export default class MedicationTimelineEntry extends TimelineEntry { public prescriptionProvided?: boolean; public redirectedToHealthCareProvider?: boolean; - private getComments: (entyId: string) => UserComment[] | null; + private readonly getComments: (entyId: string) => UserComment[] | null; public constructor( model: MedicationStatement, diff --git a/Apps/WebClient/src/ClientApp/src/models/timeline/noteTimelineEntry.ts b/Apps/WebClient/src/ClientApp/src/models/timeline/noteTimelineEntry.ts index 04852a679b..dd19f6a991 100644 --- a/Apps/WebClient/src/ClientApp/src/models/timeline/noteTimelineEntry.ts +++ b/Apps/WebClient/src/ClientApp/src/models/timeline/noteTimelineEntry.ts @@ -11,7 +11,7 @@ export default class NoteTimelineEntry extends TimelineEntry { public title: string; public hdid: string; public version?: number; - private static maxSumaryLength = 40; + private static readonly maxSumaryLength = 40; public constructor(model: UserNote) { super( diff --git a/Apps/WebClient/src/ClientApp/src/models/timeline/specialAuthorityRequestTimelineEntry.ts b/Apps/WebClient/src/ClientApp/src/models/timeline/specialAuthorityRequestTimelineEntry.ts index 9e69ab5a1f..468dca73d4 100644 --- a/Apps/WebClient/src/ClientApp/src/models/timeline/specialAuthorityRequestTimelineEntry.ts +++ b/Apps/WebClient/src/ClientApp/src/models/timeline/specialAuthorityRequestTimelineEntry.ts @@ -13,7 +13,7 @@ export default class SpecialAuthorityRequestTimelineEntry extends TimelineEntry public expiryDate?: DateWrapper; public referenceNumber: string; - private getComments: (entyId: string) => UserComment[] | null; + private readonly getComments: (entyId: string) => UserComment[] | null; public constructor( model: MedicationRequest, diff --git a/Apps/WebClient/src/ClientApp/src/services/httpDelegate.ts b/Apps/WebClient/src/ClientApp/src/services/httpDelegate.ts index 609ff760af..0f7d42e43a 100644 --- a/Apps/WebClient/src/ClientApp/src/services/httpDelegate.ts +++ b/Apps/WebClient/src/ClientApp/src/services/httpDelegate.ts @@ -5,7 +5,7 @@ import { HttpError } from "@/models/errors"; import { IHttpDelegate, ILogger } from "@/services/interfaces"; export class HttpDelegate implements IHttpDelegate { - private logger; + private readonly logger; constructor(logger: ILogger) { this.logger = logger; diff --git a/Apps/WebClient/src/ClientApp/src/services/restAuthService.ts b/Apps/WebClient/src/ClientApp/src/services/restAuthService.ts index d25e5e7fc2..476029d726 100644 --- a/Apps/WebClient/src/ClientApp/src/services/restAuthService.ts +++ b/Apps/WebClient/src/ClientApp/src/services/restAuthService.ts @@ -8,11 +8,11 @@ import { IAuthenticationService, ILogger } from "@/services/interfaces"; const REFRESH_CUSHION = 30; export class RestAuthenticationService implements IAuthenticationService { - private logger; - private keycloak; - private scope!: string; - private logonCallback!: string; - private logoutCallback!: string; + private readonly logger; + private readonly keycloak; + private readonly scope!: string; + private readonly logonCallback!: string; + private readonly logoutCallback!: string; // RestAuthenticationService.GetService() should be called instead of using the constructor directly. constructor( diff --git a/Apps/WebClient/src/ClientApp/src/services/restClinicalDocumentService.ts b/Apps/WebClient/src/ClientApp/src/services/restClinicalDocumentService.ts index 9a6aac2b06..b86c8f7b7b 100644 --- a/Apps/WebClient/src/ClientApp/src/services/restClinicalDocumentService.ts +++ b/Apps/WebClient/src/ClientApp/src/services/restClinicalDocumentService.ts @@ -16,10 +16,10 @@ import ErrorTranslator from "@/utility/errorTranslator"; export class RestClinicalDocumentService implements IClinicalDocumentService { private readonly BASE_URI = "ClinicalDocument"; - private logger; - private http; - private baseUri; - private isEnabled; + private readonly logger; + private readonly http; + private readonly baseUri; + private readonly isEnabled; constructor( logger: ILogger, diff --git a/Apps/WebClient/src/ClientApp/src/services/restCommunicationService.ts b/Apps/WebClient/src/ClientApp/src/services/restCommunicationService.ts index cecdd9d4b2..1047640c65 100644 --- a/Apps/WebClient/src/ClientApp/src/services/restCommunicationService.ts +++ b/Apps/WebClient/src/ClientApp/src/services/restCommunicationService.ts @@ -12,9 +12,9 @@ import ErrorTranslator from "@/utility/errorTranslator"; export class RestCommunicationService implements ICommunicationService { private readonly BASE_URI: string = "Communication"; - private logger; - private http; - private baseUri; + private readonly logger; + private readonly http; + private readonly baseUri; constructor( logger: ILogger, diff --git a/Apps/WebClient/src/ClientApp/src/services/restConfigService.ts b/Apps/WebClient/src/ClientApp/src/services/restConfigService.ts index 8b95282e06..a4093af5db 100644 --- a/Apps/WebClient/src/ClientApp/src/services/restConfigService.ts +++ b/Apps/WebClient/src/ClientApp/src/services/restConfigService.ts @@ -5,10 +5,10 @@ import { IConfigService, IHttpDelegate, ILogger } from "@/services/interfaces"; import ErrorTranslator from "@/utility/errorTranslator"; export class RestConfigService implements IConfigService { - private logger; + private readonly logger; private readonly CONFIG_BASE_URI: string = "configuration"; - private http; - private baseUri = import.meta.env.VITE_WEB_CLIENT_BASE_URI || "/"; + private readonly http; + private readonly baseUri = import.meta.env.VITE_WEB_CLIENT_BASE_URI || "/"; constructor(logger: ILogger, httpDelegate: IHttpDelegate) { this.logger = logger; diff --git a/Apps/WebClient/src/ClientApp/src/services/restDependentService.ts b/Apps/WebClient/src/ClientApp/src/services/restDependentService.ts index 804b13bd7d..0111db2ced 100644 --- a/Apps/WebClient/src/ClientApp/src/services/restDependentService.ts +++ b/Apps/WebClient/src/ClientApp/src/services/restDependentService.ts @@ -14,10 +14,10 @@ import RequestResultUtil from "@/utility/requestResultUtil"; export class RestDependentService implements IDependentService { private readonly DEPENDENT_BASE_URI: string = "UserProfile"; - private logger; - private http; - private baseUri; - private isEnabled; + private readonly logger; + private readonly http; + private readonly baseUri; + private readonly isEnabled; constructor( logger: ILogger, diff --git a/Apps/WebClient/src/ClientApp/src/services/restEncounterService.ts b/Apps/WebClient/src/ClientApp/src/services/restEncounterService.ts index fb11725104..1ab13721ac 100644 --- a/Apps/WebClient/src/ClientApp/src/services/restEncounterService.ts +++ b/Apps/WebClient/src/ClientApp/src/services/restEncounterService.ts @@ -15,10 +15,10 @@ import ErrorTranslator from "@/utility/errorTranslator"; export class RestEncounterService implements IEncounterService { private readonly ENCOUNTER_BASE_URI: string = "Encounter"; - private logger; - private http; - private baseUri; - private isEnabled; + private readonly logger; + private readonly http; + private readonly baseUri; + private readonly isEnabled; constructor( logger: ILogger, diff --git a/Apps/WebClient/src/ClientApp/src/services/restHospitalVisitService.ts b/Apps/WebClient/src/ClientApp/src/services/restHospitalVisitService.ts index a3c4a6a3b4..0f0389f138 100644 --- a/Apps/WebClient/src/ClientApp/src/services/restHospitalVisitService.ts +++ b/Apps/WebClient/src/ClientApp/src/services/restHospitalVisitService.ts @@ -15,10 +15,10 @@ import ErrorTranslator from "@/utility/errorTranslator"; export class RestHospitalVisitService implements IHospitalVisitService { private readonly HOSPITAL_VISIT_BASE_URI: string = "Encounter"; - private logger; - private http; - private baseUri; - private isEnabled; + private readonly logger; + private readonly http; + private readonly baseUri; + private readonly isEnabled; constructor( logger: ILogger, diff --git a/Apps/WebClient/src/ClientApp/src/services/restImmunizationService.ts b/Apps/WebClient/src/ClientApp/src/services/restImmunizationService.ts index 91e5c1ca63..5db4a8ac4f 100644 --- a/Apps/WebClient/src/ClientApp/src/services/restImmunizationService.ts +++ b/Apps/WebClient/src/ClientApp/src/services/restImmunizationService.ts @@ -15,10 +15,10 @@ import ErrorTranslator from "@/utility/errorTranslator"; export class RestImmunizationService implements IImmunizationService { private readonly IMMS_BASE_URI: string = "Immunization"; - private logger; - private http; - private baseUri; - private isEnabled; + private readonly logger; + private readonly http; + private readonly baseUri; + private readonly isEnabled; constructor( logger: ILogger, diff --git a/Apps/WebClient/src/ClientApp/src/services/restLaboratoryService.ts b/Apps/WebClient/src/ClientApp/src/services/restLaboratoryService.ts index 47fd2339c8..b3ba551c5e 100644 --- a/Apps/WebClient/src/ClientApp/src/services/restLaboratoryService.ts +++ b/Apps/WebClient/src/ClientApp/src/services/restLaboratoryService.ts @@ -19,11 +19,11 @@ import ErrorTranslator from "@/utility/errorTranslator"; export class RestLaboratoryService implements ILaboratoryService { private readonly LABORATORY_BASE_URI: string = "Laboratory"; - private logger; - private http; - private baseUri; - private isEnabled; - private isCovid19Enabled; + private readonly logger; + private readonly http; + private readonly baseUri; + private readonly isEnabled; + private readonly isCovid19Enabled; constructor( logger: ILogger, diff --git a/Apps/WebClient/src/ClientApp/src/services/restMedicationService.ts b/Apps/WebClient/src/ClientApp/src/services/restMedicationService.ts index 7dcb2a66c7..3456ecb418 100644 --- a/Apps/WebClient/src/ClientApp/src/services/restMedicationService.ts +++ b/Apps/WebClient/src/ClientApp/src/services/restMedicationService.ts @@ -16,10 +16,10 @@ import ErrorTranslator from "@/utility/errorTranslator"; export class RestMedicationService implements IMedicationService { private readonly BASE_URI: string = "MedicationStatement"; - private logger; - private http; - private baseUri; - private isEnabled; + private readonly logger; + private readonly http; + private readonly baseUri; + private readonly isEnabled; constructor( logger: ILogger, diff --git a/Apps/WebClient/src/ClientApp/src/services/restNotificationService.ts b/Apps/WebClient/src/ClientApp/src/services/restNotificationService.ts index 353bd464bf..e9d17e465d 100644 --- a/Apps/WebClient/src/ClientApp/src/services/restNotificationService.ts +++ b/Apps/WebClient/src/ClientApp/src/services/restNotificationService.ts @@ -11,10 +11,10 @@ import ErrorTranslator from "@/utility/errorTranslator"; export class RestNotificationService implements INotificationService { private readonly NOTIFICATION_BASE_URI: string = "Notification"; - private logger; - private http; - private baseUri; - private isEnabled; + private readonly logger; + private readonly http; + private readonly baseUri; + private readonly isEnabled; constructor( logger: ILogger, diff --git a/Apps/WebClient/src/ClientApp/src/services/restPatientDataService.ts b/Apps/WebClient/src/ClientApp/src/services/restPatientDataService.ts index 72b4c698af..32965a1fb0 100644 --- a/Apps/WebClient/src/ClientApp/src/services/restPatientDataService.ts +++ b/Apps/WebClient/src/ClientApp/src/services/restPatientDataService.ts @@ -39,9 +39,9 @@ export const entryTypeToPatientDataTypeMap: Map = export class RestPatientDataService implements IPatientDataService { private readonly BASE_URI = "PatientData"; - private logger; - private http; - private baseUri; + private readonly logger; + private readonly http; + private readonly baseUri; constructor( logger: ILogger, diff --git a/Apps/WebClient/src/ClientApp/src/services/restPatientService.ts b/Apps/WebClient/src/ClientApp/src/services/restPatientService.ts index c4c92f8e36..296435c1ba 100644 --- a/Apps/WebClient/src/ClientApp/src/services/restPatientService.ts +++ b/Apps/WebClient/src/ClientApp/src/services/restPatientService.ts @@ -7,9 +7,9 @@ import ErrorTranslator from "@/utility/errorTranslator"; export class RestPatientService implements IPatientService { private readonly PATIENT_BASE_URI: string = "Patient"; - private logger; - private http; - private baseUri; + private readonly logger; + private readonly http; + private readonly baseUri; constructor( logger: ILogger, diff --git a/Apps/WebClient/src/ClientApp/src/services/restPcrTestService.ts b/Apps/WebClient/src/ClientApp/src/services/restPcrTestService.ts index f6ff132544..f70fc1f138 100644 --- a/Apps/WebClient/src/ClientApp/src/services/restPcrTestService.ts +++ b/Apps/WebClient/src/ClientApp/src/services/restPcrTestService.ts @@ -11,10 +11,10 @@ import RequestResultUtil from "@/utility/requestResultUtil"; export class RestPcrTestService implements IPcrTestService { private readonly LABORATORY_BASE_URI: string = "Laboratory"; private readonly PUBLIC_LABORATORY_BASE_URI: string = "PublicLaboratory"; - private logger; - private http; - private baseUri; - private isEnabled; + private readonly logger; + private readonly http; + private readonly baseUri; + private readonly isEnabled; constructor( logger: ILogger, diff --git a/Apps/WebClient/src/ClientApp/src/services/restReportService.ts b/Apps/WebClient/src/ClientApp/src/services/restReportService.ts index ee78a9301e..d19b803f96 100644 --- a/Apps/WebClient/src/ClientApp/src/services/restReportService.ts +++ b/Apps/WebClient/src/ClientApp/src/services/restReportService.ts @@ -9,9 +9,9 @@ import ErrorTranslator from "@/utility/errorTranslator"; export class RestReportService implements IReportService { private readonly REPORT_BASE_URI: string = "Report"; - private logger; - private http; - private baseUri; + private readonly logger; + private readonly http; + private readonly baseUri; constructor( logger: ILogger, diff --git a/Apps/WebClient/src/ClientApp/src/services/restSpecialAuthorityService.ts b/Apps/WebClient/src/ClientApp/src/services/restSpecialAuthorityService.ts index ff4d242cf5..ed7033c222 100644 --- a/Apps/WebClient/src/ClientApp/src/services/restSpecialAuthorityService.ts +++ b/Apps/WebClient/src/ClientApp/src/services/restSpecialAuthorityService.ts @@ -15,10 +15,10 @@ import ErrorTranslator from "@/utility/errorTranslator"; export class RestSpecialAuthorityService implements ISpecialAuthorityService { private readonly SPECIAL_AUTHORITY_BASE_URI: string = "MedicationRequest"; - private logger; - private http; - private baseUri; - private isEnabled; + private readonly logger; + private readonly http; + private readonly baseUri; + private readonly isEnabled; constructor( logger: ILogger, diff --git a/Apps/WebClient/src/ClientApp/src/services/restTrackingService.ts b/Apps/WebClient/src/ClientApp/src/services/restTrackingService.ts index 91ad2a6bb4..95e56abbda 100644 --- a/Apps/WebClient/src/ClientApp/src/services/restTrackingService.ts +++ b/Apps/WebClient/src/ClientApp/src/services/restTrackingService.ts @@ -4,7 +4,7 @@ import { ILogger, ITrackingService } from "@/services/interfaces"; declare let window: SnowplowWindow; export class RestTrackingService implements ITrackingService { - private logger; + private readonly logger; constructor(logger: ILogger) { this.logger = logger; diff --git a/Apps/WebClient/src/ClientApp/src/services/restUserCommentService.ts b/Apps/WebClient/src/ClientApp/src/services/restUserCommentService.ts index c3a3397f34..473f7b0990 100644 --- a/Apps/WebClient/src/ClientApp/src/services/restUserCommentService.ts +++ b/Apps/WebClient/src/ClientApp/src/services/restUserCommentService.ts @@ -15,10 +15,10 @@ import RequestResultUtil from "@/utility/requestResultUtil"; export class RestUserCommentService implements IUserCommentService { private readonly USER_COMMENT_BASE_URI: string = "UserProfile"; - private logger; - private http; - private baseUri; - private isEnabled; + private readonly logger; + private readonly http; + private readonly baseUri; + private readonly isEnabled; constructor( logger: ILogger, diff --git a/Apps/WebClient/src/ClientApp/src/services/restUserFeedback.ts b/Apps/WebClient/src/ClientApp/src/services/restUserFeedback.ts index 14d1603b4f..fe4b37958b 100644 --- a/Apps/WebClient/src/ClientApp/src/services/restUserFeedback.ts +++ b/Apps/WebClient/src/ClientApp/src/services/restUserFeedback.ts @@ -11,9 +11,9 @@ import ErrorTranslator from "@/utility/errorTranslator"; export class RestUserFeedbackService implements IUserFeedbackService { private readonly USER_FEEDBACK_BASE_URI: string = "UserFeedback"; - private logger; - private http; - private baseUri; + private readonly logger; + private readonly http; + private readonly baseUri; constructor( logger: ILogger, diff --git a/Apps/WebClient/src/ClientApp/src/services/restUserNoteService.ts b/Apps/WebClient/src/ClientApp/src/services/restUserNoteService.ts index b3efbe3f9e..b828a13daf 100644 --- a/Apps/WebClient/src/ClientApp/src/services/restUserNoteService.ts +++ b/Apps/WebClient/src/ClientApp/src/services/restUserNoteService.ts @@ -17,10 +17,10 @@ import RequestResultUtil from "@/utility/requestResultUtil"; export class RestUserNoteService implements IUserNoteService { private readonly USER_NOTE_BASE_URI: string = "Note"; - private logger; - private http; - private baseUri; - private isEnabled; + private readonly logger; + private readonly http; + private readonly baseUri; + private readonly isEnabled; constructor( logger: ILogger, diff --git a/Apps/WebClient/src/ClientApp/src/services/restUserProfileService.ts b/Apps/WebClient/src/ClientApp/src/services/restUserProfileService.ts index 1a8d573a1b..82d1e69caf 100644 --- a/Apps/WebClient/src/ClientApp/src/services/restUserProfileService.ts +++ b/Apps/WebClient/src/ClientApp/src/services/restUserProfileService.ts @@ -19,9 +19,9 @@ export class RestUserProfileService implements IUserProfileService { "application/json; charset=utf-8"; private readonly CONTENT_TYPE: string = "Content-Type"; private readonly USER_PROFILE_BASE_URI: string = "UserProfile"; - private logger; - private http; - private baseUri; + private readonly logger; + private readonly http; + private readonly baseUri; constructor( logger: ILogger, diff --git a/Apps/WebClient/src/ClientApp/src/services/restUserProfileServiceV2.ts b/Apps/WebClient/src/ClientApp/src/services/restUserProfileServiceV2.ts index cd22fd2379..23ba4c9c5a 100644 --- a/Apps/WebClient/src/ClientApp/src/services/restUserProfileServiceV2.ts +++ b/Apps/WebClient/src/ClientApp/src/services/restUserProfileServiceV2.ts @@ -18,9 +18,9 @@ export class RestUserProfileServiceV2 implements IUserProfileService { private readonly CONTENT_TYPE: string = "Content-Type"; private readonly USER_PROFILE_BASE_URI: string = "UserProfile"; private readonly API_VERSION: string = "2.0"; - private logger; - private http; - private baseUri; + private readonly logger; + private readonly http; + private readonly baseUri; constructor( logger: ILogger, diff --git a/Apps/WebClient/src/ClientApp/src/services/restUserRatingService.ts b/Apps/WebClient/src/ClientApp/src/services/restUserRatingService.ts index 37127d821d..abba721770 100644 --- a/Apps/WebClient/src/ClientApp/src/services/restUserRatingService.ts +++ b/Apps/WebClient/src/ClientApp/src/services/restUserRatingService.ts @@ -11,9 +11,9 @@ import ErrorTranslator from "@/utility/errorTranslator"; export class RestUserRatingService implements IUserRatingService { private readonly USER_RATING_BASE_URI: string = "UserFeedback/Rating"; - private logger; - private http; - private baseUri; + private readonly logger; + private readonly http; + private readonly baseUri; constructor( logger: ILogger, diff --git a/Apps/WebClient/src/ClientApp/src/services/restVaccinationStatusService.ts b/Apps/WebClient/src/ClientApp/src/services/restVaccinationStatusService.ts index f1cd2b9c9c..37ada92eaf 100644 --- a/Apps/WebClient/src/ClientApp/src/services/restVaccinationStatusService.ts +++ b/Apps/WebClient/src/ClientApp/src/services/restVaccinationStatusService.ts @@ -18,10 +18,10 @@ export class RestVaccinationStatusService implements IVaccinationStatusService { "PublicVaccineStatus"; private readonly AUTHENTICATED_VACCINATION_STATUS_BASE_URI: string = "AuthenticatedVaccineStatus"; - private logger; - private http; - private baseUri; - private isEnabled; + private readonly logger; + private readonly http; + private readonly baseUri; + private readonly isEnabled; constructor( logger: ILogger, diff --git a/Apps/WebClient/src/ClientApp/src/stores/auth.ts b/Apps/WebClient/src/ClientApp/src/stores/auth.ts index fca55c0b6c..70b981dc90 100644 --- a/Apps/WebClient/src/ClientApp/src/stores/auth.ts +++ b/Apps/WebClient/src/ClientApp/src/stores/auth.ts @@ -124,19 +124,27 @@ export const useAuthStore = defineStore("auth", () => { } } + function handleTokenRefreshed() { + logger.verbose("Refreshed access token"); + const tokenDetails = authService.getOidcTokenDetails(); + if (tokenDetails !== null) { + handleSuccessfulAuthentication(tokenDetails); + } + } + + function handleTokenNotRefreshed() { + logger.verbose("Access token refresh not required"); + } + function refreshToken() { logger.info("Refreshing access token"); authService .refreshToken() .then((refreshed) => { if (refreshed) { - logger.verbose("Refreshed access token"); - const tokenDetails = authService.getOidcTokenDetails(); - if (tokenDetails !== null) { - handleSuccessfulAuthentication(tokenDetails); - } + handleTokenRefreshed(); } else { - logger.verbose("Access token refresh not required"); + handleTokenNotRefreshed(); } }) .catch(() => { diff --git a/Apps/WebClient/src/ClientApp/src/utility/idleDetector.ts b/Apps/WebClient/src/ClientApp/src/utility/idleDetector.ts index 3b31c1f0b6..30de33f888 100644 --- a/Apps/WebClient/src/ClientApp/src/utility/idleDetector.ts +++ b/Apps/WebClient/src/ClientApp/src/utility/idleDetector.ts @@ -13,11 +13,13 @@ export class IdleDetector { ]; private readonly idleTimer: ReliableTimer; private enabled = false; - private notifyActiveThrottled = throttle(1000, () => this.notifyActive()); + private readonly notifyActiveThrottled = throttle(1000, () => + this.notifyActive() + ); constructor( - private isIdleCallback: (timeIdle: number) => void, - private timeBeforeIdle: number, + private readonly isIdleCallback: (timeIdle: number) => void, + private readonly timeBeforeIdle: number, startEnabled: boolean ) { this.idleTimer = new ReliableTimer( diff --git a/Apps/WebClient/src/ClientApp/src/utility/reliableTimer.ts b/Apps/WebClient/src/ClientApp/src/utility/reliableTimer.ts index 3f415c4bcb..9747125b14 100644 --- a/Apps/WebClient/src/ClientApp/src/utility/reliableTimer.ts +++ b/Apps/WebClient/src/ClientApp/src/utility/reliableTimer.ts @@ -3,7 +3,10 @@ export class ReliableTimer { private timeoutId?: ReturnType; private startingTimestamp?: number; - constructor(private callback: () => void, private duration: number) { + constructor( + private readonly callback: () => void, + private readonly duration: number + ) { if (duration < this.interval) { throw new Error(`Duration must be at least ${this.interval}ms`); } diff --git a/Apps/WebClient/src/ClientApp/src/utility/validationUtil.ts b/Apps/WebClient/src/ClientApp/src/utility/validationUtil.ts index d533f38858..95afa229ce 100644 --- a/Apps/WebClient/src/ClientApp/src/utility/validationUtil.ts +++ b/Apps/WebClient/src/ClientApp/src/utility/validationUtil.ts @@ -79,6 +79,6 @@ export default abstract class ValidationUtil { predicate: boolean, validatorObject: object ) { - return predicate ? validatorObject : {}; + return (predicate && validatorObject) || {}; } } diff --git a/Apps/WebClient/src/Server/Models/MobileConfiguration.cs b/Apps/WebClient/src/Server/Models/MobileConfiguration.cs index cd3d447e23..14dd63000a 100644 --- a/Apps/WebClient/src/Server/Models/MobileConfiguration.cs +++ b/Apps/WebClient/src/Server/Models/MobileConfiguration.cs @@ -17,7 +17,6 @@ namespace HealthGateway.WebClient.Server.Models { using System; using System.Collections.Generic; - using System.Linq; /// /// Configuration data to be used by the Health Gateway Mobile App. @@ -35,16 +34,16 @@ public record MobileConfiguration( /// /// Gets or sets the collection of enabled datasets. /// - public IEnumerable Datasets { get; set; } = Enumerable.Empty(); + public IEnumerable Datasets { get; set; } = []; /// /// Gets or sets the collection of enabled datasets for dependents. /// - public IEnumerable DependentDatasets { get; set; } = Enumerable.Empty(); + public IEnumerable DependentDatasets { get; set; } = []; /// /// Gets or sets the collection of enabled services. /// - public IEnumerable Services { get; set; } = Enumerable.Empty(); + public IEnumerable Services { get; set; } = []; } } diff --git a/Apps/WebClient/test/unit/Controllers/RobotsControllerTests.cs b/Apps/WebClient/test/unit/Controllers/RobotsControllerTests.cs index bacf94ca7e..c660175061 100644 --- a/Apps/WebClient/test/unit/Controllers/RobotsControllerTests.cs +++ b/Apps/WebClient/test/unit/Controllers/RobotsControllerTests.cs @@ -17,7 +17,6 @@ namespace HealthGateway.WebClientTests.Controllers { using System.Collections.Generic; using System.IO; - using System.Linq; using System.Net.Mime; using System.Threading.Tasks; using DeepEqual.Syntax; @@ -73,7 +72,7 @@ public async Task ShouldGetRobots(bool robotsFilePathExists, bool robotsFileCont }; IConfigurationRoot configuration = new ConfigurationBuilder() - .AddInMemoryCollection(myConfiguration.ToList()) + .AddInMemoryCollection(myConfiguration) .Build(); using RobotsController controller = new(configuration); diff --git a/Apps/WebClient/test/unit/Services/ConfigurationServiceTests.cs b/Apps/WebClient/test/unit/Services/ConfigurationServiceTests.cs index c91d00ae6f..3c1c57446c 100644 --- a/Apps/WebClient/test/unit/Services/ConfigurationServiceTests.cs +++ b/Apps/WebClient/test/unit/Services/ConfigurationServiceTests.cs @@ -81,8 +81,8 @@ public async Task TestGetMobileConfiguration() "myhealthbc://*"), 2) { - Datasets = new[] - { + Datasets = + [ "bcCancerScreening", "clinicalDocument", "covid19TestResult", @@ -94,9 +94,9 @@ public async Task TestGetMobileConfiguration() "medication", "note", "specialAuthorityRequest", - }, - DependentDatasets = new[] - { + ], + DependentDatasets = + [ "bcCancerScreening", "clinicalDocument", "covid19TestResult", @@ -107,12 +107,12 @@ public async Task TestGetMobileConfiguration() "labResult", "medication", "specialAuthorityRequest", - }, - Services = new[] - { + ], + Services = + [ "organDonorRegistration", "healthConnectRegistry", - }, + ], }; MobileConfiguration actualResult = await this.service.GetMobileConfigurationAsync(); @@ -176,8 +176,8 @@ private static ExternalConfiguration GenerateExternalConfiguration( { "Logout", new Uri("https://localhost/logout") }, }, }, - IdentityProviders = new[] - { + IdentityProviders = + [ new IdentityProviderConfiguration { Id = "Id", @@ -186,7 +186,7 @@ private static ExternalConfiguration GenerateExternalConfiguration( Hint = "Hint", Disabled = true, }, - }, + ], WebClient = new WebClientConfiguration { LogLevel = "LogLevel", @@ -207,23 +207,10 @@ private static ExternalConfiguration GenerateExternalConfiguration( new HomepageSettings(true, true), new NotificationCentreSettings(true), new TimelineSettings(true), - new DatasetSettings[] - { - new("bcCancerScreening", true), - new("clinicalDocument", true), - new("covid19TestResult", true), - new("diagnosticImaging", true), - new("healthVisit", true), - new("hospitalVisit", true), - new("immunization", true), - new("labResult", true), - new("medication", true), - new("note", true), - new("specialAuthorityRequest", true), - }, + GetFeatureDatasetSettings(), new Covid19Settings(true, new PublicCovid19Settings(true), new ProofOfVaccinationSettings(false)), - new DependentsSettings(true, true, new DatasetSettings[] { new("note", false) }), - new ServicesSettings(true, new ServiceSetting[] { new("organDonorRegistration", true), new("healthConnectRegistry", true) })) + new DependentsSettings(true, true, [new("note", false)]), + new ServicesSettings(true, [new("organDonorRegistration", true), new("healthConnectRegistry", true)])) : null, }, ServiceEndpoints = new Dictionary @@ -234,5 +221,14 @@ private static ExternalConfiguration GenerateExternalConfiguration( }, }; } + + private static DatasetSettings[] GetFeatureDatasetSettings() + { + return + [ + new("bcCancerScreening", true), new("clinicalDocument", true), new("covid19TestResult", true), new("diagnosticImaging", true), new("healthVisit", true), + new("hospitalVisit", true), new("immunization", true), new("labResult", true), new("medication", true), new("note", true), new("specialAuthorityRequest", true), + ]; + } } }