refactor: ♻️emoves Env parameter
Removes the `Env` parameter from several functions to simplify their signatures and rely on the global `env` for configuration. This change reduces the number of arguments passed around, making the code cleaner and easier to maintain.
This commit is contained in:
@@ -2,7 +2,6 @@ import { OpenAPIHono, createRoute, z } from "@hono/zod-openapi";
|
||||
import { env } from "hono/adapter";
|
||||
|
||||
import { updateWatchStatus } from "~/controllers/watch-status";
|
||||
import type { Env } from "~/types/env";
|
||||
import {
|
||||
AniListIdQuerySchema,
|
||||
EpisodeNumberSchema,
|
||||
@@ -63,7 +62,7 @@ const route = createRoute({
|
||||
},
|
||||
});
|
||||
|
||||
const app = new OpenAPIHono<Env>();
|
||||
const app = new OpenAPIHono<Cloudflare.Env>();
|
||||
|
||||
app.openapi(route, async (c) => {
|
||||
const aniListToken = c.req.header("X-AniList-Token");
|
||||
@@ -85,13 +84,7 @@ app.openapi(route, async (c) => {
|
||||
isComplete,
|
||||
);
|
||||
if (isComplete) {
|
||||
await updateWatchStatus(
|
||||
env(c, "workerd"),
|
||||
c.req,
|
||||
deviceId,
|
||||
aniListId,
|
||||
"COMPLETED",
|
||||
);
|
||||
await updateWatchStatus(c.req, deviceId, aniListId, "COMPLETED");
|
||||
}
|
||||
|
||||
if (!user) {
|
||||
|
||||
Reference in New Issue
Block a user