adds waypoint images

This commit is contained in:
Christian Beutel
2024-03-20 20:46:29 +01:00
parent 3e8fb85c05
commit e5b5e50747
26 changed files with 1064 additions and 221 deletions

View File

@@ -1,5 +1,5 @@
import type { Marker } from "leaflet";
import { date, number, object, string } from "yup";
import { number, object, string } from "yup";
class Waypoint {
id?: string;
@@ -9,8 +9,13 @@ class Waypoint {
lon: number;
icon?: string;
marker?: Marker;
photos: string[];
_photos: File[];
author?: string;
constructor(lat: number, lon: number, params?: {id?: string, name?: string, description?: string, icon?: string, marker?: Marker}) {
constructor(lat: number, lon: number, params?: {
id?: string, name?: string, description?: string, icon?: string, marker?: Marker, photos?: string[];
}) {
this.id = params?.id;
this.name = params?.name ?? "";
this.description = params?.description ?? "";
@@ -18,6 +23,8 @@ class Waypoint {
this.lon = lon;
this.icon = params?.icon ?? "circle";
this.marker = params?.marker;
this.photos = params?.photos ?? []
this._photos = [];
}
}
@@ -28,6 +35,6 @@ const waypointSchema = object<Waypoint>({
lat: number().required('Required').typeError('Invalid latitude'),
lon: number().required('Required').typeError('Invalid longitude'),
icon: string().optional()
});
});
export { Waypoint, waypointSchema }
export { Waypoint, waypointSchema };