feat: initial refactor to use marka as backend

This commit is contained in:
Max Richter
2025-10-28 20:15:23 +01:00
parent 0beb3b1071
commit f680b5f832
39 changed files with 245 additions and 1012 deletions

View File

@@ -5,11 +5,12 @@ import { fileExtension } from "https://deno.land/x/file_extension@v2.1.0/mod.ts"
import { isString, safeFileName } from "@lib/string.ts";
import { createDocument } from "@lib/documents.ts";
import { AccessDeniedError } from "@lib/errors.ts";
import { createSeries, getSeries, Series } from "@lib/resource/series.ts";
import { Series } from "@lib/resource/series.ts";
import { fetchResource } from "@lib/resources.ts";
export const handler: Handlers = {
async GET(_, ctx) {
const series = await getSeries(ctx.params.name);
const series = await fetchResource(`series/${ctx.params.name}`);
return json(series);
},
async POST(_, ctx) {

View File

@@ -9,7 +9,6 @@ import {
BadRequestError,
NotFoundError,
} from "@lib/errors.ts";
import { createSeries, getSeries } from "@lib/resource/series.ts";
const isString = (input: string | undefined): input is string => {
return typeof input === "string";
@@ -64,15 +63,15 @@ const POST = async (
let finalPath = "";
if (posterPath && !series.meta?.image) {
const poster = await tmdb.getMoviePoster(posterPath);
// const poster = await tmdb.getMoviePoster(posterPath);
const extension = fileExtension(posterPath);
finalPath = `Media/series/images/${safeFileName(name)}_cover.${extension}`;
await createDocument(finalPath, poster);
// await createDocument(finalPath, poster);
series.meta = series.meta || {};
series.meta.image = finalPath;
}
await createSeries(series.id, series);
// await createSeries(series.id, series);
return json(series);
};