-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.ts
35 lines (32 loc) · 1.16 KB
/
test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { patchMissions } from "@/utils/pg/patchMissions";
import { getNotion } from "@/utils/notion/index";
import {pointsQueue} from "@/workers/points.worker";
import { getTweet } from "@/utils/twitter/index";
import { type NextApiRequest, type NextApiResponse } from "next";
interface Response extends NextApiResponse {
status(code: number): Response;
send(
data:
| { score: string; address: string; last_score_timestamp: string }
| { error: string },
): void;
}
export default async function handler(_req: NextApiRequest, res: Response) {
try {
// const data = await getNotion();
// const newData = await patchMissions(data!);
const data = await getTweet(
"https://x.com/ceramicnetwork/status/1793330992347771257",
);
const data2 = {
// any serializable data you want to provide for the job
// for this example, we'll provide a message
message: "This is a sample job",
};
await pointsQueue.add("pointsQueue", data2);
return res.status(200).json({ status: "Message added to the queue" });
} catch (error) {
console.error(error);
res.status(500).send({ error: "Internal Server Error" });
}
}