adds comments

This commit is contained in:
Christian Beutel
2024-04-03 22:28:34 +02:00
parent 8af1efaf20
commit 76522c808a
23 changed files with 714 additions and 46 deletions

View File

@@ -0,0 +1,19 @@
import type { User } from "$lib/stores/user_store";
export class Comment {
id?: string;
text: string;
rating: number;
author: string;
trail: string;
expand?: {
author: User
}
constructor(text: string, rating: number, author: string, trail: string) {
this.text = text;
this.rating = rating;
this.author = author;
this.trail = trail;
}
}

View File

@@ -1,4 +1,5 @@
import type { Category } from "./category";
import type { Comment } from "./comment";
import type { SummitLog } from "./summit_log";
import type { Waypoint } from "./waypoint";
@@ -24,6 +25,7 @@ class Trail {
category?: Category;
waypoints: Waypoint[]
summit_logs: SummitLog[]
comments_via_trail: Comment[]
gpx_data?: string
}
tags?: string[];
@@ -47,6 +49,7 @@ class Trail {
category?: Category,
waypoints?: Waypoint[],
summit_logs?: SummitLog[],
comments?: Comment[],
tags?: string[],
description?: string
created?: string
@@ -71,7 +74,8 @@ class Trail {
this.expand = {
category: params?.category,
waypoints: params?.waypoints ?? [],
summit_logs: params?.summit_logs ?? []
summit_logs: params?.summit_logs ?? [],
comments_via_trail: params?.comments ?? []
}
this.tags = params?.tags ?? []
this.description = params?.description ?? "";