Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

small fix where we default to user id

Sara Vieirae798f05285a2
diff --git a/app/routes/dashboard/index.tsx b/app/routes/dashboard/index.tsx
index 97da049ab4..d3dea88b88 100644
--- a/app/routes/dashboard/index.tsx
+++ b/app/routes/dashboard/index.tsx
@@ -18,8 +18,12 @@ export const action: ActionFunction = async ({ request }) => {
const title = formData.get("project");
if (typeof title !== "string") return { errors: "Title required" };
const { userId, headers } = await ensureUserCookie(request);
+ const authenticatedUser = await authenticator.isAuthenticated(request);
try {
- const project = await db.project.create({ title, userId });
+ const project = await db.project.create({
+ title,
+ userId: authenticatedUser?.id || userId,
+ });
return redirect(`${config.designerPath}/${project?.id}`, { headers });
} catch (error) {
if (error instanceof Error) {
diff --git a/prisma/schema.prisma b/prisma/schema.prisma
index c7a5edb888..926f331193 100644
--- a/prisma/schema.prisma
+++ b/prisma/schema.prisma
@@ -10,12 +10,6 @@ datasource db {
url = env("DATABASE_URL")
}
-model Team {
- id String @id @default(uuid())
- users User[]
-
-}
-
model User {
id String @id @default(uuid())
email String? @unique
@@ -23,20 +17,18 @@ model User {
image String?
username String?
createdAt DateTime @default(now())
- Team Team? @relation(fields: [teamId], references: [id])
- teamId String?
projects Project[]
}
model Project {
id String @id @default(uuid())
+ userId String
title String
domain String @unique
prodTreeId String? // exists when published
devTreeId String
prodTreeIdHistory String @default("[]")
User User? @relation(fields: [userId], references: [id])
- userId String?
}
model Tree {