Files
wanderer/web/src/lib/models/list.ts
2025-01-03 00:13:59 +01:00

38 lines
1.0 KiB
TypeScript

import type { Trail } from "./trail";
import type { ListShare } from "./list_share";
import type { UserAnonymous } from "./user";
export class List {
id?: string;
name: string;
public: boolean;
description?: string;
avatar?: string;
trails?: string[];
expand?: {
trails?: Trail[]
list_share_via_list?: ListShare[]
author?: UserAnonymous;
}
author: string;
constructor(name: string, trails: Trail[], params?: { description?: string, public?: boolean, avatar?: string, author?: string }) {
this.name = name;
this.public = params?.public ?? false
this.expand = { trails: trails };
this.trails = trails.map(t => t.id!);
this.description = params?.description;
this.avatar = params?.avatar;
this.author = params?.author ?? "000000000000000";
}
}
export interface ListFilter {
q: string,
sort?: "name" | "size" | "created";
author?: string;
public?: boolean;
shared?: boolean;
sortOrder?: "+" | "-"
}