Remove unused redirects from the Next.js configuration and update package dependencies to include new Tiptap extensions for enhanced text editing capabilities. Clean up the database seeding script by removing commented-out code and ensuring proper deletion of obsolete entries. Update various pages to handle not found scenarios gracefully, improving user experience across the application.
This commit is contained in:
1 parent
4b84409ed7
commit
2858b9c746
106 files changed
+2516
-1004
No files matched your search
@@ -2,7 +2,7 @@ import { NextRequest, NextResponse } from "next/server";
|
||||
import { query } from "@/lib/db";
|
||||
import { rowToSiteStat, type SiteStatRow } from "@/lib/db/mappers";
|
||||
import { requireAdmin } from "@/lib/auth/admin";
|
||||
import { statPatchSchema } from "@/lib/validation/admin";
|
||||
import { statPatchSchema, normalizeRichWrite } from "@/lib/validation/admin";
|
||||
import { errorResponse } from "@/lib/api/response";
|
||||
import { revalidateSite } from "@/lib/api/revalidate";
|
||||
import { parseJsonBody, buildUpdate } from "@/lib/api/crud";
|
||||
@@ -32,7 +32,7 @@ export async function PATCH(
|
||||
return errorResponse("بدنه درخواست JSON معتبر نیست", 400);
|
||||
}
|
||||
|
||||
const parsed = statPatchSchema.safeParse(body);
|
||||
const parsed = statPatchSchema.safeParse(normalizeRichWrite(body));
|
||||
if (!parsed.success) {
|
||||
return errorResponse(parsed.error.issues[0]?.message ?? "داده نادرست", 400);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import { NextRequest, NextResponse } from "next/server";
|
||||
import { query } from "@/lib/db";
|
||||
import { rowToSiteStat, type SiteStatRow } from "@/lib/db/mappers";
|
||||
import { requireAdmin } from "@/lib/auth/admin";
|
||||
import { statCreateSchema } from "@/lib/validation/admin";
|
||||
import { statCreateSchema, normalizeRichWrite } from "@/lib/validation/admin";
|
||||
import { errorResponse } from "@/lib/api/response";
|
||||
import { makeId, parseJsonBody, buildInsert } from "@/lib/api/crud";
|
||||
|
||||
@@ -20,7 +20,7 @@ export async function POST(request: NextRequest) {
|
||||
return errorResponse("بدنه درخواست JSON معتبر نیست", 400);
|
||||
}
|
||||
|
||||
const parsed = statCreateSchema.safeParse(body);
|
||||
const parsed = statCreateSchema.safeParse(normalizeRichWrite(body));
|
||||
if (!parsed.success) {
|
||||
return errorResponse(parsed.error.issues[0]?.message ?? "داده نادرست", 400);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user