adds waypoint images
This commit is contained in:
@@ -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 };
|
||||
|
||||
Reference in New Issue
Block a user