diff --git a/utopia-remix/app/models/project.server.ts b/utopia-remix/app/models/project.server.ts index dee9803ac2a8..2517ee3c4d98 100644 --- a/utopia-remix/app/models/project.server.ts +++ b/utopia-remix/app/models/project.server.ts @@ -1,7 +1,5 @@ -import { Project } from 'prisma-client' import { prisma } from '../db.server' - -export type ProjectWithoutContent = Omit +import { ProjectWithoutContent } from '../types' const selectProjectWithoutContent: Record = { id: true, @@ -74,3 +72,22 @@ export async function listDeletedProjects(params: { orderBy: { modified_at: 'desc' }, }) } + +export async function hardDeleteProject(params: { id: string; userId: string }): Promise { + await prisma.project.delete({ + where: { + proj_id: params.id, + owner_id: params.userId, + deleted: true, + }, + }) +} + +export async function hardDeleteAllProjects(params: { userId: string }): Promise { + await prisma.project.deleteMany({ + where: { + owner_id: params.userId, + deleted: true, + }, + }) +} diff --git a/utopia-remix/app/types.ts b/utopia-remix/app/types.ts index 266f36ca13ad..235a03f7ccd3 100644 --- a/utopia-remix/app/types.ts +++ b/utopia-remix/app/types.ts @@ -1,3 +1,5 @@ +import { Project } from 'prisma-client' + export interface ProjectListing { id: string ownerName: string | null @@ -11,3 +13,5 @@ export interface ProjectListing { export type ListProjectsResponse = { projects: ProjectListing[] } + +export type ProjectWithoutContent = Omit