Move library album and track operations into shared server modules

This commit is contained in:
2026-09-25 01:15:04 +02:00
parent 797bed8e7d
commit 7cac6ff446
14 changed files with 229 additions and 139 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
import { formString } from '$lib/server/forms/fields';
import { ALBUM_EARLIEST_YEAR, LIMITS } from '$lib/validation';
interface AlbumFormBody {
export interface AlbumFormBody {
title: string;
description: string | null;
releaseYear: number | null;
@@ -6,3 +6,10 @@ export function formFile(form: FormData, key: string): File | null {
const value = form.get(key);
return value instanceof File && value.size > 0 ? value : null;
}
export function formIds(form: FormData, key: string): string[] {
return form
.getAll(key)
.flatMap((value) => String(value).split(','))
.filter(Boolean);
}