Move library album and track operations into shared server modules
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user