feat(guide): proper order sorting & hidden

This commit is contained in:
2026-03-19 01:28:55 +07:00 Unverified
parent db21e3cea4
commit 3c04403076
6 changed files with 53 additions and 18 deletions
@@ -23,6 +23,7 @@ import { guides } from "@/lib/db/schema";
export default async function GuideEditPage({
params,
}: PageProps<"/admin/guide/[id]">) {
if (!(await adminCheck())) redirect("/login");
const { id } = await params;
const [guide] = await db.select().from(guides).where(eq(guides.id, id));
if (!guide) notFound();
@@ -21,6 +21,7 @@ import { db } from "@/lib/db";
import { guides } from "@/lib/db/schema";
export default async function GuideCreatePage() {
if (!(await adminCheck())) redirect("/login");
const [{ maxOrder }] = await db
.select({
maxOrder: sql<number>`