diff --git a/apps/designer/app/designer/designer.tsx b/apps/designer/app/designer/designer.tsx index 39049178fc..23d495d110 100644 --- a/apps/designer/app/designer/designer.tsx +++ b/apps/designer/app/designer/designer.tsx @@ -4,7 +4,7 @@ import { usePublish, type Publish, } from "@webstudio-is/react-sdk"; -import { type Project, type Asset } from "@webstudio-is/prisma-client"; +import { type Project } from "@webstudio-is/prisma-client"; import type { Config } from "~/config"; import type { HoveredInstanceData, @@ -219,7 +219,7 @@ const NavigatorPanel = ({ publish, isPreviewMode }: NavigatorPanelProps) => { type DesignerProps = { config: Config; - project: Project & { assets: Asset[] }; + project: Project; }; export const Designer = ({ config, project }: DesignerProps) => { diff --git a/apps/designer/app/shared/db/project.server.ts b/apps/designer/app/shared/db/project.server.ts index 91ad5dd0b9..d413b634bc 100644 --- a/apps/designer/app/shared/db/project.server.ts +++ b/apps/designer/app/shared/db/project.server.ts @@ -14,10 +14,9 @@ const TreeHistorySchema = z.array(z.string()); export type Project = Omit & { prodTreeIdHistory: z.infer; - Asset?: Asset[]; }; -const parseProject = (project: any): (Project & { assets: Asset[] }) | null => { +const parseProject = (project: BaseProject | null): Project | null => { if (project === null) return null; const prodTreeIdHistory = JSON.parse(project.prodTreeIdHistory); TreeHistorySchema.parse(prodTreeIdHistory); @@ -27,9 +26,7 @@ const parseProject = (project: any): (Project & { assets: Asset[] }) | null => { }; }; -export const loadById = async ( - projectId?: Project["id"] -): Promise<(Project & { assets: Asset[] }) | null> => { +export const loadById = async (projectId?: Project["id"]) => { if (typeof projectId !== "string") { throw new Error("Project ID required"); } @@ -62,7 +59,6 @@ export const loadManyByUserId = async ( id: userId, }, }, - include: { assets: true }, }); return projects.map(parseProject) as Project[]; @@ -110,10 +106,7 @@ export const create = async ({ return parseProject(project); }; -export const clone = async ( - clonableDomain: string, - userId: string -): Promise => { +export const clone = async (clonableDomain: string, userId: string) => { const clonableProject = await loadByDomain(clonableDomain); if (clonableProject === null) { throw new Error(`Not found project "${clonableDomain}"`); @@ -159,7 +152,7 @@ export const update = async ({ prodTreeId?: string; devTreeId?: string; prodTreeIdHistory: Array; -}): Promise => { +}) => { if (data.domain) { data.domain = slugify(data.domain, slugifyOptions); if (data.domain.length < MIN_DOMAIN_LENGTH) { diff --git a/packages/prisma-client/src/types.ts b/packages/prisma-client/src/types.ts index 86bc8fce27..d696330ea3 100644 --- a/packages/prisma-client/src/types.ts +++ b/packages/prisma-client/src/types.ts @@ -6,5 +6,5 @@ export type Asset = DbAsset & { path: string; status?: "uploading" | "uploaded"; }; -export type Project = BaseProject & { Asset: DbAsset[] }; +export type Project = BaseProject & { assets: DbAsset[] }; export type { DbAsset };