Update elysia & fix type issues

This commit is contained in:
Zoe Roux
2025-05-05 20:07:20 +02:00
parent 7ff794742d
commit ab5d2ad4e8
32 changed files with 211 additions and 160 deletions
+4 -4
View File
@@ -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." },
+6 -6
View File
@@ -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}'.`,
});