📝 Introduce auto generate API doc
This commit is contained in:
@ -2,7 +2,7 @@ import { withSentry } from '@sentry/nextjs'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { Credentials } from 'models'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { getAuthenticatedUser } from '@/features/auth'
|
||||
import { getAuthenticatedUser } from '@/features/auth/api'
|
||||
import {
|
||||
badRequest,
|
||||
forbidden,
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { withSentry } from '@sentry/nextjs'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { getAuthenticatedUser } from '@/features/auth'
|
||||
import { getAuthenticatedUser } from '@/features/auth/api'
|
||||
import { badRequest, methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
|
@ -7,7 +7,7 @@ import { CredentialsType } from 'models'
|
||||
import { badRequest, encrypt, notAuthenticated } from 'utils/api'
|
||||
import { oauth2Client } from '@/lib/googleSheets'
|
||||
import { withSentry } from '@sentry/nextjs'
|
||||
import { getAuthenticatedUser } from '@/features/auth'
|
||||
import { getAuthenticatedUser } from '@/features/auth/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
const user = await getAuthenticatedUser(req)
|
||||
|
@ -3,7 +3,7 @@ import { CustomDomain } from 'db'
|
||||
import { got, HTTPError } from 'got'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { getAuthenticatedUser } from '@/features/auth'
|
||||
import { getAuthenticatedUser } from '@/features/auth/api'
|
||||
import {
|
||||
badRequest,
|
||||
forbidden,
|
||||
|
@ -3,7 +3,7 @@ import prisma from '@/lib/prisma'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { badRequest, methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||
import { got } from 'got'
|
||||
import { getAuthenticatedUser } from '@/features/auth'
|
||||
import { getAuthenticatedUser } from '@/features/auth/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
const user = await getAuthenticatedUser(req)
|
||||
|
@ -3,7 +3,7 @@ import { DashboardFolder, WorkspaceRole } from 'db'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { badRequest, methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||
import { getAuthenticatedUser } from '@/features/auth'
|
||||
import { getAuthenticatedUser } from '@/features/auth/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
const user = await getAuthenticatedUser(req)
|
||||
|
@ -2,7 +2,7 @@ import { withSentry } from '@sentry/nextjs'
|
||||
import { DashboardFolder } from 'db'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { getAuthenticatedUser } from '@/features/auth'
|
||||
import { getAuthenticatedUser } from '@/features/auth/api'
|
||||
import { methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
|
@ -2,7 +2,7 @@ import { captureException, withSentry } from '@sentry/nextjs'
|
||||
import { SmtpCredentialsData } from 'models'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { createTransport } from 'nodemailer'
|
||||
import { getAuthenticatedUser } from '@/features/auth'
|
||||
import { getAuthenticatedUser } from '@/features/auth/api'
|
||||
import { notAuthenticated } from 'utils/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
|
@ -3,7 +3,7 @@ import { drive } from '@googleapis/drive'
|
||||
import { getAuthenticatedGoogleClient } from '@/lib/googleSheets'
|
||||
import { badRequest, methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||
import { setUser, withSentry } from '@sentry/nextjs'
|
||||
import { getAuthenticatedUser } from '@/features/auth'
|
||||
import { getAuthenticatedUser } from '@/features/auth/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
const user = await getAuthenticatedUser(req)
|
||||
|
@ -4,7 +4,7 @@ import { getAuthenticatedGoogleClient } from '@/lib/googleSheets'
|
||||
import { isDefined } from 'utils'
|
||||
import { badRequest, methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||
import { withSentry, setUser } from '@sentry/nextjs'
|
||||
import { getAuthenticatedUser } from '@/features/auth'
|
||||
import { getAuthenticatedUser } from '@/features/auth/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
const user = await getAuthenticatedUser(req)
|
||||
|
@ -2,7 +2,7 @@ import { withSentry } from '@sentry/nextjs'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { badRequest, methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||
import { getAuthenticatedUser } from '@/features/auth'
|
||||
import { getAuthenticatedUser } from '@/features/auth/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
const user = await getAuthenticatedUser(req)
|
||||
|
@ -4,7 +4,7 @@ import { InputBlockType, PublicTypebot } from 'models'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { canPublishFileInput } from '@/utils/api/dbRules'
|
||||
import { badRequest, methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||
import { getAuthenticatedUser } from '@/features/auth'
|
||||
import { getAuthenticatedUser } from '@/features/auth/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
const user = await getAuthenticatedUser(req)
|
||||
|
@ -3,7 +3,7 @@ import prisma from '@/lib/prisma'
|
||||
import { InputBlockType, PublicTypebot } from 'models'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { canPublishFileInput, canWriteTypebot } from '@/utils/api/dbRules'
|
||||
import { getAuthenticatedUser } from '@/features/auth'
|
||||
import { getAuthenticatedUser } from '@/features/auth/api'
|
||||
import { badRequest, methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { withSentry } from '@sentry/nextjs'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { getAuthenticatedUser } from '@/features/auth'
|
||||
import { getAuthenticatedUser } from '@/features/auth/api'
|
||||
import {
|
||||
badRequest,
|
||||
generatePresignedUrl,
|
||||
|
@ -7,7 +7,7 @@ import {
|
||||
} from 'utils/api'
|
||||
import Stripe from 'stripe'
|
||||
import { withSentry } from '@sentry/nextjs'
|
||||
import { getAuthenticatedUser } from '@/features/auth'
|
||||
import { getAuthenticatedUser } from '@/features/auth/api'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { WorkspaceRole } from 'db'
|
||||
|
||||
|
@ -2,7 +2,7 @@ import { withSentry } from '@sentry/nextjs'
|
||||
import { Plan } from 'db'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { getAuthenticatedUser } from '@/features/auth'
|
||||
import { getAuthenticatedUser } from '@/features/auth/api'
|
||||
import Stripe from 'stripe'
|
||||
import { methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||
|
||||
|
@ -7,7 +7,7 @@ import {
|
||||
} from 'utils/api'
|
||||
import Stripe from 'stripe'
|
||||
import { withSentry } from '@sentry/nextjs'
|
||||
import { getAuthenticatedUser } from '@/features/auth'
|
||||
import { getAuthenticatedUser } from '@/features/auth/api'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { WorkspaceRole } from 'db'
|
||||
|
||||
|
@ -8,7 +8,7 @@ import {
|
||||
} from 'utils/api'
|
||||
import Stripe from 'stripe'
|
||||
import { withSentry } from '@sentry/nextjs'
|
||||
import { getAuthenticatedUser } from '@/features/auth'
|
||||
import { getAuthenticatedUser } from '@/features/auth/api'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { Plan, WorkspaceRole } from 'db'
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { createContext } from '@/utils/server/context'
|
||||
import { appRouter } from '@/utils/server/routers/_app'
|
||||
import { appRouter } from '@/utils/server/routers/v1/_app'
|
||||
import { createNextApiHandler } from '@trpc/server/adapters/next'
|
||||
|
||||
export default createNextApiHandler({
|
||||
|
@ -8,7 +8,7 @@ import {
|
||||
notAuthenticated,
|
||||
notFound,
|
||||
} from 'utils/api'
|
||||
import { getAuthenticatedUser } from '@/features/auth'
|
||||
import { getAuthenticatedUser } from '@/features/auth/api'
|
||||
import { parseNewTypebot } from '@/features/dashboard'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
|
@ -4,7 +4,7 @@ import prisma from '@/lib/prisma'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { canReadTypebot, canWriteTypebot } from '@/utils/api/dbRules'
|
||||
import { methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||
import { getAuthenticatedUser } from '@/features/auth'
|
||||
import { getAuthenticatedUser } from '@/features/auth/api'
|
||||
import { archiveResults } from '@/features/results/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
|
@ -3,7 +3,7 @@ import prisma from '@/lib/prisma'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||
import { withSentry } from '@sentry/nextjs'
|
||||
import { getAuthenticatedUser } from '@/features/auth'
|
||||
import { getAuthenticatedUser } from '@/features/auth/api'
|
||||
import { canReadTypebot } from '@/utils/api/dbRules'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
|
@ -3,7 +3,7 @@ import prisma from '@/lib/prisma'
|
||||
import { Stats } from 'models'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { canReadTypebot } from '@/utils/api/dbRules'
|
||||
import { getAuthenticatedUser } from '@/features/auth'
|
||||
import { getAuthenticatedUser } from '@/features/auth/api'
|
||||
import { methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
|
@ -2,7 +2,7 @@ import { withSentry } from '@sentry/nextjs'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { canReadTypebot } from '@/utils/api/dbRules'
|
||||
import { getAuthenticatedUser } from '@/features/auth'
|
||||
import { getAuthenticatedUser } from '@/features/auth/api'
|
||||
import { methodNotAllowed, notAuthenticated, notFound } from 'utils/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
|
@ -2,7 +2,7 @@ import { withSentry } from '@sentry/nextjs'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { canReadTypebot } from '@/utils/api/dbRules'
|
||||
import { getAuthenticatedUser } from '@/features/auth'
|
||||
import { getAuthenticatedUser } from '@/features/auth/api'
|
||||
import { methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
|
@ -2,7 +2,7 @@ import { withSentry } from '@sentry/nextjs'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { canEditGuests } from '@/utils/api/dbRules'
|
||||
import { getAuthenticatedUser } from '@/features/auth'
|
||||
import { getAuthenticatedUser } from '@/features/auth/api'
|
||||
import { methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
|
@ -9,7 +9,7 @@ import {
|
||||
methodNotAllowed,
|
||||
notAuthenticated,
|
||||
} from 'utils/api'
|
||||
import { getAuthenticatedUser } from '@/features/auth'
|
||||
import { getAuthenticatedUser } from '@/features/auth/api'
|
||||
import { env } from 'utils'
|
||||
import { sendGuestInvitationEmail } from 'emails'
|
||||
|
||||
|
@ -3,7 +3,7 @@ import { Invitation } from 'db'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { canEditGuests } from '@/utils/api/dbRules'
|
||||
import { getAuthenticatedUser } from '@/features/auth'
|
||||
import { getAuthenticatedUser } from '@/features/auth/api'
|
||||
import { methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
|
@ -3,7 +3,7 @@ import prisma from '@/lib/prisma'
|
||||
import { defaultWebhookAttributes } from 'models'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { canWriteTypebot } from '@/utils/api/dbRules'
|
||||
import { getAuthenticatedUser } from '@/features/auth'
|
||||
import { getAuthenticatedUser } from '@/features/auth/api'
|
||||
import { forbidden, methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { withSentry } from '@sentry/nextjs'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { getAuthenticatedUser } from '@/features/auth'
|
||||
import { getAuthenticatedUser } from '@/features/auth/api'
|
||||
import { methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { withSentry } from '@sentry/nextjs'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { getAuthenticatedUser } from '@/features/auth'
|
||||
import { getAuthenticatedUser } from '@/features/auth/api'
|
||||
import { generateId } from 'utils'
|
||||
import { methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { withSentry } from '@sentry/nextjs'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { getAuthenticatedUser } from '@/features/auth'
|
||||
import { getAuthenticatedUser } from '@/features/auth/api'
|
||||
import { methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { createContext } from '@/utils/server/context'
|
||||
import { appRouter } from '@/utils/server/routers/_app'
|
||||
import { appRouter } from '@/utils/server/routers/v1/_app'
|
||||
import { createOpenApiNextHandler } from 'trpc-openapi'
|
||||
|
||||
export default createOpenApiNextHandler({
|
@ -2,7 +2,7 @@ import { withSentry } from '@sentry/nextjs'
|
||||
import { CollaborationType } from 'db'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { getAuthenticatedUser } from '@/features/auth'
|
||||
import { getAuthenticatedUser } from '@/features/auth/api'
|
||||
import {
|
||||
badRequest,
|
||||
forbidden,
|
||||
|
@ -3,7 +3,7 @@ import { Plan, Workspace } from 'db'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||
import { getAuthenticatedUser } from '@/features/auth'
|
||||
import { getAuthenticatedUser } from '@/features/auth/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
const user = await getAuthenticatedUser(req)
|
||||
|
@ -2,7 +2,7 @@ import { withSentry } from '@sentry/nextjs'
|
||||
import { Prisma, Workspace, WorkspaceRole } from 'db'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { getAuthenticatedUser } from '@/features/auth'
|
||||
import { getAuthenticatedUser } from '@/features/auth/api'
|
||||
import { methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
|
@ -3,7 +3,7 @@ import { Workspace, WorkspaceInvitation, WorkspaceRole } from 'db'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { forbidden, methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||
import { getAuthenticatedUser } from '@/features/auth'
|
||||
import { getAuthenticatedUser } from '@/features/auth/api'
|
||||
import { env, getSeatsLimit } from 'utils'
|
||||
import { sendWorkspaceMemberInvitationEmail } from 'emails'
|
||||
|
||||
|
@ -2,7 +2,7 @@ import { withSentry } from '@sentry/nextjs'
|
||||
import { WorkspaceInvitation, WorkspaceRole } from 'db'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { getAuthenticatedUser } from '@/features/auth'
|
||||
import { getAuthenticatedUser } from '@/features/auth/api'
|
||||
import { methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { withSentry } from '@sentry/nextjs'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { getAuthenticatedUser } from '@/features/auth'
|
||||
import { getAuthenticatedUser } from '@/features/auth/api'
|
||||
import { methodNotAllowed, notAuthenticated, notFound } from 'utils/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
|
@ -2,7 +2,7 @@ import { withSentry } from '@sentry/nextjs'
|
||||
import { MemberInWorkspace, WorkspaceRole } from 'db'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { getAuthenticatedUser } from '@/features/auth'
|
||||
import { getAuthenticatedUser } from '@/features/auth/api'
|
||||
import { methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { withSentry } from '@sentry/nextjs'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import { getAuthenticatedUser } from '@/features/auth'
|
||||
import { getAuthenticatedUser } from '@/features/auth/api'
|
||||
import { methodNotAllowed, notAuthenticated } from 'utils/api'
|
||||
|
||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
|
Reference in New Issue
Block a user