mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-31 20:24:27 -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(
|
.get(
|
||||||
"/:id/movies",
|
"/:id/movies",
|
||||||
async ({
|
async ({
|
||||||
@ -218,32 +246,6 @@ export const collections = new Elysia({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
detail: { description: "Get all movies in a collection" },
|
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: {
|
response: {
|
||||||
200: Page(Movie),
|
200: Page(Movie),
|
||||||
404: {
|
404: {
|
||||||
@ -299,32 +301,6 @@ export const collections = new Elysia({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
detail: { description: "Get all series in a collection" },
|
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: {
|
response: {
|
||||||
200: Page(Serie),
|
200: Page(Serie),
|
||||||
404: {
|
404: {
|
||||||
@ -376,32 +352,6 @@ export const collections = new Elysia({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
detail: { description: "Get all series & movies in a collection" },
|
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: {
|
response: {
|
||||||
200: Page(Show),
|
200: Page(Show),
|
||||||
404: {
|
404: {
|
||||||
|
@ -21,6 +21,34 @@ export const studiosH = new Elysia({ tags: ["studios"] })
|
|||||||
studio: Studio,
|
studio: Studio,
|
||||||
"studio-translation": StudioTranslation,
|
"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(
|
.get(
|
||||||
"/studios/:id/shows",
|
"/studios/:id/shows",
|
||||||
async ({
|
async ({
|
||||||
@ -70,32 +98,6 @@ export const studiosH = new Elysia({ tags: ["studios"] })
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
detail: { description: "Get all series & movies made by a studio." },
|
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: {
|
response: {
|
||||||
200: Page(Show),
|
200: Page(Show),
|
||||||
404: {
|
404: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user