x
This commit is contained in:
1 parent
91dacd20ce
commit
27cc56abaf
14 files changed
+1757
-35
No files matched your search
@@ -300,6 +300,9 @@ export const categoriesRoute = new Elysia({ prefix: "/categories" })
|
||||
imageUrl: category.imageUrl,
|
||||
media: category.media,
|
||||
layoutType: category.layoutType || 'split_showcase',
|
||||
featuredSeries: category.featuredSeries,
|
||||
uspBenefits: category.uspBenefits,
|
||||
filterConfig: category.filterConfig,
|
||||
_count: category._count,
|
||||
},
|
||||
data: category.products.map((p: any) => {
|
||||
@@ -456,6 +459,9 @@ export const categoriesRoute = new Elysia({ prefix: "/categories" })
|
||||
name: body.name,
|
||||
imageUrl: normalizedMedia === null ? (body.imageUrl ?? null) : null,
|
||||
layoutType: body.layoutType || 'split_showcase',
|
||||
featuredSeries: body.featuredSeries ?? null,
|
||||
uspBenefits: body.uspBenefits ?? null,
|
||||
filterConfig: body.filterConfig ?? null,
|
||||
// Auto-seed Thai translation
|
||||
translations: { create: { langCode: 'th', name: body.name } },
|
||||
},
|
||||
@@ -484,6 +490,9 @@ export const categoriesRoute = new Elysia({ prefix: "/categories" })
|
||||
name: t.String(),
|
||||
imageUrl: t.Optional(t.Union([t.String(), t.Null()])),
|
||||
layoutType: t.Optional(t.String()),
|
||||
featuredSeries: t.Optional(t.Any()),
|
||||
uspBenefits: t.Optional(t.Any()),
|
||||
filterConfig: t.Optional(t.Any()),
|
||||
media: t.Optional(t.Array(categoryMediaInput, { maxItems: CATEGORY_MEDIA_ROLES.length })),
|
||||
})
|
||||
})
|
||||
@@ -497,6 +506,9 @@ export const categoriesRoute = new Elysia({ prefix: "/categories" })
|
||||
if (body.name !== undefined) updateData.name = body.name;
|
||||
if (body.imageUrl !== undefined && normalizedMedia === null) updateData.imageUrl = body.imageUrl;
|
||||
if (body.layoutType !== undefined) updateData.layoutType = body.layoutType;
|
||||
if (body.featuredSeries !== undefined) updateData.featuredSeries = body.featuredSeries;
|
||||
if (body.uspBenefits !== undefined) updateData.uspBenefits = body.uspBenefits;
|
||||
if (body.filterConfig !== undefined) updateData.filterConfig = body.filterConfig;
|
||||
|
||||
await prisma.$transaction(async (tx: Prisma.TransactionClient) => {
|
||||
await tx.category.update({
|
||||
@@ -536,6 +548,9 @@ export const categoriesRoute = new Elysia({ prefix: "/categories" })
|
||||
name: t.Optional(t.String()),
|
||||
imageUrl: t.Optional(t.Union([t.String(), t.Null()])),
|
||||
layoutType: t.Optional(t.String()),
|
||||
featuredSeries: t.Optional(t.Any()),
|
||||
uspBenefits: t.Optional(t.Any()),
|
||||
filterConfig: t.Optional(t.Any()),
|
||||
media: t.Optional(t.Array(categoryMediaInput, { maxItems: CATEGORY_MEDIA_ROLES.length })),
|
||||
})
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user