refactor!: migrate from REST API to GraphQL

- Replace OpenAPI/REST endpoints with a single  route.
- Remove  and Swagger UI configuration.
- Disable OpenAPI schema extensions in Zod types.
- Refactor  to be request-agnostic.
- Update episode URL fetching to return standardized success/failure objects.
- Update project dependencies.
This commit is contained in:
2025-12-01 02:55:20 -05:00
parent ad26cd6da3
commit 495506935e
28 changed files with 1480 additions and 101 deletions

View File

@@ -8,22 +8,22 @@ export async function getSourcesFromAniwatch(
console.log(`Fetching sources from aniwatch for ${watchId}`);
const url = await getEpisodeUrl(watchId);
if (url) {
return url;
return { success: true, result: url };
}
const servers = await getEpisodeServers(watchId);
if (servers.length === 0) {
return null;
return { success: false };
}
for (const server of servers) {
const url = await getEpisodeUrl(watchId, server.serverName);
if (url) {
return url;
return { success: true, result: url };
}
}
return null;
return { success: false };
}
async function getEpisodeUrl(watchId: string, server?: string) {

View File

@@ -84,7 +84,7 @@ app.openapi(route, async (c) => {
isComplete,
);
if (isComplete) {
await updateWatchStatus(c.req, deviceId, aniListId, "COMPLETED");
await updateWatchStatus(deviceId, aniListId, "COMPLETED");
}
if (!user) {