mirror of
https://github.com/zoriya/Kyoo.git
synced 2026-06-05 22:05:18 -04:00
Add entries dummy controller & fix entries types
This commit is contained in:
@@ -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" },
|
||||
});
|
||||
Reference in New Issue
Block a user