x
This commit is contained in:
1 parent
3ac0cb4f53
commit
5e724fae20
17 files changed
+2404
-278
No files matched your search
@@ -12,6 +12,7 @@ import {
|
||||
EditorialTileSectionPayloadSchema,
|
||||
FeaturedTilesSectionPayloadSchema,
|
||||
EditorialCarouselSectionPayloadSchema,
|
||||
HeroCarouselSectionPayloadSchema,
|
||||
HeroArticleSectionPayloadSchema,
|
||||
RichTextSectionPayloadSchema,
|
||||
ArticleHeaderSectionPayloadSchema,
|
||||
@@ -248,8 +249,13 @@ export const pagesRoute = new Elysia({ prefix: "/pages" })
|
||||
const includeInactive =
|
||||
String((query as any)?.includeInactive || "").toLowerCase() === "true";
|
||||
const lang = (query as any)?.lang || "th";
|
||||
const page = await prisma.page.findUnique({
|
||||
where: { slug },
|
||||
const numId = Number(slug);
|
||||
const isNumericId = Number.isInteger(numId) && numId > 0;
|
||||
|
||||
const page = await prisma.page.findFirst({
|
||||
where: isNumericId
|
||||
? { OR: [{ id: numId }, { slug }] }
|
||||
: { slug },
|
||||
include: {
|
||||
sections: {
|
||||
where: includeInactive ? undefined : { isActive: true },
|
||||
@@ -1112,6 +1118,9 @@ export function validateSectionPayload(
|
||||
case "EDITORIAL_CAROUSEL":
|
||||
schema = EditorialCarouselSectionPayloadSchema;
|
||||
break;
|
||||
case "HERO_CAROUSEL":
|
||||
schema = HeroCarouselSectionPayloadSchema;
|
||||
break;
|
||||
case "HERO_ARTICLE":
|
||||
schema = HeroArticleSectionPayloadSchema;
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user