From 29bf7471b12745cf4fc3332b3d64148dc2bd7c75 Mon Sep 17 00:00:00 2001 From: Florian sabonchi Date: Sat, 10 Feb 2024 13:08:15 +0100 Subject: [PATCH 1/4] fix: wrong organisation --- apps/tasks/lib/services/patient_svc.dart | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/tasks/lib/services/patient_svc.dart b/apps/tasks/lib/services/patient_svc.dart index bd9ece90..2d17ab1b 100644 --- a/apps/tasks/lib/services/patient_svc.dart +++ b/apps/tasks/lib/services/patient_svc.dart @@ -5,6 +5,7 @@ import 'package:tasks/dataclasses/patient.dart'; import 'package:tasks/dataclasses/room.dart'; import 'package:tasks/dataclasses/subtask.dart'; import 'package:tasks/dataclasses/ward.dart'; +import 'package:tasks/services/current_ward_svc.dart'; import 'package:tasks/services/grpc_client_svc.dart'; import '../dataclasses/task.dart'; @@ -24,7 +25,9 @@ class PatientService { GetPatientListResponse response = await patientService.getPatientList( request, options: CallOptions( - metadata: GRPCClientService().getTaskServiceMetaData(), + metadata: GRPCClientService().getTaskServiceMetaData( + organizationId: CurrentWardService().currentWard?.organizationId + ), ), ); From 9a786d7e6f15ebaa0101dbe64d966f30200fb56a Mon Sep 17 00:00:00 2001 From: Florian sabonchi Date: Sun, 11 Feb 2024 15:42:27 +0100 Subject: [PATCH 2/4] feat: rename config.dart variable names --- apps/tasks/lib/config/config.dart | 8 ++++---- apps/tasks/lib/services/current_ward_svc.dart | 6 +++--- apps/tasks/lib/services/grpc_client_svc.dart | 4 ++-- apps/tasks/lib/services/user_session_service.dart | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/apps/tasks/lib/config/config.dart b/apps/tasks/lib/config/config.dart index 33db3128..207fcd97 100644 --- a/apps/tasks/lib/config/config.dart +++ b/apps/tasks/lib/config/config.dart @@ -4,13 +4,13 @@ const minimumPasswordCharacters = 6; /// Whether the development mode should be enabled /// /// Shortens the login -const bool DEV_MODE = false; +const bool devMode = false; /// The API for testing -const String STAGING_API_URL = "staging.api.helpwave.de"; +const String stagingAPIURL = "staging.api.helpwave.de"; /// The API for production -const String PRODUCTION_API_URL = "api.helpwave.de"; +const String productionAPIURL = "api.helpwave.de"; /// The API to be used -const String USED_API_URL = DEV_MODE ? STAGING_API_URL : PRODUCTION_API_URL; +const String usedAPIURL = devMode ? stagingAPIURL : productionAPIURL; diff --git a/apps/tasks/lib/services/current_ward_svc.dart b/apps/tasks/lib/services/current_ward_svc.dart index ec9a8ca3..8711d471 100644 --- a/apps/tasks/lib/services/current_ward_svc.dart +++ b/apps/tasks/lib/services/current_ward_svc.dart @@ -92,7 +92,7 @@ class CurrentWardService extends Listenable { final List _listeners = []; CurrentWardService._initialize() { - if (!DEV_MODE) { + if (!devMode) { load(); } } @@ -102,7 +102,7 @@ class CurrentWardService extends Listenable { factory CurrentWardService() => _currentWardService; set currentWard(CurrentWardInformation? currentWard) { - if (!DEV_MODE) { + if (!devMode) { if (currentWard == null) { _preferences.clear(); } else { @@ -124,7 +124,7 @@ class CurrentWardService extends Listenable { /// Load the preferences with the [_CurrentWardPreferences] Future load() async { // everything is done in the setter - currentWard = DEV_MODE ? null : await _preferences.getInformation(); + currentWard = devMode ? null : await _preferences.getInformation(); } /// Fetch [Ward] and [Organization] from backend diff --git a/apps/tasks/lib/services/grpc_client_svc.dart b/apps/tasks/lib/services/grpc_client_svc.dart index 1fac4543..ce066188 100644 --- a/apps/tasks/lib/services/grpc_client_svc.dart +++ b/apps/tasks/lib/services/grpc_client_svc.dart @@ -12,10 +12,10 @@ import 'user_session_service.dart'; /// The Underlying GrpcService it provides other clients and the correct metadata for the requests class GRPCClientService { static final taskServiceChannel = ClientChannel( - USED_API_URL, + usedAPIURL, ); static final userServiceChannel = ClientChannel( - USED_API_URL, + usedAPIURL, ); final UserSessionService authService = UserSessionService(); diff --git a/apps/tasks/lib/services/user_session_service.dart b/apps/tasks/lib/services/user_session_service.dart index 771d1692..6df1ee87 100644 --- a/apps/tasks/lib/services/user_session_service.dart +++ b/apps/tasks/lib/services/user_session_service.dart @@ -28,7 +28,7 @@ class UserSessionService { /// /// Sets the [hasTriedTokens] to true Future tokenLogin() async { - if (!DEV_MODE) { + if (!devMode) { _identity = await _authService.tokenLogin(); // new login required thus delete all saved information if (_identity == null) { @@ -43,14 +43,14 @@ class UserSessionService { /// Logs a User in by a in app web view Future login() async { - if (!DEV_MODE) { + if (!devMode) { _identity = await _authService.login(); } } /// Logs a User out and removes all stored information logout() { - _identity = DEV_MODE ? Identity.defaultIdentity() : null; + _identity = devMode ? Identity.defaultIdentity() : null; _hasTriedTokens = true; _authService.revoke(); } From 1ef9a507f428bd81f66e5e20ab04393c9cdabaf0 Mon Sep 17 00:00:00 2001 From: Florian <54689374+florian-sabonchi@users.noreply.github.com> Date: Wed, 21 Feb 2024 16:53:05 +0100 Subject: [PATCH 3/4] feat: Update apps/tasks/lib/services/patient_svc.dart Co-authored-by: Felix <67233923+DasProffi@users.noreply.github.com> --- apps/tasks/lib/services/patient_svc.dart | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/apps/tasks/lib/services/patient_svc.dart b/apps/tasks/lib/services/patient_svc.dart index 2d17ab1b..6509d995 100644 --- a/apps/tasks/lib/services/patient_svc.dart +++ b/apps/tasks/lib/services/patient_svc.dart @@ -25,9 +25,7 @@ class PatientService { GetPatientListResponse response = await patientService.getPatientList( request, options: CallOptions( - metadata: GRPCClientService().getTaskServiceMetaData( - organizationId: CurrentWardService().currentWard?.organizationId - ), + metadata: GRPCClientService().getTaskServiceMetaData(), ), ); From 24cc38154850f48cdc80979c9aaa24b8e09e524b Mon Sep 17 00:00:00 2001 From: Florian <54689374+florian-sabonchi@users.noreply.github.com> Date: Wed, 21 Feb 2024 16:53:15 +0100 Subject: [PATCH 4/4] feat: Update apps/tasks/lib/services/patient_svc.dart Co-authored-by: Felix <67233923+DasProffi@users.noreply.github.com> --- apps/tasks/lib/services/patient_svc.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/tasks/lib/services/patient_svc.dart b/apps/tasks/lib/services/patient_svc.dart index 6509d995..bd9ece90 100644 --- a/apps/tasks/lib/services/patient_svc.dart +++ b/apps/tasks/lib/services/patient_svc.dart @@ -5,7 +5,6 @@ import 'package:tasks/dataclasses/patient.dart'; import 'package:tasks/dataclasses/room.dart'; import 'package:tasks/dataclasses/subtask.dart'; import 'package:tasks/dataclasses/ward.dart'; -import 'package:tasks/services/current_ward_svc.dart'; import 'package:tasks/services/grpc_client_svc.dart'; import '../dataclasses/task.dart';