gameflow-deck/src/bun/api/games/collections.ts

16 lines
No EOL
622 B
TypeScript

import Elysia, { status } from "elysia";
import { plugins } from "../app";
import { FrontEndCollection } from "@/shared/types";
export default new Elysia()
.get('/collections', async () =>
{
const collections: FrontEndCollection[] = [];
await plugins.hooks.games.fetchCollections.promise({ collections });
return collections;
}).get('/collection/:source/:id', async ({ params: { source, id } }) =>
{
const collection = await plugins.hooks.games.fetchCollection.promise({ source, id });
if (!collection) return status("Not Found");
return collection;
});