add author page!

This commit is contained in:
dylan
2024-04-02 19:04:34 -07:00
parent 2b614dcb79
commit 11783ba2fb
6 changed files with 177 additions and 52 deletions
+34
View File
@@ -0,0 +1,34 @@
import { Type } from "@sinclair/typebox";
import { FirRouteInput, FirRouteOptions } from "../util/routewrap.ts";
import { getAuthorGames, getReleases } from "../dbal/dbal.ts";
const method = "GET";
const url = "/api/author";
const payloadT = Type.Any();
const handler = async ({payload}: FirRouteInput<typeof payloadT>) => {
const {author} = payload;
if (typeof author !== "string") {
return {
author: null,
releases: [],
};
}
console.log("author", author);
const games = await getAuthorGames({author});
return {
author,
games,
}
};
export default {
method,
url,
payloadT,
handler,
} as const satisfies FirRouteOptions<typeof payloadT>;