diff --git a/frontends/nextjs/src/lib/db/functions/comments/crud/add-comment.ts b/frontends/nextjs/src/lib/db/functions/comments/crud/add-comment.ts index 2917b4b88..b9cfaedb5 100644 --- a/frontends/nextjs/src/lib/db/functions/comments/crud/add-comment.ts +++ b/frontends/nextjs/src/lib/db/functions/comments/crud/add-comment.ts @@ -17,7 +17,7 @@ export const addComment = async (comment: Comment): Promise => { userId: comment.userId, content: comment.content, createdAt: BigInt(comment.createdAt), - updatedAt: comment.updatedAt ? BigInt(comment.updatedAt) : null, + updatedAt: comment.updatedAt !== null && comment.updatedAt !== undefined ? BigInt(comment.updatedAt) : null, parentId: comment.parentId, }, }) diff --git a/frontends/nextjs/src/lib/db/functions/comments/crud/get-comments.ts b/frontends/nextjs/src/lib/db/functions/comments/crud/get-comments.ts index 8e0ce3a15..3d558916c 100644 --- a/frontends/nextjs/src/lib/db/functions/comments/crud/get-comments.ts +++ b/frontends/nextjs/src/lib/db/functions/comments/crud/get-comments.ts @@ -19,7 +19,7 @@ export const getComments = async (): Promise => { entityId: c.entityId, content: c.content, createdAt: Number(c.createdAt), - updatedAt: c.updatedAt ? Number(c.updatedAt) : undefined, - parentId: c.parentId || undefined, + updatedAt: c.updatedAt !== null && c.updatedAt !== undefined ? Number(c.updatedAt) : undefined, + parentId: c.parentId !== null && c.parentId !== '' ? c.parentId : undefined, })) } diff --git a/frontends/nextjs/src/lib/db/functions/comments/crud/set-comments.ts b/frontends/nextjs/src/lib/db/functions/comments/crud/set-comments.ts index 49a4a60bd..5ab0dc791 100644 --- a/frontends/nextjs/src/lib/db/functions/comments/crud/set-comments.ts +++ b/frontends/nextjs/src/lib/db/functions/comments/crud/set-comments.ts @@ -19,7 +19,7 @@ export const setComments = async (comments: Comment[]): Promise => { userId: comment.userId, content: comment.content, createdAt: BigInt(comment.createdAt), - updatedAt: comment.updatedAt ? BigInt(comment.updatedAt) : null, + updatedAt: comment.updatedAt !== null && comment.updatedAt !== undefined ? BigInt(comment.updatedAt) : null, parentId: comment.parentId, }, }) diff --git a/frontends/nextjs/src/lib/db/functions/components/hierarchy/get-component-configs.ts b/frontends/nextjs/src/lib/db/functions/components/hierarchy/get-component-configs.ts index 0afdcd7c5..f60839e1e 100644 --- a/frontends/nextjs/src/lib/db/functions/components/hierarchy/get-component-configs.ts +++ b/frontends/nextjs/src/lib/db/functions/components/hierarchy/get-component-configs.ts @@ -5,6 +5,7 @@ import { prisma } from '@/lib/config/prisma' import type { ComponentConfig } from './types' +import type { JsonValue } from '@/types/utility-types' /** * Get all component configs @@ -17,11 +18,11 @@ export const getComponentConfigs = async (): Promise, + styles: JSON.parse(config.styles) as Record, + events: JSON.parse(config.events) as Record, + conditionalRendering: config.conditionalRendering !== null && config.conditionalRendering !== '' + ? JSON.parse(config.conditionalRendering) as { condition: string; luaScriptId?: string } : undefined, } } diff --git a/frontends/nextjs/src/lib/db/functions/components/hierarchy/get-component-hierarchy.ts b/frontends/nextjs/src/lib/db/functions/components/hierarchy/get-component-hierarchy.ts index 6e6cbcc37..e145c75b8 100644 --- a/frontends/nextjs/src/lib/db/functions/components/hierarchy/get-component-hierarchy.ts +++ b/frontends/nextjs/src/lib/db/functions/components/hierarchy/get-component-hierarchy.ts @@ -17,8 +17,8 @@ export const getComponentHierarchy = async (): Promise }