refactor: replace qstash with Google Cloud Tasks

This commit is contained in:
2024-10-05 14:06:57 -04:00
parent 85712ff0cf
commit 44ffa703b9
21 changed files with 354 additions and 207 deletions

View File

@@ -4,19 +4,14 @@ import { DateTime } from "luxon";
import { getAdminSdkCredentials } from "~/libs/gcloud/getAdminSdkCredentials";
import { sendFcmMessage } from "~/libs/gcloud/sendFcmMessage";
import { verifyQstashHeader } from "~/libs/qstash/verifyQstashHeader";
import type { Env } from "~/types/env";
import { ErrorResponse, SuccessResponse } from "~/types/schema";
import { SuccessResponse } from "~/types/schema";
import { getUpcomingTitlesFromAnilist } from "./anilist";
const app = new Hono();
app.post("/", async (c) => {
if (!(await verifyQstashHeader(env<Env, typeof c>(c, "workerd"), c.req))) {
return c.json(ErrorResponse, { status: 401 });
}
const titles = await getUpcomingTitlesFromAnilist(
env<Env, typeof c>(c, "workerd"),
c.req,