From 35821dbccd80537330861070b33bc00d94cdf19e Mon Sep 17 00:00:00 2001
From: Fabio Manganiello <fabio@manganiello.tech>
Date: Wed, 26 Mar 2025 22:23:46 +0100
Subject: [PATCH] =?UTF-8?q?=EE=AA=AF=20=20Fixed=20type=20errors?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 frontend/src/components/Map.vue      |  6 ++--
 frontend/src/models/LocationQuery.ts | 42 +++++++++++++++-------------
 2 files changed, 25 insertions(+), 23 deletions(-)

diff --git a/frontend/src/components/Map.vue b/frontend/src/components/Map.vue
index 1cd5c59..38e6a94 100644
--- a/frontend/src/components/Map.vue
+++ b/frontend/src/components/Map.vue
@@ -28,7 +28,7 @@
         </div>
 
         <PointInfo :point="selectedPoint"
-                   :device="devicesById[selectedPoint?.deviceId]"
+                   :device="selectedPoint ? devicesById[selectedPoint?.deviceId] : null"
                    ref="popup"
                    @remove="onRemove"
                    @edit="editPoint"
@@ -147,8 +147,8 @@ export default {
   },
 
   computed: {
-    devicesById(): Record<string, string> {
-      return this.devices.reduce((acc: Record<string, string>, device: any) => {
+    devicesById(): Record<string, UserDevice> {
+      return this.devices.reduce((acc: Record<string, UserDevice>, device: any) => {
         acc[device.id] = device
         return acc
       }, {})
diff --git a/frontend/src/models/LocationQuery.ts b/frontend/src/models/LocationQuery.ts
index 2a1b427..cb0db7b 100644
--- a/frontend/src/models/LocationQuery.ts
+++ b/frontend/src/models/LocationQuery.ts
@@ -1,28 +1,30 @@
+import { type Optional } from "./Types";
+
 class LocationQuery {
   public limit: number = 500;
-  public offset: number | null = null;
-  public deviceId: string | null = null;
-  public startDate: Date | null = null;
-  public endDate: Date | null = null;
-  public minId: number | null = null;
-  public maxId: number | null = null;
-  public country: string | null = null;
-  public locality: string | null = null;
-  public postalCode: string | null = null;
+  public offset: Optional<number> = null;
+  public deviceId: Optional<string> = null;
+  public startDate: Optional<Date> = null;
+  public endDate: Optional<Date> = null;
+  public minId: Optional<number> = null;
+  public maxId: Optional<number> = null;
+  public country: Optional<string> = null;
+  public locality: Optional<string> = null;
+  public postalCode: Optional<string> = null;
   public order: string = 'asc';
 
   constructor(data: {
-    limit?: number;
-    offset?: number;
-    deviceId?: string;
-    startDate?: Date;
-    endDate?: Date;
-    minId?: number;
-    maxId?: number;
-    country?: string;
-    locality?: string;
-    postalCode?: string;
-    order?: string;
+    limit?: Optional<number>;
+    offset?: Optional<number>;
+    deviceId?: Optional<string>;
+    startDate?: Optional<Date>;
+    endDate?: Optional<Date>;
+    minId?: Optional<number>;
+    maxId?: Optional<number>;
+    country?: Optional<string>;
+    locality?: Optional<string>;
+    postalCode?: Optional<string>;
+    order?: Optional<string>;
   }) {
     this.limit = data.limit || this.limit;
     this.offset = data.offset || this.offset;