chore: 🔥 Remove ownerIds
This commit is contained in:
@@ -21,8 +21,8 @@ import { Typebot } from 'models'
|
||||
import { useTypebotDnd } from 'contexts/TypebotDndContext'
|
||||
import { useDebounce } from 'use-debounce'
|
||||
import { EmojiOrImageIcon } from 'components/shared/EmojiOrImageIcon'
|
||||
import { useUser } from 'contexts/UserContext'
|
||||
import { Plan } from 'db'
|
||||
import { useWorkspace } from 'contexts/WorkspaceContext'
|
||||
|
||||
type ChatbotCardProps = {
|
||||
typebot: Pick<Typebot, 'id' | 'publishedTypebotId' | 'name' | 'icon'>
|
||||
@@ -38,7 +38,7 @@ export const TypebotButton = ({
|
||||
onMouseDown,
|
||||
}: ChatbotCardProps) => {
|
||||
const router = useRouter()
|
||||
const { user } = useUser()
|
||||
const { workspace } = useWorkspace()
|
||||
const { draggedTypebot } = useTypebotDnd()
|
||||
const [draggedTypebotDebounced] = useDebounce(draggedTypebot, 200)
|
||||
const {
|
||||
@@ -79,7 +79,7 @@ export const TypebotButton = ({
|
||||
if (!typebotToDuplicate) return { error: new Error('Typebot not found') }
|
||||
const { data: createdTypebot, error } = await importTypebot(
|
||||
data.typebot,
|
||||
user?.plan ?? Plan.FREE
|
||||
workspace?.plan ?? Plan.FREE
|
||||
)
|
||||
if (error)
|
||||
return toast({
|
||||
|
||||
@@ -12,7 +12,6 @@ import {
|
||||
import { TrashIcon } from 'assets/icons'
|
||||
import { UpgradeButton } from 'components/shared/buttons/UpgradeButton'
|
||||
import { useTypebot } from 'contexts/TypebotContext/TypebotContext'
|
||||
import { useUser } from 'contexts/UserContext'
|
||||
import { useWorkspace } from 'contexts/WorkspaceContext'
|
||||
import React from 'react'
|
||||
import { parseDefaultPublicId } from 'services/typebots'
|
||||
|
||||
@@ -13,7 +13,6 @@ import {
|
||||
} from '@chakra-ui/react'
|
||||
import { ChevronLeftIcon, PlusIcon, TrashIcon } from 'assets/icons'
|
||||
import React, { useState } from 'react'
|
||||
import { useUser } from 'contexts/UserContext'
|
||||
import { CustomDomainModal } from './CustomDomainModal'
|
||||
import { deleteCustomDomain, useCustomDomains } from 'services/user'
|
||||
import { useWorkspace } from 'contexts/WorkspaceContext'
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { useTypebot } from 'contexts/TypebotContext'
|
||||
import { useUser } from 'contexts/UserContext'
|
||||
import { useWorkspace } from 'contexts/WorkspaceContext'
|
||||
import { Plan } from 'db'
|
||||
import React, { useEffect, useState } from 'react'
|
||||
import { isCloudProdInstance } from 'services/utils'
|
||||
import { planToReadable } from 'services/workspace'
|
||||
|
||||
@@ -40,7 +40,6 @@ export const CreateNewTypebotButtons = () => {
|
||||
...typebot,
|
||||
folderId,
|
||||
workspaceId: workspace.id,
|
||||
ownerId: user.id,
|
||||
theme: {
|
||||
...typebot.theme,
|
||||
chat: {
|
||||
|
||||
@@ -34,7 +34,6 @@ export function CustomAdapter(p: PrismaClient): Adapter {
|
||||
...data,
|
||||
id: user.id,
|
||||
apiToken: randomUUID(),
|
||||
plan: process.env.ADMIN_EMAIL === data.email ? Plan.PRO : Plan.FREE,
|
||||
workspaces:
|
||||
workspaceInvitations.length > 0
|
||||
? undefined
|
||||
|
||||
@@ -81,7 +81,6 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
'blocks' in data
|
||||
? data
|
||||
: (parseNewTypebot({
|
||||
ownerId: user.id,
|
||||
ownerAvatarUrl: user.image,
|
||||
...data,
|
||||
}) as Prisma.TypebotUncheckedCreateInput),
|
||||
|
||||
@@ -24,7 +24,7 @@ const DashboardPage = () => {
|
||||
|
||||
useEffect(() => {
|
||||
const subscribePlan = query.subscribePlan as 'pro' | 'team' | undefined
|
||||
if (workspace && subscribePlan && user && user.plan === 'FREE') {
|
||||
if (workspace && subscribePlan && user && workspace.plan === 'FREE') {
|
||||
setIsLoading(true)
|
||||
pay({
|
||||
user,
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
"createdAt": "2022-02-04T08:16:59.215Z",
|
||||
"updatedAt": "2022-02-04T08:16:59.215Z",
|
||||
"name": "My typebot",
|
||||
"ownerId": "ckz6t9iep0006k31a22j05fwq",
|
||||
"publishedTypebotId": null,
|
||||
"folderId": null,
|
||||
"blocks": [
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
"createdAt": "2022-03-21T15:01:46.107Z",
|
||||
"updatedAt": "2022-03-21T15:03:07.312Z",
|
||||
"name": "My typebot",
|
||||
"ownerId": "cl10hgjy90000lm1a1gyccuqj",
|
||||
"publishedTypebotId": null,
|
||||
"folderId": null,
|
||||
"blocks": [
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
"createdAt": "2022-02-04T13:40:19.455Z",
|
||||
"updatedAt": "2022-02-04T13:40:19.455Z",
|
||||
"name": "My typebot",
|
||||
"ownerId": "ckz6t9iep0006k31a22j05fwq",
|
||||
"publishedTypebotId": null,
|
||||
"folderId": null,
|
||||
"blocks": [
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
"createdAt": "2022-02-04T13:40:19.455Z",
|
||||
"updatedAt": "2022-02-04T13:40:19.455Z",
|
||||
"name": "My typebot",
|
||||
"ownerId": "ckz6t9iep0006k31a22j05fwq",
|
||||
"publishedTypebotId": null,
|
||||
"folderId": null,
|
||||
"blocks": [
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
"createdAt": "2022-02-07T10:06:35.274Z",
|
||||
"updatedAt": "2022-02-07T10:06:35.274Z",
|
||||
"name": "My typebot",
|
||||
"ownerId": "ckz6t9iep0006k31a22j05fwq",
|
||||
"publishedTypebotId": null,
|
||||
"folderId": null,
|
||||
"blocks": [
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
"createdAt": "2022-02-04T13:44:30.386Z",
|
||||
"updatedAt": "2022-02-04T13:44:30.386Z",
|
||||
"name": "My typebot",
|
||||
"ownerId": "ckz6t9iep0006k31a22j05fwq",
|
||||
"publishedTypebotId": null,
|
||||
"folderId": null,
|
||||
"blocks": [
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
"createdAt": "2022-02-04T14:14:21.394Z",
|
||||
"updatedAt": "2022-02-04T14:14:21.394Z",
|
||||
"name": "My typebot",
|
||||
"ownerId": "ckz6t9iep0006k31a22j05fwq",
|
||||
"publishedTypebotId": null,
|
||||
"folderId": null,
|
||||
"blocks": [
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
"createdAt": "2022-02-04T13:47:42.459Z",
|
||||
"updatedAt": "2022-02-04T13:47:42.459Z",
|
||||
"name": "My typebot",
|
||||
"ownerId": "ckz6t9iep0006k31a22j05fwq",
|
||||
"publishedTypebotId": null,
|
||||
"folderId": null,
|
||||
"blocks": [
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
"createdAt": "2022-03-09T07:01:25.917Z",
|
||||
"updatedAt": "2022-03-09T07:01:25.917Z",
|
||||
"name": "My typebot",
|
||||
"ownerId": "cl0cfi60r0000381a2bft9yis",
|
||||
"publishedTypebotId": null,
|
||||
"folderId": null,
|
||||
"blocks": [
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
"createdAt": "2022-03-08T17:18:50.337Z",
|
||||
"updatedAt": "2022-03-08T21:05:28.825Z",
|
||||
"name": "Another typebot",
|
||||
"ownerId": "cl0cfi60r0000381a2bft9yis",
|
||||
"publishedTypebotId": null,
|
||||
"folderId": null,
|
||||
"blocks": [
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
"createdAt": "2022-02-04T14:14:21.394Z",
|
||||
"updatedAt": "2022-02-04T14:14:21.394Z",
|
||||
"name": "My typebot",
|
||||
"ownerId": "ckz6t9iep0006k31a22j05fwq",
|
||||
"publishedTypebotId": null,
|
||||
"folderId": null,
|
||||
"blocks": [
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
"createdAt": "2022-02-04T14:15:06.953Z",
|
||||
"updatedAt": "2022-02-04T14:15:06.953Z",
|
||||
"name": "My typebot",
|
||||
"ownerId": "ckz6t9iep0006k31a22j05fwq",
|
||||
"publishedTypebotId": null,
|
||||
"folderId": null,
|
||||
"blocks": [
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
"createdAt": "2022-02-05T06:21:16.522Z",
|
||||
"updatedAt": "2022-02-05T06:21:16.522Z",
|
||||
"name": "My typebot",
|
||||
"ownerId": "ckzmhmiey001009mnzt5nkxu8",
|
||||
"publishedTypebotId": null,
|
||||
"folderId": null,
|
||||
"blocks": [
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
"createdAt": "2022-03-10T10:50:23.912Z",
|
||||
"updatedAt": "2022-03-10T10:50:23.912Z",
|
||||
"name": "My typebot",
|
||||
"ownerId": "cl0cfi60r0000381a2bft9yis",
|
||||
"publishedTypebotId": null,
|
||||
"folderId": null,
|
||||
"blocks": [
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
"createdAt": "2022-02-04T14:17:20.022Z",
|
||||
"updatedAt": "2022-02-04T14:17:20.022Z",
|
||||
"name": "My typebot",
|
||||
"ownerId": "ckz6t9iep0006k31a22j05fwq",
|
||||
"publishedTypebotId": null,
|
||||
"folderId": null,
|
||||
"blocks": [
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
"createdAt": "2022-02-04T14:19:29.412Z",
|
||||
"updatedAt": "2022-02-04T14:19:29.412Z",
|
||||
"name": "My typebot",
|
||||
"ownerId": "ckz6t9iep0006k31a22j05fwq",
|
||||
"publishedTypebotId": null,
|
||||
"folderId": null,
|
||||
"blocks": [
|
||||
|
||||
@@ -249,7 +249,6 @@ const parseTypebotToPublicTypebot = (
|
||||
|
||||
const parseTestTypebot = (partialTypebot: Partial<Typebot>): Typebot => ({
|
||||
id: partialTypebot.id ?? 'typebot',
|
||||
ownerId: 'proUser',
|
||||
workspaceId: proWorkspaceId,
|
||||
folderId: null,
|
||||
name: 'My typebot',
|
||||
@@ -312,10 +311,9 @@ export const importTypebotInDatabase = async (
|
||||
path: string,
|
||||
updates?: Partial<Typebot>
|
||||
) => {
|
||||
const typebot: any = {
|
||||
const typebot: Typebot = {
|
||||
...JSON.parse(readFileSync(path).toString()),
|
||||
workspaceId: proWorkspaceId,
|
||||
ownerId: 'proUser',
|
||||
...updates,
|
||||
}
|
||||
await prisma.typebot.create({
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
"createdAt": "2022-03-22T14:33:05.037Z",
|
||||
"updatedAt": "2022-03-22T16:33:37.928Z",
|
||||
"name": "Onboarding",
|
||||
"ownerId": "ckzmhmiey001009mnzt5nkxu8",
|
||||
"publishedTypebotId": "cl128n64i00092e69wenv1dlx",
|
||||
"folderId": null,
|
||||
"blocks": [
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
"updatedAt": "2022-03-25T15:42:12.544Z",
|
||||
"name": "Customer Support",
|
||||
"icon": "😍",
|
||||
"ownerId": "cl13od3wt0000pl1aat7bdrxf",
|
||||
"publishedTypebotId": null,
|
||||
"folderId": null,
|
||||
"blocks": [
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
"updatedAt": "2022-02-05T06:21:16.522Z",
|
||||
"name": "Lead Generation",
|
||||
"icon": "🤝",
|
||||
"ownerId": "ckz6t9iep0006k31a22j05fwq",
|
||||
"publishedTypebotId": null,
|
||||
"folderId": null,
|
||||
"blocks": [
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
"updatedAt": "2022-04-09T22:35:22.449Z",
|
||||
"icon": "🏆",
|
||||
"name": "Lead Scoring",
|
||||
"ownerId": "cl1qykt2w00007w1agho81e26",
|
||||
"publishedTypebotId": null,
|
||||
"folderId": null,
|
||||
"blocks": [
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
"updatedAt": "2022-04-08T23:03:34.726Z",
|
||||
"icon": "🕹️",
|
||||
"name": "Digital Marketing Quiz",
|
||||
"ownerId": "cl1qykt2w00007w1agho81e26",
|
||||
"publishedTypebotId": null,
|
||||
"folderId": null,
|
||||
"blocks": [
|
||||
|
||||
@@ -24,7 +24,7 @@ export const useCredentials = ({
|
||||
}
|
||||
|
||||
export const createCredentials = async (
|
||||
credentials: Omit<Credentials, 'id' | 'iv' | 'createdAt' | 'ownerId'>
|
||||
credentials: Omit<Credentials, 'id' | 'iv' | 'createdAt'>
|
||||
) =>
|
||||
sendRequest<{
|
||||
credentials: Credentials
|
||||
|
||||
@@ -13,7 +13,7 @@ export const useCustomDomains = ({
|
||||
onError: (error: Error) => void
|
||||
}) => {
|
||||
const { data, error, mutate } = useSWR<
|
||||
{ customDomains: Omit<CustomDomain, 'createdAt' | 'ownerId'>[] },
|
||||
{ customDomains: Omit<CustomDomain, 'createdAt'>[] },
|
||||
Error
|
||||
>(
|
||||
workspaceId ? `/api/customDomains?${stringify({ workspaceId })}` : null,
|
||||
@@ -29,7 +29,7 @@ export const useCustomDomains = ({
|
||||
|
||||
export const createCustomDomain = async (
|
||||
workspaceId: string,
|
||||
customDomain: Omit<CustomDomain, 'createdAt' | 'workspaceId' | 'ownerId'>
|
||||
customDomain: Omit<CustomDomain, 'createdAt' | 'workspaceId'>
|
||||
) =>
|
||||
sendRequest<{
|
||||
credentials: Credentials
|
||||
|
||||
@@ -36,7 +36,6 @@ export const parsePublicTypebotToTypebot = (
|
||||
updatedAt: existingTypebot.updatedAt,
|
||||
publishedTypebotId: typebot.id,
|
||||
folderId: existingTypebot.folderId,
|
||||
ownerId: existingTypebot.ownerId,
|
||||
icon: existingTypebot.icon,
|
||||
workspaceId: existingTypebot.workspaceId,
|
||||
})
|
||||
|
||||
@@ -418,7 +418,6 @@ export const parseNewTypebot = ({
|
||||
steps: [startStep],
|
||||
}
|
||||
return {
|
||||
ownerId: null,
|
||||
folderId,
|
||||
name,
|
||||
workspaceId,
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
"createdAt": "2022-03-15T12:54:54.778Z",
|
||||
"updatedAt": "2022-03-15T13:13:54.482Z",
|
||||
"name": "My typebot",
|
||||
"ownerId": "ckzmhmiey001009mnzt5nkxu8",
|
||||
"publishedTypebotId": null,
|
||||
"folderId": null,
|
||||
"blocks": [
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
"createdAt": "2022-03-15T15:41:00.241Z",
|
||||
"updatedAt": "2022-03-15T17:32:29.840Z",
|
||||
"name": "My typebot",
|
||||
"ownerId": "ckzmhmiey001009mnzt5nkxu8",
|
||||
"publishedTypebotId": "pioizXgk6U9Xtz1BdyjPFy",
|
||||
"folderId": null,
|
||||
"blocks": [
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
"createdAt": "2022-02-05T06:21:16.522Z",
|
||||
"updatedAt": "2022-02-05T06:21:16.522Z",
|
||||
"name": "My typebot",
|
||||
"ownerId": "ckzwaq0p000149f1a2ejh3qm0",
|
||||
"publishedTypebotId": null,
|
||||
"folderId": null,
|
||||
"blocks": [
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
"createdAt": "2022-03-09T16:17:51.321Z",
|
||||
"updatedAt": "2022-03-09T16:19:07.037Z",
|
||||
"name": "My typebot",
|
||||
"ownerId": "cl0cfi60r0000381a2bft9yis",
|
||||
"publishedTypebotId": "dm12bh6hmEQemywn86osJD",
|
||||
"folderId": null,
|
||||
"blocks": [
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
"createdAt": "2022-03-08T15:58:49.720Z",
|
||||
"updatedAt": "2022-03-08T16:07:18.899Z",
|
||||
"name": "My typebot",
|
||||
"ownerId": "cl0cfi60r0000381a2bft9yis",
|
||||
"publishedTypebotId": null,
|
||||
"folderId": null,
|
||||
"blocks": [
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
"createdAt": "2022-03-08T15:59:06.589Z",
|
||||
"updatedAt": "2022-03-08T15:59:10.498Z",
|
||||
"name": "Another typebot",
|
||||
"ownerId": "cl0cfi60r0000381a2bft9yis",
|
||||
"publishedTypebotId": null,
|
||||
"folderId": null,
|
||||
"blocks": [
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
"createdAt": "2022-03-23T08:41:30.106Z",
|
||||
"updatedAt": "2022-03-23T08:41:30.106Z",
|
||||
"name": "My typebot",
|
||||
"ownerId": "cl139ni700000481a01gxhw4z",
|
||||
"publishedTypebotId": null,
|
||||
"folderId": null,
|
||||
"blocks": [
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
"updatedAt": "2022-04-12T14:34:44.287Z",
|
||||
"icon": null,
|
||||
"name": "My typebot",
|
||||
"ownerId": "ckzmhmiey001009mnzt5nkxu8",
|
||||
"publishedTypebotId": null,
|
||||
"folderId": null,
|
||||
"blocks": [
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
"updatedAt": "2022-04-19T20:40:48.366Z",
|
||||
"icon": null,
|
||||
"name": "My typebot",
|
||||
"ownerId": "proUser",
|
||||
"publishedTypebotId": null,
|
||||
"folderId": null,
|
||||
"blocks": [
|
||||
|
||||
@@ -109,7 +109,6 @@ const parseTestTypebot = (partialTypebot: Partial<Typebot>): Typebot => ({
|
||||
id: partialTypebot.id ?? 'typebot',
|
||||
folderId: null,
|
||||
name: 'My typebot',
|
||||
ownerId: 'proUser',
|
||||
workspaceId: proWorkspaceId,
|
||||
icon: null,
|
||||
theme: defaultTheme,
|
||||
@@ -170,11 +169,10 @@ export const importTypebotInDatabase = async (
|
||||
path: string,
|
||||
updates?: Partial<Typebot>
|
||||
) => {
|
||||
const typebot: any = {
|
||||
const typebot: Typebot = {
|
||||
...JSON.parse(readFileSync(path).toString()),
|
||||
...updates,
|
||||
workspaceId: proWorkspaceId,
|
||||
ownerId: 'proUser',
|
||||
}
|
||||
await prisma.typebot.create({
|
||||
data: typebot,
|
||||
@@ -233,7 +231,6 @@ export const createSmtpCredentials = (
|
||||
iv,
|
||||
name: smtpData.from.email as string,
|
||||
type: CredentialsType.SMTP,
|
||||
ownerId: 'proUser',
|
||||
workspaceId: proWorkspaceId,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { CollaborationType, Prisma, User } from 'db'
|
||||
import { CollaborationType, Prisma, User, WorkspaceRole } from 'db'
|
||||
|
||||
const parseWhereFilter = (
|
||||
typebotIds: string[] | string,
|
||||
@@ -6,14 +6,6 @@ const parseWhereFilter = (
|
||||
type: 'read' | 'write'
|
||||
): Prisma.TypebotWhereInput => ({
|
||||
OR: [
|
||||
{
|
||||
id: typeof typebotIds === 'string' ? typebotIds : { in: typebotIds },
|
||||
ownerId:
|
||||
(type === 'read' && user.email === process.env.ADMIN_EMAIL) ||
|
||||
process.env.NEXT_PUBLIC_E2E_TEST
|
||||
? undefined
|
||||
: user.id,
|
||||
},
|
||||
{
|
||||
id: typeof typebotIds === 'string' ? typebotIds : { in: typebotIds },
|
||||
collaborators: {
|
||||
@@ -23,6 +15,18 @@ const parseWhereFilter = (
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
id: typeof typebotIds === 'string' ? typebotIds : { in: typebotIds },
|
||||
workspace:
|
||||
(type === 'read' && user.email === process.env.ADMIN_EMAIL) ||
|
||||
process.env.NEXT_PUBLIC_E2E_TEST
|
||||
? undefined
|
||||
: {
|
||||
members: {
|
||||
some: { userId: user.id, role: { not: WorkspaceRole.GUEST } },
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
@@ -37,3 +41,12 @@ export const canReadTypebots = (typebotIds: string[], user: User) =>
|
||||
|
||||
export const canWriteTypebots = (typebotIds: string[], user: User) =>
|
||||
parseWhereFilter(typebotIds, user, 'write')
|
||||
|
||||
export const canEditGuests = (user: User, typebotId: string) => ({
|
||||
id: typebotId,
|
||||
workspace: {
|
||||
members: {
|
||||
some: { userId: user.id, role: { not: WorkspaceRole.GUEST } },
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `ownerId` on the `Credentials` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `ownerId` on the `CustomDomain` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `ownerId` on the `DashboardFolder` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `ownerId` on the `Typebot` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `plan` on the `User` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `stripeId` on the `User` table. All the data in the column will be lost.
|
||||
|
||||
*/
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Credentials" DROP CONSTRAINT "Credentials_ownerId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "CustomDomain" DROP CONSTRAINT "CustomDomain_ownerId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "DashboardFolder" DROP CONSTRAINT "DashboardFolder_ownerId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "Typebot" DROP CONSTRAINT "Typebot_ownerId_fkey";
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX "Credentials_name_type_ownerId_key";
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX "DashboardFolder_id_ownerId_key";
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX "Typebot_id_ownerId_key";
|
||||
|
||||
-- DropIndex
|
||||
DROP INDEX "User_stripeId_key";
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Credentials" DROP COLUMN "ownerId";
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "CustomDomain" DROP COLUMN "ownerId";
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "DashboardFolder" DROP COLUMN "ownerId";
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Typebot" DROP COLUMN "ownerId";
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "User" DROP COLUMN "plan",
|
||||
DROP COLUMN "stripeId";
|
||||
@@ -48,12 +48,6 @@ model User {
|
||||
image String?
|
||||
accounts Account[]
|
||||
sessions Session[]
|
||||
typebots Typebot[]
|
||||
folders DashboardFolder[]
|
||||
plan Plan? @default(FREE)
|
||||
stripeId String? @unique
|
||||
credentials Credentials[]
|
||||
customDomains CustomDomain[]
|
||||
apiToken String?
|
||||
CollaboratorsOnTypebots CollaboratorsOnTypebots[]
|
||||
company String?
|
||||
@@ -110,8 +104,6 @@ enum GraphNavigation {
|
||||
model CustomDomain {
|
||||
name String @id
|
||||
createdAt DateTime @default(now())
|
||||
ownerId String?
|
||||
owner User? @relation(fields: [ownerId], references: [id], onDelete: Cascade)
|
||||
workspaceId String?
|
||||
workspace Workspace? @relation(fields: [workspaceId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
@@ -119,16 +111,12 @@ model CustomDomain {
|
||||
model Credentials {
|
||||
id String @id @default(cuid())
|
||||
createdAt DateTime @default(now())
|
||||
ownerId String?
|
||||
owner User? @relation(fields: [ownerId], references: [id], onDelete: Cascade)
|
||||
workspaceId String?
|
||||
workspace Workspace? @relation(fields: [workspaceId], references: [id], onDelete: Cascade)
|
||||
data String // Encrypted data
|
||||
name String
|
||||
type String
|
||||
iv String
|
||||
|
||||
@@unique([name, type, ownerId])
|
||||
}
|
||||
|
||||
enum Plan {
|
||||
@@ -152,16 +140,12 @@ model DashboardFolder {
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
name String
|
||||
owner User? @relation(fields: [ownerId], references: [id], onDelete: Cascade)
|
||||
ownerId String?
|
||||
parentFolderId String?
|
||||
parentFolder DashboardFolder? @relation("ParentChild", fields: [parentFolderId], references: [id])
|
||||
childrenFolder DashboardFolder[] @relation("ParentChild")
|
||||
typebots Typebot[]
|
||||
workspaceId String?
|
||||
workspace Workspace? @relation(fields: [workspaceId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([id, ownerId])
|
||||
}
|
||||
|
||||
model Typebot {
|
||||
@@ -170,8 +154,6 @@ model Typebot {
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
icon String?
|
||||
name String
|
||||
ownerId String?
|
||||
owner User? @relation(fields: [ownerId], references: [id], onDelete: Cascade)
|
||||
publishedTypebotId String?
|
||||
publishedTypebot PublicTypebot?
|
||||
results Result[]
|
||||
@@ -189,8 +171,6 @@ model Typebot {
|
||||
webhooks Webhook[]
|
||||
workspaceId String?
|
||||
workspace Workspace? @relation(fields: [workspaceId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([id, ownerId])
|
||||
}
|
||||
|
||||
model Invitation {
|
||||
|
||||
Reference in New Issue
Block a user