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:
22
src/graphql/context.ts
Normal file
22
src/graphql/context.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import type { Context as HonoContext } from "hono";
|
||||
|
||||
export interface GraphQLContext {
|
||||
db: D1Database;
|
||||
env: Env;
|
||||
deviceId?: string;
|
||||
aniListToken?: string;
|
||||
honoContext: HonoContext;
|
||||
}
|
||||
|
||||
export function createGraphQLContext(c: HonoContext): GraphQLContext {
|
||||
const deviceId = c.req.header("X-Device-ID");
|
||||
const aniListToken = c.req.header("X-AniList-Token");
|
||||
|
||||
return {
|
||||
db: c.env.DB,
|
||||
env: c.env,
|
||||
deviceId,
|
||||
aniListToken,
|
||||
honoContext: c,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user