Initial commit

This commit is contained in:
hiperman
2025-12-04 00:33:37 -05:00
commit 7ca0a21283
798 changed files with 190424 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
import { form, getRequestEvent, query } from '$app/server';
import { libraryCreateSchema, libraryQuerySchema } from '$lib/schema/library';
import { createQueryParams } from '$lib/utils';
import { error } from '@sveltejs/kit';
export const listLibraries = query(libraryQuerySchema, async (data) => {
const { locals } = getRequestEvent();
const params = createQueryParams(data);
const response = await locals.api.get(`/libraries?${params.toString()}`);
if (!response.ok) error(500, 'An unkown error occurred');
return await response.json();
});
export const createLibrary = form(libraryCreateSchema, async (data) => {
const { locals } = getRequestEvent();
const response = await locals.api.post(`/libraries`, data);
if (!response.ok) error(500, 'An unknown error occurred');
return await response.json();
});
export const deleteLibrary = query('unchecked', async (data) => {
throw new Error('Not implemented');
});