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:
@@ -1,10 +1,8 @@
|
||||
import { Hono } from "hono";
|
||||
import { env } from "hono/adapter";
|
||||
import { DateTime } from "luxon";
|
||||
|
||||
import { getAdminSdkCredentials } from "~/libs/gcloud/getAdminSdkCredentials";
|
||||
import { sendFcmMessage } from "~/libs/gcloud/sendFcmMessage";
|
||||
import type { Env } from "~/types/env";
|
||||
import { SuccessResponse } from "~/types/schema";
|
||||
|
||||
import { getUpcomingTitlesFromAnilist } from "./anilist";
|
||||
@@ -12,10 +10,7 @@ import { getUpcomingTitlesFromAnilist } from "./anilist";
|
||||
const app = new Hono();
|
||||
|
||||
app.post("/", async (c) => {
|
||||
const titles = await getUpcomingTitlesFromAnilist(
|
||||
env<Env, typeof c>(c, "workerd"),
|
||||
c.req,
|
||||
);
|
||||
const titles = await getUpcomingTitlesFromAnilist(c.req);
|
||||
|
||||
await Promise.allSettled(
|
||||
titles.map(async (title) => {
|
||||
@@ -24,7 +19,7 @@ app.post("/", async (c) => {
|
||||
title.media.title?.english ??
|
||||
"Unknown Title";
|
||||
|
||||
return sendFcmMessage(getAdminSdkCredentials(c.env), {
|
||||
return sendFcmMessage(getAdminSdkCredentials(), {
|
||||
topic: "newTitles",
|
||||
data: {
|
||||
type: "new_title",
|
||||
|
||||
Reference in New Issue
Block a user