feat(hk): explain background updates with protected content links and retry details
CI / check (push) Failing after 1m34s
CI / deploy (push) Skipped
CI / publish-container (push) Skipped

This commit is contained in:
Simo committed 2026-09-13 19:41:25 +02:00
1 parent dd7613850e
commit c5c9941768
42 files changed
+1542 -145

No files matched your search

+10 -3
View File
@@ -1,7 +1,7 @@
"use server";
import { createHash, randomUUID } from "node:crypto";
import { and, eq, ne } from "drizzle-orm";
import { and, eq, ne, sql } from "drizzle-orm";
import { revalidatePath } from "next/cache";
import { redirect } from "next/navigation";
import { getTranslations } from "next-intl/server";
@@ -128,6 +128,13 @@ export async function createArticle(
updatedAt: now,
publishedAt: fields.status === "published" ? now : null,
});
const [createdRows] = await tx.execute(
sql`SELECT CAST(LAST_INSERT_ID() AS CHAR) AS id`,
);
const articleId = (createdRows as unknown as Array<{ id: string }>)[0]
?.id;
if (!articleId || !/^[1-9][0-9]*$/.test(articleId))
throw new Error("Article identity unavailable");
await enqueueEffect(tx, operationId, "news.refresh");
if (input.status === "published")
notification = {
@@ -136,7 +143,7 @@ export async function createArticle(
target: input.title,
details: slug,
};
return { ok: true };
return { ok: true, articleId, articleTitle: input.title };
},
);
} catch (error) {
@@ -219,7 +226,7 @@ export async function updateArticle(
.where(eq(WebsiteArticles.id, id));
await recordHistory(tx, "news", historyId, staff.id, historyBefore);
await enqueueEffect(tx, operationId, "news.refresh");
return { ok: true };
return { ok: true, articleId: String(id), articleTitle: input.title };
},
);
} catch (error) {