mirror of
https://github.com/theodore-song/polymarket-analyst.git
synced 2026-08-09 22:20:55 +00:00
Add provider webhook event store
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import { hasDatabase, providerEventSummary } from "./_db.js";
|
||||
|
||||
export default async function handler(req, res) {
|
||||
res.setHeader("Cache-Control", "no-store");
|
||||
|
||||
if (req.method !== "GET") {
|
||||
res.setHeader("Allow", "GET");
|
||||
return res.status(405).json({ ok: false, error: "Method not allowed" });
|
||||
}
|
||||
|
||||
if (!hasDatabase()) {
|
||||
return res.status(503).json({ ok: false, error: "Database is not configured" });
|
||||
}
|
||||
|
||||
try {
|
||||
const providers = await providerEventSummary();
|
||||
return res.status(200).json({ ok: true, providers });
|
||||
} catch (err) {
|
||||
return res.status(500).json({ ok: false, error: err?.message || "Provider event summary failed" });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user