From f00cc629c9711980e62262193b92b923e0648c57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=BCller?= Date: Fri, 21 Jun 2024 13:30:57 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20Type=20external=20connections=20?= =?UTF-8?q?store?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/appointment/routes/account.py | 2 +- frontend/src/models.ts | 13 +++++++++++++ frontend/src/stores/calendar-store.ts | 2 +- ...ions-store.js => external-connections-store.ts} | 14 ++++++++------ 4 files changed, 23 insertions(+), 8 deletions(-) rename frontend/src/stores/{external-connections-store.js => external-connections-store.ts} (65%) diff --git a/backend/src/appointment/routes/account.py b/backend/src/appointment/routes/account.py index edb3a323a..cf7aa76be 100644 --- a/backend/src/appointment/routes/account.py +++ b/backend/src/appointment/routes/account.py @@ -27,7 +27,7 @@ def get_external_connections(subscriber: Subscriber = Depends(get_subscriber)): external_connections = defaultdict(list) if os.getenv('ZOOM_API_ENABLED'): - external_connections['Zoom'] = [] + external_connections['zoom'] = [] for ec in subscriber.external_connections: external_connections[ec.type.name].append( diff --git a/frontend/src/models.ts b/frontend/src/models.ts index 6fb384965..e4497acb0 100644 --- a/frontend/src/models.ts +++ b/frontend/src/models.ts @@ -54,3 +54,16 @@ export type Calendar = { title: string; color: string; }; + +export type ExternalConnection = { + owner_id: number; + name: string; + type: string; + type_id: string; +}; + +export type ExternalConnectionCollection = { + fxa?: ExternalConnection[]; + google?: ExternalConnection[]; + zoom?: ExternalConnection[]; +}; diff --git a/frontend/src/stores/calendar-store.ts b/frontend/src/stores/calendar-store.ts index 9841d3fbc..7aaf97cba 100644 --- a/frontend/src/stores/calendar-store.ts +++ b/frontend/src/stores/calendar-store.ts @@ -17,7 +17,7 @@ export const useCalendarStore = defineStore('calendars', () => { /** * Get all calendars for current user - * @param {function} call preconfigured API fetch function + * @param call preconfigured API fetch function */ const fetch = async (call: (url: string) => UseFetchReturn & PromiseLike>) => { if (isLoaded.value) { diff --git a/frontend/src/stores/external-connections-store.js b/frontend/src/stores/external-connections-store.ts similarity index 65% rename from frontend/src/stores/external-connections-store.js rename to frontend/src/stores/external-connections-store.ts index 753409585..ea06754e0 100644 --- a/frontend/src/stores/external-connections-store.js +++ b/frontend/src/stores/external-connections-store.ts @@ -1,3 +1,5 @@ +import { ExternalConnection, ExternalConnectionCollection } from '@/models'; +import { UseFetchReturn } from '@vueuse/core'; import { defineStore } from 'pinia'; import { ref, computed } from 'vue'; @@ -7,10 +9,10 @@ export const useExternalConnectionsStore = defineStore('externalConnections', () const isLoaded = ref(false); // Data - const zoom = ref([]); - const fxa = ref([]); - const google = ref([]); - const connections = computed(() => ({ + const zoom = ref([]); + const fxa = ref([]); + const google = ref([]); + const connections = computed((): ExternalConnectionCollection => ({ // FXA should be at the top since it represents the Appointment subscriber. fxa: fxa.value, google: google.value, @@ -19,9 +21,9 @@ export const useExternalConnectionsStore = defineStore('externalConnections', () /** * Get all external connections for current user - * @param {function} call preconfigured API fetch function + * @param call preconfigured API fetch function */ - const fetch = async (call) => { + const fetch = async (call: (url: string) => UseFetchReturn & PromiseLike>) => { if (isLoaded.value) { return; }