mirror of
https://github.com/zoriya/Kyoo.git
synced 2026-05-22 23:22:27 -04:00
Update elysia & fix type issues
This commit is contained in:
@@ -111,10 +111,10 @@ export const historyH = new Elysia({ tags: ["profiles"] })
|
||||
query: { sort, filter, query, limit, after },
|
||||
headers: { "accept-language": languages, authorization },
|
||||
request: { url },
|
||||
error,
|
||||
status,
|
||||
}) => {
|
||||
const uInfo = await getUserInfo(id, { authorization });
|
||||
if ("status" in uInfo) return error(uInfo.status as 404, uInfo);
|
||||
if ("status" in uInfo) return status(uInfo.status as 404, uInfo);
|
||||
|
||||
const langs = processLanguages(languages);
|
||||
const items = (await getEntries({
|
||||
@@ -163,7 +163,7 @@ export const historyH = new Elysia({ tags: ["profiles"] })
|
||||
)
|
||||
.post(
|
||||
"/profiles/me/history",
|
||||
async ({ body, jwt: { sub }, error }) => {
|
||||
async ({ body, jwt: { sub }, status }) => {
|
||||
const profilePk = await getOrCreateProfile(sub);
|
||||
|
||||
const hist = values(
|
||||
@@ -321,7 +321,7 @@ export const historyH = new Elysia({ tags: ["profiles"] })
|
||||
},
|
||||
});
|
||||
|
||||
return error(201, { status: 201, inserted: rows.length });
|
||||
return status(201, { status: 201, inserted: rows.length });
|
||||
},
|
||||
{
|
||||
detail: { description: "Bulk add entries/movies to your watch history." },
|
||||
|
||||
@@ -197,10 +197,10 @@ export const watchlistH = new Elysia({ tags: ["profiles"] })
|
||||
jwt: { settings },
|
||||
headers: { "accept-language": languages, authorization },
|
||||
request: { url },
|
||||
error,
|
||||
status,
|
||||
}) => {
|
||||
const uInfo = await getUserInfo(id, { authorization });
|
||||
if ("status" in uInfo) return error(uInfo.status as 404, uInfo);
|
||||
if ("status" in uInfo) return status(uInfo.status as 404, uInfo);
|
||||
|
||||
const langs = processLanguages(languages);
|
||||
const items = await getShows({
|
||||
@@ -261,7 +261,7 @@ export const watchlistH = new Elysia({ tags: ["profiles"] })
|
||||
)
|
||||
.post(
|
||||
"/series/:id/watchstatus",
|
||||
async ({ params: { id }, body, jwt: { sub }, error }) => {
|
||||
async ({ params: { id }, body, jwt: { sub }, status }) => {
|
||||
const [show] = await db
|
||||
.select({ pk: shows.pk, entriesCount: shows.entriesCount })
|
||||
.from(shows)
|
||||
@@ -273,7 +273,7 @@ export const watchlistH = new Elysia({ tags: ["profiles"] })
|
||||
);
|
||||
|
||||
if (!show) {
|
||||
return error(404, {
|
||||
return status(404, {
|
||||
status: 404,
|
||||
message: `No serie found for the id/slug: '${id}'.`,
|
||||
});
|
||||
@@ -302,7 +302,7 @@ export const watchlistH = new Elysia({ tags: ["profiles"] })
|
||||
)
|
||||
.post(
|
||||
"/movies/:id/watchstatus",
|
||||
async ({ params: { id }, body, jwt: { sub }, error }) => {
|
||||
async ({ params: { id }, body, jwt: { sub }, status }) => {
|
||||
const [show] = await db
|
||||
.select({ pk: shows.pk })
|
||||
.from(shows)
|
||||
@@ -314,7 +314,7 @@ export const watchlistH = new Elysia({ tags: ["profiles"] })
|
||||
);
|
||||
|
||||
if (!show) {
|
||||
return error(404, {
|
||||
return status(404, {
|
||||
status: 404,
|
||||
message: `No movie found for the id/slug: '${id}'.`,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user