adds list

This commit is contained in:
Christian Beutel
2024-02-27 16:36:06 +01:00
parent 9b7a4adadf
commit 965e4196ae
16 changed files with 475 additions and 115 deletions

View File

@@ -0,0 +1,34 @@
import { object, string } from "yup";
import type { Trail } from "./trail";
export class List {
id?: string;
name: string;
description?: string;
avatar?: string;
expand?: {
trails: Trail[]
}
author?: string;
constructor(name: string, trails: Trail[], params?: { description?: string, avatar?: string, author?: string }) {
this.name = name;
this.expand = { trails: trails };
this.description = params?.description;
this.avatar = params?.description;
this.author = params?.author;
}
}
export interface ListFilter {
q: string,
sort: "name" | "size" | "created";
sortOrder: "+" | "-"
}
export const listSchema = object<List>({
id: string().optional(),
name: string().required(),
description: string().optional(),
avatar: string().optional()
});

View File

@@ -75,7 +75,7 @@ class Trail {
}
}
const trailSchema = object<SummitLog>({
const trailSchema = object<Trail>({
id: string().optional(),
name: string().required("Required"),
location: string().optional(),