Initial commit: page-manager Next.js app with Coolify deploy support

Replace Vercel-specific infra (Cron, Blob) with self-hosted equivalents
for deployment to Coolify: in-container cron scheduler
(scripts/cron-runner.mjs) and disk-based upload storage served via
/api/uploads/[...path]. Add Dockerfile, .dockerignore, and /api/health
for container health checks.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
chaloemphong
2026-11-22 11:52:17 +07:00
commit 9d32552457
155 changed files with 22174 additions and 0 deletions
+56
View File
@@ -0,0 +1,56 @@
import type { Prisma } from "@prisma/client";
import { prisma } from "@/lib/db";
export const SYSTEM_ACTOR = "ระบบ";
export type AuditAction =
| "META_LOGIN_CONNECTED"
| "META_LOGIN_REMOVED"
| "PAGE_CONNECTED"
| "PAGE_DISCONNECTED"
| "PAGE_WEBHOOK_SUBSCRIBED"
| "PAGE_TOKEN_INVALID"
| "PAGE_MEMBER_SET"
| "PAGE_MEMBER_REMOVED"
| "PAGE_ANALYSIS_REQUESTED"
| "PAGE_PROFILE_SAVED"
| "POST_CREATED"
| "POST_EDITED"
| "POST_PLANNED"
| "POST_SUBMITTED"
| "POST_APPROVED"
| "POST_REJECTED"
| "POST_SCHEDULED"
| "POST_PUBLISHED"
| "POST_FAILED"
| "POST_CANCELLED"
| "POST_DELETED"
| "RULE_SAVED"
| "RULE_DELETED"
| "USER_CREATED"
| "USER_UPDATED"
| "USER_IDENTITY_LINKED";
/** Append-only — AuditLog rows are never updated or deleted. */
export async function audit(
entry: {
action: AuditAction;
actorId?: string | null;
actorLabel: string;
pageId?: string | null;
postId?: string | null;
detail?: Prisma.InputJsonValue;
},
tx: Prisma.TransactionClient = prisma
) {
await tx.auditLog.create({
data: {
action: entry.action,
actorId: entry.actorId ?? null,
actorLabel: entry.actorLabel,
pageId: entry.pageId ?? null,
postId: entry.postId ?? null,
detail: entry.detail,
},
});
}