mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-24 02:02:36 -04:00
Use guards instead of adding type info multiples times
This commit is contained in:
parent
ff5fc69d41
commit
7492bff7c8
@ -173,6 +173,34 @@ export const collections = new Elysia({
|
||||
},
|
||||
},
|
||||
)
|
||||
.guard({
|
||||
params: t.Object({
|
||||
id: t.String({
|
||||
description: "The id or slug of the collection.",
|
||||
example: duneCollection.slug,
|
||||
}),
|
||||
}),
|
||||
query: t.Object({
|
||||
sort: showSort,
|
||||
filter: t.Optional(Filter({ def: showFilters })),
|
||||
query: t.Optional(t.String({ description: desc.query })),
|
||||
limit: t.Integer({
|
||||
minimum: 1,
|
||||
maximum: 250,
|
||||
default: 50,
|
||||
description: "Max page size.",
|
||||
}),
|
||||
after: t.Optional(t.String({ description: desc.after })),
|
||||
preferOriginal: t.Optional(
|
||||
t.Boolean({
|
||||
description: desc.preferOriginal,
|
||||
}),
|
||||
),
|
||||
}),
|
||||
headers: t.Object({
|
||||
"accept-language": AcceptLanguage({ autoFallback: true }),
|
||||
}),
|
||||
})
|
||||
.get(
|
||||
"/:id/movies",
|
||||
async ({
|
||||
@ -218,32 +246,6 @@ export const collections = new Elysia({
|
||||
},
|
||||
{
|
||||
detail: { description: "Get all movies in a collection" },
|
||||
params: t.Object({
|
||||
id: t.String({
|
||||
description: "The id or slug of the collection.",
|
||||
example: duneCollection.slug,
|
||||
}),
|
||||
}),
|
||||
query: t.Object({
|
||||
sort: showSort,
|
||||
filter: t.Optional(Filter({ def: showFilters })),
|
||||
query: t.Optional(t.String({ description: desc.query })),
|
||||
limit: t.Integer({
|
||||
minimum: 1,
|
||||
maximum: 250,
|
||||
default: 50,
|
||||
description: "Max page size.",
|
||||
}),
|
||||
after: t.Optional(t.String({ description: desc.after })),
|
||||
preferOriginal: t.Optional(
|
||||
t.Boolean({
|
||||
description: desc.preferOriginal,
|
||||
}),
|
||||
),
|
||||
}),
|
||||
headers: t.Object({
|
||||
"accept-language": AcceptLanguage({ autoFallback: true }),
|
||||
}),
|
||||
response: {
|
||||
200: Page(Movie),
|
||||
404: {
|
||||
@ -299,32 +301,6 @@ export const collections = new Elysia({
|
||||
},
|
||||
{
|
||||
detail: { description: "Get all series in a collection" },
|
||||
params: t.Object({
|
||||
id: t.String({
|
||||
description: "The id or slug of the collection.",
|
||||
example: duneCollection.slug,
|
||||
}),
|
||||
}),
|
||||
query: t.Object({
|
||||
sort: showSort,
|
||||
filter: t.Optional(Filter({ def: showFilters })),
|
||||
query: t.Optional(t.String({ description: desc.query })),
|
||||
limit: t.Integer({
|
||||
minimum: 1,
|
||||
maximum: 250,
|
||||
default: 50,
|
||||
description: "Max page size.",
|
||||
}),
|
||||
after: t.Optional(t.String({ description: desc.after })),
|
||||
preferOriginal: t.Optional(
|
||||
t.Boolean({
|
||||
description: desc.preferOriginal,
|
||||
}),
|
||||
),
|
||||
}),
|
||||
headers: t.Object({
|
||||
"accept-language": AcceptLanguage({ autoFallback: true }),
|
||||
}),
|
||||
response: {
|
||||
200: Page(Serie),
|
||||
404: {
|
||||
@ -376,32 +352,6 @@ export const collections = new Elysia({
|
||||
},
|
||||
{
|
||||
detail: { description: "Get all series & movies in a collection" },
|
||||
params: t.Object({
|
||||
id: t.String({
|
||||
description: "The id or slug of the collection.",
|
||||
example: duneCollection.slug,
|
||||
}),
|
||||
}),
|
||||
query: t.Object({
|
||||
sort: showSort,
|
||||
filter: t.Optional(Filter({ def: showFilters })),
|
||||
query: t.Optional(t.String({ description: desc.query })),
|
||||
limit: t.Integer({
|
||||
minimum: 1,
|
||||
maximum: 250,
|
||||
default: 50,
|
||||
description: "Max page size.",
|
||||
}),
|
||||
after: t.Optional(t.String({ description: desc.after })),
|
||||
preferOriginal: t.Optional(
|
||||
t.Boolean({
|
||||
description: desc.preferOriginal,
|
||||
}),
|
||||
),
|
||||
}),
|
||||
headers: t.Object({
|
||||
"accept-language": AcceptLanguage({ autoFallback: true }),
|
||||
}),
|
||||
response: {
|
||||
200: Page(Show),
|
||||
404: {
|
||||
|
@ -21,6 +21,34 @@ export const studiosH = new Elysia({ tags: ["studios"] })
|
||||
studio: Studio,
|
||||
"studio-translation": StudioTranslation,
|
||||
})
|
||||
.guard({
|
||||
params: t.Object({
|
||||
id: t.String({
|
||||
description: "The id or slug of the studio.",
|
||||
example: "mappa",
|
||||
}),
|
||||
}),
|
||||
query: t.Object({
|
||||
sort: showSort,
|
||||
filter: t.Optional(Filter({ def: showFilters })),
|
||||
query: t.Optional(t.String({ description: desc.query })),
|
||||
limit: t.Integer({
|
||||
minimum: 1,
|
||||
maximum: 250,
|
||||
default: 50,
|
||||
description: "Max page size.",
|
||||
}),
|
||||
after: t.Optional(t.String({ description: desc.after })),
|
||||
preferOriginal: t.Optional(
|
||||
t.Boolean({
|
||||
description: desc.preferOriginal,
|
||||
}),
|
||||
),
|
||||
}),
|
||||
headers: t.Object({
|
||||
"accept-language": AcceptLanguage({ autoFallback: true }),
|
||||
}),
|
||||
})
|
||||
.get(
|
||||
"/studios/:id/shows",
|
||||
async ({
|
||||
@ -70,32 +98,6 @@ export const studiosH = new Elysia({ tags: ["studios"] })
|
||||
},
|
||||
{
|
||||
detail: { description: "Get all series & movies made by a studio." },
|
||||
params: t.Object({
|
||||
id: t.String({
|
||||
description: "The id or slug of the studio.",
|
||||
example: "mappa",
|
||||
}),
|
||||
}),
|
||||
query: t.Object({
|
||||
sort: showSort,
|
||||
filter: t.Optional(Filter({ def: showFilters })),
|
||||
query: t.Optional(t.String({ description: desc.query })),
|
||||
limit: t.Integer({
|
||||
minimum: 1,
|
||||
maximum: 250,
|
||||
default: 50,
|
||||
description: "Max page size.",
|
||||
}),
|
||||
after: t.Optional(t.String({ description: desc.after })),
|
||||
preferOriginal: t.Optional(
|
||||
t.Boolean({
|
||||
description: desc.preferOriginal,
|
||||
}),
|
||||
),
|
||||
}),
|
||||
headers: t.Object({
|
||||
"accept-language": AcceptLanguage({ autoFallback: true }),
|
||||
}),
|
||||
response: {
|
||||
200: Page(Show),
|
||||
404: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user