feat: add more SSE events to rubgram
This commit is contained in:
+11
-1
@@ -51,6 +51,8 @@ export async function wipe() {
|
||||
revalidatePath("/rubgram/admin");
|
||||
revalidatePath("/rubgram");
|
||||
|
||||
ps.publish({ type: "wipe" }, { topic: "rubgram", event: "update" });
|
||||
|
||||
await actionLog(`Deleted rubgram submissions`);
|
||||
redirect("/rubgram/admin");
|
||||
}
|
||||
@@ -78,6 +80,8 @@ export async function toggleCheck(submissionId: string) {
|
||||
revalidatePath("/rubgram/admin");
|
||||
revalidatePath("/rubgram");
|
||||
|
||||
ps.publish({ type: "toggleCheck" }, { topic: "rubgram", event: "update" });
|
||||
|
||||
await actionLog(`Toggled an rubgram submission check mark`);
|
||||
}
|
||||
|
||||
@@ -94,6 +98,8 @@ export async function toggleLock() {
|
||||
revalidatePath("/rubgram/admin");
|
||||
revalidatePath("/rubgram");
|
||||
|
||||
ps.publish({ type: "toggleLock" }, { topic: "rubgram", event: "update" });
|
||||
|
||||
await actionLog(
|
||||
`${(existing.length ? existing[0].locked : true) ? "Locked" : "Unlocked"} rubgram submission`,
|
||||
);
|
||||
@@ -116,6 +122,8 @@ export async function setLimit(limit: number) {
|
||||
revalidatePath("/rubgram/admin");
|
||||
revalidatePath("/rubgram");
|
||||
|
||||
ps.publish({ type: "setLimit" }, { topic: "rubgram", event: "update" });
|
||||
|
||||
await actionLog(
|
||||
`Set rubgram submit limit to ${limit < 0 ? "unlimited" : limit}`,
|
||||
);
|
||||
@@ -138,6 +146,8 @@ export async function setFree(free: number) {
|
||||
revalidatePath("/rubgram/admin");
|
||||
revalidatePath("/rubgram");
|
||||
|
||||
ps.publish({ type: "setFree" }, { topic: "rubgram", event: "update" });
|
||||
|
||||
await actionLog(`Set rubgram submit limit to ${free}`);
|
||||
}
|
||||
|
||||
@@ -457,7 +467,7 @@ export async function debugUploadSlip(sid: string, image: File) {
|
||||
.where(eq(endgameSubmissions.id, sid));
|
||||
});
|
||||
|
||||
ps.publish({}, { topic: "rubgram", event: "update" });
|
||||
ps.publish({ type: "uploadSlip" }, { topic: "rubgram", event: "update" });
|
||||
|
||||
revalidatePath("/rubgram/admin");
|
||||
}
|
||||
|
||||
+1
-1
@@ -280,7 +280,7 @@ const redisSubscribers: Record<
|
||||
type RubgramEvent = { type: "submit" | "paid" | "cancel"; sub: string };
|
||||
if (event !== "update") return;
|
||||
const { type, sub } = data as RubgramEvent;
|
||||
if (type === "cancel") return;
|
||||
if (!(type === "submit" || type === "paid")) return;
|
||||
if (!process.env.WEBHOOK_RUBGRAM_SUBMIT) return;
|
||||
const body = rubgramWebhookTemplate(
|
||||
type,
|
||||
|
||||
+1
-1
@@ -210,9 +210,9 @@ export async function wipe() {
|
||||
await db.execute(
|
||||
sql`ALTER SEQUENCE artifact.submissions_queue_seq RESTART WITH 1`,
|
||||
);
|
||||
revalidatePath("/artifact/admin");
|
||||
revalidatePath("/artifact");
|
||||
|
||||
ps.publish({ type: "wipe" }, { topic: "artifact", event: "update" });
|
||||
await actionLog(`Deleted artifact submissions`);
|
||||
redirect("/artifact/admin");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user