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:
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user