feat(overview) : add YouTube video section
CI / Verify (push) Successful in 1m4s
CI / Build immutable images and deploy (push) Successful in 1m54s

This commit is contained in:
2026-09-03 12:06:36 +07:00 Unverified
parent dd672e5331
commit cfc6f0c146
11 changed files with 3585 additions and 100 deletions
+11
View File
@@ -1,6 +1,7 @@
import * as z from "zod";
import { targetStatOptions } from "@/lib/guides/stats";
import { parseYouTubeUrl } from "@/lib/guides/youtube";
export const guideSectionKinds = ["weapon", "artifact", "constellations", "team"] as const;
export type GuideSectionKind = (typeof guideSectionKinds)[number];
@@ -14,10 +15,20 @@ export const createGuideSchema = z.strictObject({
overview: z.string().trim().max(500),
});
const youtubeUrlSchema = z.string().trim().max(2_048).optional().transform((value, context) => {
if (value === undefined) return undefined;
if (!value) return null;
const video = parseYouTubeUrl(value);
if (video) return video.watchUrl;
context.addIssue({ code: "custom", message: "กรุณาใส่ลิงก์วิดีโอ YouTube ที่ถูกต้อง" });
return z.NEVER;
});
export const updateGuideSchema = z.strictObject({
expectedVersion: z.number().int().positive(),
coverMediaId: z.string().uuid(),
overview: z.string().trim().min(1).max(500),
youtubeUrl: youtubeUrlSchema,
});
export const weaponSectionSchema = z.strictObject({