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
+52
View File
@@ -0,0 +1,52 @@
import { prisma } from "@/lib/db";
import { getConsoleContext } from "@/lib/console";
import { roleAtLeast } from "@/lib/auth/roles";
import { EmptyState, PageTitle } from "@/components/ui";
import { PagePicker } from "@/components/PagePicker";
import { RulesManager } from "@/components/RulesManager";
export default async function AutoReplyPage() {
const ctx = await getConsoleContext();
const page = ctx.selected;
if (!page) {
return (
<>
<PageTitle title="Auto-reply" subtitle="ตั้งกฎตอบกลับอัตโนมัติทีละเพจ" />
<section className="card">
<EmptyState icon="bolt" title="เลือกเพจที่จะตั้งกฎ" />
<PagePicker pages={ctx.pages.map(({ id, name, pictureUrl }) => ({ id, name, pictureUrl }))} />
</section>
</>
);
}
const rules = await prisma.replyRule.findMany({
where: { pageId: page.id },
orderBy: [{ kind: "asc" }, { priority: "desc" }, { createdAt: "asc" }],
include: { _count: { select: { logs: true } } },
});
return (
<>
<PageTitle title="Auto-reply" subtitle={`กฎของ ${page.name} — keyword ตรงกฎไหน ระบบตอบตามกฎนั้น (คนเดิมได้กฎเดิมครั้งเดียว)`} />
<RulesManager
key={page.id}
pageId={page.id}
canEdit={roleAtLeast(page.role, "APPROVER")}
rules={rules.map((r) => ({
id: r.id,
name: r.name,
kind: r.kind,
keywords: r.keywords,
reply: r.reply,
imageUrl: r.imageUrl,
publicAck: r.publicAck,
isActive: r.isActive,
priority: r.priority,
sent: r._count.logs,
}))}
/>
</>
);
}