 Fixed type errors

This commit is contained in:
Fabio Manganiello 2025-03-26 22:23:46 +01:00
parent a319e1517c
commit 35821dbccd
Signed by: blacklight
GPG key ID: D90FBA7F76362774
2 changed files with 25 additions and 23 deletions
frontend/src
components
models

View file

@ -28,7 +28,7 @@
</div> </div>
<PointInfo :point="selectedPoint" <PointInfo :point="selectedPoint"
:device="devicesById[selectedPoint?.deviceId]" :device="selectedPoint ? devicesById[selectedPoint?.deviceId] : null"
ref="popup" ref="popup"
@remove="onRemove" @remove="onRemove"
@edit="editPoint" @edit="editPoint"
@ -147,8 +147,8 @@ export default {
}, },
computed: { computed: {
devicesById(): Record<string, string> { devicesById(): Record<string, UserDevice> {
return this.devices.reduce((acc: Record<string, string>, device: any) => { return this.devices.reduce((acc: Record<string, UserDevice>, device: any) => {
acc[device.id] = device acc[device.id] = device
return acc return acc
}, {}) }, {})

View file

@ -1,28 +1,30 @@
import { type Optional } from "./Types";
class LocationQuery { class LocationQuery {
public limit: number = 500; public limit: number = 500;
public offset: number | null = null; public offset: Optional<number> = null;
public deviceId: string | null = null; public deviceId: Optional<string> = null;
public startDate: Date | null = null; public startDate: Optional<Date> = null;
public endDate: Date | null = null; public endDate: Optional<Date> = null;
public minId: number | null = null; public minId: Optional<number> = null;
public maxId: number | null = null; public maxId: Optional<number> = null;
public country: string | null = null; public country: Optional<string> = null;
public locality: string | null = null; public locality: Optional<string> = null;
public postalCode: string | null = null; public postalCode: Optional<string> = null;
public order: string = 'asc'; public order: string = 'asc';
constructor(data: { constructor(data: {
limit?: number; limit?: Optional<number>;
offset?: number; offset?: Optional<number>;
deviceId?: string; deviceId?: Optional<string>;
startDate?: Date; startDate?: Optional<Date>;
endDate?: Date; endDate?: Optional<Date>;
minId?: number; minId?: Optional<number>;
maxId?: number; maxId?: Optional<number>;
country?: string; country?: Optional<string>;
locality?: string; locality?: Optional<string>;
postalCode?: string; postalCode?: Optional<string>;
order?: string; order?: Optional<string>;
}) { }) {
this.limit = data.limit || this.limit; this.limit = data.limit || this.limit;
this.offset = data.offset || this.offset; this.offset = data.offset || this.offset;