adds search api

This commit is contained in:
Christian Beutel
2024-03-10 00:52:45 +01:00
parent 963b589b2d
commit 01e1053569
25 changed files with 271 additions and 87 deletions

View File

@@ -0,0 +1,3 @@
export function range(to: number, from: number = 0): ReadonlyArray<number> {
return [...Array(to - from).keys()].map(i => i + from);
}

View File

@@ -1,9 +1,11 @@
import { pb } from "$lib/pocketbase";
import type { FileOptions } from "pocketbase";
export function getFileURL(record: { [key: string]: any; }, filename?: string, options?: FileOptions) {
if(!filename) {
export function getFileURL(record: { [key: string]: any; }, filename?: string) {
if (!filename) {
return "";
}
return pb.files.getUrl(record, filename, options);
// return pb.files.getUrl(record, filename);
return `/api/v1/files/${record.collectionId}/${record.id}/${filename}`
}