Add entries dummy controller & fix entries types

This commit is contained in:
Zoe Roux
2024-11-09 16:03:01 +01:00
parent 7071e07ef4
commit 29d11720a5
3 changed files with 49 additions and 12 deletions
+32
View File
@@ -0,0 +1,32 @@
import { Elysia, t } from "elysia";
import {
type Entry,
Episode,
Extra,
MovieEntry,
Special,
UnknownEntry,
} from "../models/entry";
export const entries = new Elysia()
.model({
episode: Episode,
movie_entry: MovieEntry,
special: Special,
extra: Extra,
unknown_entry: UnknownEntry,
error: t.Object({}),
})
.model((models) => ({
...models,
entry: t.Union([models.episode, models.movie_entry, models.special]),
}))
.get("/entries/:id", () => "hello" as unknown as Entry, {
response: { 200: "entry" },
})
.get("/extras/:id", () => "hello" as unknown as Extra, {
response: { 200: "extra" },
})
.get("/unknowns/:id", () => "hello" as unknown as UnknownEntry, {
response: { 200: "unknown_entry" },
});