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
+44
View File
@@ -0,0 +1,44 @@
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 { ProfileForm } from "@/components/ProfileForm";
const TITLE = "โปรไฟล์ร้าน";
export default async function ProfilePage() {
const ctx = await getConsoleContext();
const page = ctx.selected;
if (!page) {
return (
<>
<PageTitle title={TITLE} subtitle="ข้อมูลร้านที่ AI ใช้ตอนเขียน caption และวิเคราะห์เพจ" />
<section className="card">
<EmptyState icon="store" title="เลือกเพจที่จะตั้งโปรไฟล์" />
<PagePicker pages={ctx.pages.map(({ id, name, pictureUrl }) => ({ id, name, pictureUrl }))} />
</section>
</>
);
}
const profile = await prisma.pageProfile.findUnique({
where: { pageId: page.id },
select: { business: true, audience: true, tone: true, avoid: true, cta: true, updatedAt: true },
});
return (
<>
<PageTitle title={TITLE} subtitle={`${page.name} — กรอกครั้งเดียว AI จะเขียนด้วยข้อมูลและน้ำเสียงของร้านนี้`} />
<ProfileForm
key={page.id}
pageId={page.id}
canEdit={roleAtLeast(page.role, "APPROVER")}
canDraft={page.status === "ACTIVE"}
initial={profile ? { business: profile.business, audience: profile.audience, tone: profile.tone, avoid: profile.avoid, cta: profile.cta } : null}
updatedAt={profile?.updatedAt.toISOString() ?? null}
/>
</>
);
}