♻️ Re-organize workspace folders

This commit is contained in:
Baptiste Arnaud
2023-03-15 08:35:16 +01:00
parent 25c367901f
commit cbc8194f19
987 changed files with 2716 additions and 2770 deletions

View File

@@ -9,8 +9,8 @@ import prisma from '@/lib/prisma'
import { Provider } from 'next-auth/providers'
import { NextApiRequest, NextApiResponse } from 'next'
import { CustomAdapter } from './adapter'
import { User } from 'db'
import { env, getAtPath, isDefined, isNotEmpty } from 'utils'
import { User } from '@typebot.io/prisma'
import { env, getAtPath, isDefined, isNotEmpty } from '@typebot.io/lib'
import { mockedUser } from '@/features/auth'
import { getNewUserInvitations } from '@/features/auth/api'
import { sendVerificationRequest } from './sendVerificationRequest'

View File

@@ -1,16 +1,21 @@
// Forked from https://github.com/nextauthjs/adapters/blob/main/packages/prisma/src/index.ts
import { PrismaClient, Prisma, WorkspaceRole, Session } from 'db'
import {
PrismaClient,
Prisma,
WorkspaceRole,
Session,
} from '@typebot.io/prisma'
import type { Adapter, AdapterUser } from 'next-auth/adapters'
import { createId } from '@paralleldrive/cuid2'
import { generateId } from 'utils'
import { generateId } from '@typebot.io/lib'
import { parseWorkspaceDefaultPlan } from '@/features/workspace'
import {
getNewUserInvitations,
convertInvitationsToCollaborations,
joinWorkspaces,
} from '@/features/auth/api'
import { sendTelemetryEvents } from 'utils/telemetry/sendTelemetryEvent'
import { TelemetryEvent } from 'models/features/telemetry'
import { sendTelemetryEvents } from '@typebot.io/lib/telemetry/sendTelemetryEvent'
import { TelemetryEvent } from '@typebot.io/schemas/features/telemetry'
export function CustomAdapter(p: PrismaClient): Adapter {
return {

View File

@@ -1,5 +1,5 @@
import { EmailConfig } from 'next-auth/providers/email'
import { sendMagicLinkEmail } from 'emails'
import { sendMagicLinkEmail } from '@typebot.io/emails'
type Props = {
identifier: string

View File

@@ -1,5 +1,5 @@
import prisma from '@/lib/prisma'
import { Credentials } from 'models'
import { Credentials } from '@typebot.io/schemas'
import { NextApiRequest, NextApiResponse } from 'next'
import { getAuthenticatedUser } from '@/features/auth/api'
import {
@@ -8,7 +8,7 @@ import {
methodNotAllowed,
notAuthenticated,
encrypt,
} from 'utils/api'
} from '@typebot.io/lib/api'
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const user = await getAuthenticatedUser(req)

View File

@@ -1,7 +1,11 @@
import prisma from '@/lib/prisma'
import { NextApiRequest, NextApiResponse } from 'next'
import { getAuthenticatedUser } from '@/features/auth/api'
import { badRequest, methodNotAllowed, notAuthenticated } from 'utils/api'
import {
badRequest,
methodNotAllowed,
notAuthenticated,
} from '@typebot.io/lib/api'
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const user = await getAuthenticatedUser(req)

View File

@@ -1,9 +1,9 @@
import { NextApiRequest, NextApiResponse } from 'next'
import { Prisma } from 'db'
import { Prisma } from '@typebot.io/prisma'
import prisma from '@/lib/prisma'
import { googleSheetsScopes } from './consent-url'
import { stringify } from 'querystring'
import { badRequest, encrypt, notAuthenticated } from 'utils/api'
import { badRequest, encrypt, notAuthenticated } from '@typebot.io/lib/api'
import { oauth2Client } from '@/lib/googleSheets'
import { getAuthenticatedUser } from '@/features/auth/api'

View File

@@ -1,4 +1,4 @@
import { CustomDomain } from 'db'
import { CustomDomain } from '@typebot.io/prisma'
import { got, HTTPError } from 'got'
import prisma from '@/lib/prisma'
import { NextApiRequest, NextApiResponse } from 'next'
@@ -8,7 +8,7 @@ import {
forbidden,
methodNotAllowed,
notAuthenticated,
} from 'utils/api'
} from '@typebot.io/lib/api'
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const user = await getAuthenticatedUser(req)

View File

@@ -1,6 +1,10 @@
import prisma from '@/lib/prisma'
import { NextApiRequest, NextApiResponse } from 'next'
import { badRequest, methodNotAllowed, notAuthenticated } from 'utils/api'
import {
badRequest,
methodNotAllowed,
notAuthenticated,
} from '@typebot.io/lib/api'
import { got } from 'got'
import { getAuthenticatedUser } from '@/features/auth/api'

View File

@@ -1,7 +1,11 @@
import { DashboardFolder, WorkspaceRole } from 'db'
import { DashboardFolder, WorkspaceRole } from '@typebot.io/prisma'
import prisma from '@/lib/prisma'
import { NextApiRequest, NextApiResponse } from 'next'
import { badRequest, methodNotAllowed, notAuthenticated } from 'utils/api'
import {
badRequest,
methodNotAllowed,
notAuthenticated,
} from '@typebot.io/lib/api'
import { getAuthenticatedUser } from '@/features/auth/api'
const handler = async (req: NextApiRequest, res: NextApiResponse) => {

View File

@@ -1,8 +1,8 @@
import { DashboardFolder } from 'db'
import { DashboardFolder } from '@typebot.io/prisma'
import prisma from '@/lib/prisma'
import { NextApiRequest, NextApiResponse } from 'next'
import { getAuthenticatedUser } from '@/features/auth/api'
import { methodNotAllowed, notAuthenticated } from 'utils/api'
import { methodNotAllowed, notAuthenticated } from '@typebot.io/lib/api'
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const user = await getAuthenticatedUser(req)

View File

@@ -1,8 +1,8 @@
import { NextApiRequest, NextApiResponse } from 'next'
import { createTransport } from 'nodemailer'
import { getAuthenticatedUser } from '@/features/auth/api'
import { notAuthenticated } from 'utils/api'
import { SmtpCredentials } from 'models'
import { notAuthenticated } from '@typebot.io/lib/api'
import { SmtpCredentials } from '@typebot.io/schemas'
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const user = await getAuthenticatedUser(req)

View File

@@ -1,7 +1,11 @@
import { NextApiRequest, NextApiResponse } from 'next'
import { drive } from '@googleapis/drive'
import { getAuthenticatedGoogleClient } from '@/lib/googleSheets'
import { badRequest, methodNotAllowed, notAuthenticated } from 'utils/api'
import {
badRequest,
methodNotAllowed,
notAuthenticated,
} from '@typebot.io/lib/api'
import { setUser } from '@sentry/nextjs'
import { getAuthenticatedUser } from '@/features/auth/api'

View File

@@ -1,8 +1,12 @@
import { NextApiRequest, NextApiResponse } from 'next'
import { GoogleSpreadsheet } from 'google-spreadsheet'
import { getAuthenticatedGoogleClient } from '@/lib/googleSheets'
import { isDefined } from 'utils'
import { badRequest, methodNotAllowed, notAuthenticated } from 'utils/api'
import { isDefined } from '@typebot.io/lib'
import {
badRequest,
methodNotAllowed,
notAuthenticated,
} from '@typebot.io/lib/api'
import { setUser } from '@sentry/nextjs'
import { getAuthenticatedUser } from '@/features/auth/api'

View File

@@ -1,5 +1,5 @@
import { NextApiRequest, NextApiResponse } from 'next'
import { methodNotAllowed } from 'utils/api'
import { methodNotAllowed } from '@typebot.io/lib/api'
const handler = (req: NextApiRequest, res: NextApiResponse) => {
if (req.method === 'POST') {

View File

@@ -1,5 +1,5 @@
import { NextApiRequest, NextApiResponse } from 'next'
import { methodNotAllowed } from 'utils/api'
import { methodNotAllowed } from '@typebot.io/lib/api'
const handler = (req: NextApiRequest, res: NextApiResponse) => {
if (req.method === 'POST') {

View File

@@ -1,6 +1,6 @@
import prisma from '@/lib/prisma'
import { NextApiRequest, NextApiResponse } from 'next'
import { methodNotAllowed, notAuthenticated } from 'utils/api'
import { methodNotAllowed, notAuthenticated } from '@typebot.io/lib/api'
import { getAuthenticatedUser } from '@/features/auth/api'
const handler = async (req: NextApiRequest, res: NextApiResponse) => {

View File

@@ -1,10 +1,14 @@
import prisma from '@/lib/prisma'
import { InputBlockType, PublicTypebot } from 'models'
import { InputBlockType, PublicTypebot } from '@typebot.io/schemas'
import { NextApiRequest, NextApiResponse } from 'next'
import { canPublishFileInput } from '@/utils/api/dbRules'
import { badRequest, methodNotAllowed, notAuthenticated } from 'utils/api'
import {
badRequest,
methodNotAllowed,
notAuthenticated,
} from '@typebot.io/lib/api'
import { getAuthenticatedUser } from '@/features/auth/api'
import { sendTelemetryEvents } from 'utils/telemetry/sendTelemetryEvent'
import { sendTelemetryEvents } from '@typebot.io/lib/telemetry/sendTelemetryEvent'
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const user = await getAuthenticatedUser(req)

View File

@@ -1,10 +1,14 @@
import prisma from '@/lib/prisma'
import { InputBlockType, PublicTypebot } from 'models'
import { InputBlockType, PublicTypebot } from '@typebot.io/schemas'
import { NextApiRequest, NextApiResponse } from 'next'
import { canPublishFileInput, canWriteTypebots } from '@/utils/api/dbRules'
import { getAuthenticatedUser } from '@/features/auth/api'
import { badRequest, methodNotAllowed, notAuthenticated } from 'utils/api'
import { sendTelemetryEvents } from 'utils/telemetry/sendTelemetryEvent'
import {
badRequest,
methodNotAllowed,
notAuthenticated,
} from '@typebot.io/lib/api'
import { sendTelemetryEvents } from '@typebot.io/lib/telemetry/sendTelemetryEvent'
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const user = await getAuthenticatedUser(req)

View File

@@ -5,7 +5,7 @@ import {
generatePresignedUrl,
methodNotAllowed,
notAuthenticated,
} from 'utils/api'
} from '@typebot.io/lib/api'
const handler = async (
req: NextApiRequest,

View File

@@ -4,11 +4,11 @@ import {
forbidden,
methodNotAllowed,
notAuthenticated,
} from 'utils/api'
} from '@typebot.io/lib/api'
import Stripe from 'stripe'
import { getAuthenticatedUser } from '@/features/auth/api'
import prisma from '@/lib/prisma'
import { WorkspaceRole } from 'db'
import { WorkspaceRole } from '@typebot.io/prisma'
// TO-DO: Delete
const handler = async (req: NextApiRequest, res: NextApiResponse) => {

View File

@@ -1,9 +1,9 @@
import { Plan } from 'db'
import { Plan } from '@typebot.io/prisma'
import prisma from '@/lib/prisma'
import { NextApiRequest, NextApiResponse } from 'next'
import { getAuthenticatedUser } from '@/features/auth/api'
import Stripe from 'stripe'
import { methodNotAllowed, notAuthenticated } from 'utils/api'
import { methodNotAllowed, notAuthenticated } from '@typebot.io/lib/api'
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const user = await getAuthenticatedUser(req)

View File

@@ -4,11 +4,11 @@ import {
forbidden,
methodNotAllowed,
notAuthenticated,
} from 'utils/api'
} from '@typebot.io/lib/api'
import Stripe from 'stripe'
import { getAuthenticatedUser } from '@/features/auth/api'
import prisma from '@/lib/prisma'
import { WorkspaceRole } from 'db'
import { WorkspaceRole } from '@typebot.io/prisma'
// TODO: Delete
const handler = async (req: NextApiRequest, res: NextApiResponse) => {

View File

@@ -1,15 +1,15 @@
import { NextApiRequest, NextApiResponse } from 'next'
import { isDefined } from 'utils'
import { isDefined } from '@typebot.io/lib'
import {
badRequest,
forbidden,
methodNotAllowed,
notAuthenticated,
} from 'utils/api'
} from '@typebot.io/lib/api'
import Stripe from 'stripe'
import { getAuthenticatedUser } from '@/features/auth/api'
import prisma from '@/lib/prisma'
import { Plan, WorkspaceRole } from 'db'
import { Plan, WorkspaceRole } from '@typebot.io/prisma'
// TODO: Delete
const handler = async (req: NextApiRequest, res: NextApiResponse) => {

View File

@@ -1,12 +1,12 @@
import { NextApiRequest, NextApiResponse } from 'next'
import { methodNotAllowed } from 'utils/api'
import { methodNotAllowed } from '@typebot.io/lib/api'
import Stripe from 'stripe'
import Cors from 'micro-cors'
import { buffer } from 'micro'
import prisma from '@/lib/prisma'
import { Plan } from 'db'
import { Plan } from '@typebot.io/prisma'
import { RequestHandler } from 'next/dist/server/next'
import { sendTelemetryEvents } from 'utils/telemetry/sendTelemetryEvent'
import { sendTelemetryEvents } from '@typebot.io/lib/telemetry/sendTelemetryEvent'
if (!process.env.STRIPE_SECRET_KEY || !process.env.STRIPE_WEBHOOK_SECRET)
throw new Error('STRIPE_SECRET_KEY or STRIPE_WEBHOOK_SECRET missing')

View File

@@ -1,4 +1,4 @@
import { Plan } from 'db'
import { Plan } from '@typebot.io/prisma'
import prisma from '@/lib/prisma'
import { NextApiRequest, NextApiResponse } from 'next'
import {
@@ -6,12 +6,12 @@ import {
methodNotAllowed,
notAuthenticated,
notFound,
} from 'utils/api'
} from '@typebot.io/lib/api'
import { getAuthenticatedUser } from '@/features/auth/api'
import { parseNewTypebot } from '@/features/dashboard'
import { NewTypebotProps } from '@/features/dashboard/api/parseNewTypebot'
import { omit } from 'utils'
import { sendTelemetryEvents } from 'utils/telemetry/sendTelemetryEvent'
import { omit } from '@typebot.io/lib'
import { sendTelemetryEvents } from '@typebot.io/lib/telemetry/sendTelemetryEvent'
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const user = await getAuthenticatedUser(req)

View File

@@ -1,11 +1,11 @@
import { CollaborationType, Prisma } from 'db'
import { CollaborationType, Prisma } from '@typebot.io/prisma'
import prisma from '@/lib/prisma'
import { NextApiRequest, NextApiResponse } from 'next'
import { methodNotAllowed, notAuthenticated } from 'utils/api'
import { methodNotAllowed, notAuthenticated } from '@typebot.io/lib/api'
import { getAuthenticatedUser } from '@/features/auth/api'
import { archiveResults } from '@/features/results/api'
import { Typebot } from 'models'
import { omit } from 'utils'
import { Typebot } from '@typebot.io/schemas'
import { omit } from '@typebot.io/lib'
import { getTypebot } from '@/features/typebot/api/utils/getTypebot'
import { isReadTypebotForbidden } from '@/features/typebot/api/utils/isReadTypebotForbidden'
import { removeTypebotOldProperties } from '@/features/typebot/api/utils/removeTypebotOldProperties'

View File

@@ -1,7 +1,7 @@
import { PublicTypebot } from 'models'
import { PublicTypebot } from '@typebot.io/schemas'
import prisma from '@/lib/prisma'
import { NextApiRequest, NextApiResponse } from 'next'
import { methodNotAllowed, notAuthenticated } from 'utils/api'
import { methodNotAllowed, notAuthenticated } from '@typebot.io/lib/api'
import { getAuthenticatedUser } from '@/features/auth/api'
import { canReadTypebots } from '@/utils/api/dbRules'

View File

@@ -1,9 +1,9 @@
import prisma from '@/lib/prisma'
import { Stats } from 'models'
import { Stats } from '@typebot.io/schemas'
import { NextApiRequest, NextApiResponse } from 'next'
import { canReadTypebots } from '@/utils/api/dbRules'
import { getAuthenticatedUser } from '@/features/auth/api'
import { methodNotAllowed, notAuthenticated } from 'utils/api'
import { methodNotAllowed, notAuthenticated } from '@typebot.io/lib/api'
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const user = await getAuthenticatedUser(req)

View File

@@ -2,7 +2,11 @@ import prisma from '@/lib/prisma'
import { NextApiRequest, NextApiResponse } from 'next'
import { canReadTypebots } from '@/utils/api/dbRules'
import { getAuthenticatedUser } from '@/features/auth/api'
import { methodNotAllowed, notAuthenticated, notFound } from 'utils/api'
import {
methodNotAllowed,
notAuthenticated,
notFound,
} from '@typebot.io/lib/api'
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const user = await getAuthenticatedUser(req)

View File

@@ -2,7 +2,7 @@ import prisma from '@/lib/prisma'
import { NextApiRequest, NextApiResponse } from 'next'
import { canReadTypebots } from '@/utils/api/dbRules'
import { getAuthenticatedUser } from '@/features/auth/api'
import { methodNotAllowed, notAuthenticated } from 'utils/api'
import { methodNotAllowed, notAuthenticated } from '@typebot.io/lib/api'
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const user = await getAuthenticatedUser(req)

View File

@@ -2,7 +2,7 @@ import prisma from '@/lib/prisma'
import { NextApiRequest, NextApiResponse } from 'next'
import { canEditGuests } from '@/utils/api/dbRules'
import { getAuthenticatedUser } from '@/features/auth/api'
import { methodNotAllowed, notAuthenticated } from 'utils/api'
import { methodNotAllowed, notAuthenticated } from '@typebot.io/lib/api'
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const user = await getAuthenticatedUser(req)

View File

@@ -1,4 +1,4 @@
import { CollaborationType, WorkspaceRole } from 'db'
import { CollaborationType, WorkspaceRole } from '@typebot.io/prisma'
import prisma from '@/lib/prisma'
import { NextApiRequest, NextApiResponse } from 'next'
import { canReadTypebots, canWriteTypebots } from '@/utils/api/dbRules'
@@ -7,10 +7,10 @@ import {
forbidden,
methodNotAllowed,
notAuthenticated,
} from 'utils/api'
} from '@typebot.io/lib/api'
import { getAuthenticatedUser } from '@/features/auth/api'
import { env } from 'utils'
import { sendGuestInvitationEmail } from 'emails'
import { env } from '@typebot.io/lib'
import { sendGuestInvitationEmail } from '@typebot.io/emails'
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const user = await getAuthenticatedUser(req)

View File

@@ -1,9 +1,9 @@
import { Invitation } from 'db'
import { Invitation } from '@typebot.io/prisma'
import prisma from '@/lib/prisma'
import { NextApiRequest, NextApiResponse } from 'next'
import { canEditGuests } from '@/utils/api/dbRules'
import { getAuthenticatedUser } from '@/features/auth/api'
import { methodNotAllowed, notAuthenticated } from 'utils/api'
import { methodNotAllowed, notAuthenticated } from '@typebot.io/lib/api'
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const user = await getAuthenticatedUser(req)

View File

@@ -1,8 +1,12 @@
import prisma from '@/lib/prisma'
import { defaultWebhookAttributes, Webhook } from 'models'
import { defaultWebhookAttributes, Webhook } from '@typebot.io/schemas'
import { NextApiRequest, NextApiResponse } from 'next'
import { getAuthenticatedUser } from '@/features/auth/api'
import { methodNotAllowed, notAuthenticated, notFound } from 'utils/api'
import {
methodNotAllowed,
notAuthenticated,
notFound,
} from '@typebot.io/lib/api'
import { getTypebot } from '@/features/typebot/api/utils/getTypebot'
const handler = async (req: NextApiRequest, res: NextApiResponse) => {

View File

@@ -1,5 +1,5 @@
import prisma from '@/lib/prisma'
import { Webhook } from 'models'
import { Webhook } from '@typebot.io/schemas'
import { NextApiRequest, NextApiResponse } from 'next'
import { getAuthenticatedUser } from '@/features/auth/api'
import {
@@ -8,9 +8,9 @@ import {
methodNotAllowed,
notAuthenticated,
notFound,
} from 'utils/api'
} from '@typebot.io/lib/api'
import { getTypebot } from '@/features/typebot/api/utils/getTypebot'
import { omit } from 'utils'
import { omit } from '@typebot.io/lib'
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const user = await getAuthenticatedUser(req)

View File

@@ -1,8 +1,8 @@
import prisma from '@/lib/prisma'
import { NextApiRequest, NextApiResponse } from 'next'
import { getAuthenticatedUser } from '@/features/auth/api'
import { methodNotAllowed, notAuthenticated } from 'utils/api'
import { User } from 'db'
import { methodNotAllowed, notAuthenticated } from '@typebot.io/lib/api'
import { User } from '@typebot.io/prisma'
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const user = await getAuthenticatedUser(req)

View File

@@ -1,8 +1,8 @@
import prisma from '@/lib/prisma'
import { NextApiRequest, NextApiResponse } from 'next'
import { getAuthenticatedUser } from '@/features/auth/api'
import { generateId } from 'utils'
import { methodNotAllowed, notAuthenticated } from 'utils/api'
import { generateId } from '@typebot.io/lib'
import { methodNotAllowed, notAuthenticated } from '@typebot.io/lib/api'
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const user = await getAuthenticatedUser(req)

View File

@@ -1,7 +1,7 @@
import prisma from '@/lib/prisma'
import { NextApiRequest, NextApiResponse } from 'next'
import { getAuthenticatedUser } from '@/features/auth/api'
import { methodNotAllowed, notAuthenticated } from 'utils/api'
import { methodNotAllowed, notAuthenticated } from '@typebot.io/lib/api'
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const user = await getAuthenticatedUser(req)

View File

@@ -1,11 +1,15 @@
import { WorkspaceInvitation, WorkspaceRole } from 'db'
import { WorkspaceInvitation, WorkspaceRole } from '@typebot.io/prisma'
import prisma from '@/lib/prisma'
import { NextApiRequest, NextApiResponse } from 'next'
import { forbidden, methodNotAllowed, notAuthenticated } from 'utils/api'
import {
forbidden,
methodNotAllowed,
notAuthenticated,
} from '@typebot.io/lib/api'
import { getAuthenticatedUser } from '@/features/auth/api'
import { sendWorkspaceMemberInvitationEmail } from 'emails'
import { env } from 'utils'
import { isSeatsLimitReached } from 'utils/pricing'
import { sendWorkspaceMemberInvitationEmail } from '@typebot.io/emails'
import { env } from '@typebot.io/lib'
import { isSeatsLimitReached } from '@typebot.io/lib/pricing'
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const user = await getAuthenticatedUser(req)

View File

@@ -1,8 +1,8 @@
import { WorkspaceInvitation, WorkspaceRole } from 'db'
import { WorkspaceInvitation, WorkspaceRole } from '@typebot.io/prisma'
import prisma from '@/lib/prisma'
import { NextApiRequest, NextApiResponse } from 'next'
import { getAuthenticatedUser } from '@/features/auth/api'
import { methodNotAllowed, notAuthenticated } from 'utils/api'
import { methodNotAllowed, notAuthenticated } from '@typebot.io/lib/api'
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const user = await getAuthenticatedUser(req)

View File

@@ -1,7 +1,11 @@
import prisma from '@/lib/prisma'
import { NextApiRequest, NextApiResponse } from 'next'
import { getAuthenticatedUser } from '@/features/auth/api'
import { methodNotAllowed, notAuthenticated, notFound } from 'utils/api'
import {
methodNotAllowed,
notAuthenticated,
notFound,
} from '@typebot.io/lib/api'
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const user = await getAuthenticatedUser(req)

View File

@@ -1,8 +1,8 @@
import { MemberInWorkspace, WorkspaceRole } from 'db'
import { MemberInWorkspace, WorkspaceRole } from '@typebot.io/prisma'
import prisma from '@/lib/prisma'
import { NextApiRequest, NextApiResponse } from 'next'
import { getAuthenticatedUser } from '@/features/auth/api'
import { methodNotAllowed, notAuthenticated } from 'utils/api'
import { methodNotAllowed, notAuthenticated } from '@typebot.io/lib/api'
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const user = await getAuthenticatedUser(req)

View File

@@ -1,7 +1,7 @@
import prisma from '@/lib/prisma'
import { NextApiRequest, NextApiResponse } from 'next'
import { getAuthenticatedUser } from '@/features/auth/api'
import { methodNotAllowed, notAuthenticated } from 'utils/api'
import { methodNotAllowed, notAuthenticated } from '@typebot.io/lib/api'
// TODO: Delete
const handler = async (req: NextApiRequest, res: NextApiResponse) => {