finishes trail create
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { array, number, object, string } from "yup";
|
||||
import type { Category } from "./category";
|
||||
import type { SummitLog } from "./summit_log";
|
||||
import type { Waypoint } from "./waypoint";
|
||||
@@ -20,38 +21,57 @@ class Trail {
|
||||
tags?: string[];
|
||||
description?: string;
|
||||
|
||||
_photoFiles: File[]
|
||||
|
||||
constructor(name: string,
|
||||
id?: string,
|
||||
location?: string,
|
||||
distance?: number,
|
||||
elevation_gain?: number,
|
||||
duration?: number,
|
||||
thumbnail?: string,
|
||||
photos?: string[],
|
||||
gpx?: string,
|
||||
category?: Category,
|
||||
waypoints?: Waypoint[],
|
||||
summit_logs?: SummitLog[],
|
||||
tags?: string[],
|
||||
description?: string
|
||||
) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.location = location;
|
||||
this.distance = distance;
|
||||
this.elevation_gain = elevation_gain;
|
||||
this.duration = duration;
|
||||
this.thumbnail = thumbnail;
|
||||
this.photos = photos ?? [];
|
||||
this.gpx = gpx;
|
||||
this.expand = {
|
||||
category: category,
|
||||
waypoints: waypoints ?? [],
|
||||
summit_logs: summit_logs ?? []
|
||||
params?: {
|
||||
id?: string,
|
||||
location?: string,
|
||||
distance?: number,
|
||||
elevation_gain?: number,
|
||||
duration?: number,
|
||||
thumbnail?: string,
|
||||
photos?: string[],
|
||||
gpx?: string,
|
||||
category?: Category,
|
||||
waypoints?: Waypoint[],
|
||||
summit_logs?: SummitLog[],
|
||||
tags?: string[],
|
||||
description?: string
|
||||
}
|
||||
this.tags = tags ?? []
|
||||
this.description = description ?? "";
|
||||
|
||||
) {
|
||||
this.id = params?.id;
|
||||
this.name = name;
|
||||
this.location = params?.location;
|
||||
this.distance = params?.distance;
|
||||
this.elevation_gain = params?.elevation_gain;
|
||||
this.duration = params?.duration;
|
||||
this.thumbnail = params?.thumbnail;
|
||||
this.photos = params?.photos ?? [];
|
||||
this.gpx = params?.gpx;
|
||||
this.expand = {
|
||||
category: params?.category,
|
||||
waypoints: params?.waypoints ?? [],
|
||||
summit_logs: params?.summit_logs ?? []
|
||||
}
|
||||
this.tags = params?.tags ?? []
|
||||
this.description = params?.description ?? "";
|
||||
this._photoFiles = [];
|
||||
}
|
||||
}
|
||||
|
||||
export { Trail };
|
||||
const trailSchema = object<SummitLog>({
|
||||
id: string().optional(),
|
||||
name: string().required("Required"),
|
||||
location: string().optional(),
|
||||
distance: number().optional(),
|
||||
elevation_gain: number().optional(),
|
||||
duration: number().optional(),
|
||||
thumbnail: string().optional(),
|
||||
photos: array(string()).optional(),
|
||||
gpx: string().optional(),
|
||||
description: string().optional()
|
||||
});
|
||||
|
||||
export { Trail, trailSchema };
|
||||
|
||||
Reference in New Issue
Block a user