From 7465550c5dfaf9b8f34e3d9adae25e62d6f9421f Mon Sep 17 00:00:00 2001 From: Luke Vella Date: Thu, 31 Oct 2024 22:32:18 +0000 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Move=20auth?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web/src/{utils => }/auth.ts | 4 ++-- apps/web/src/{utils => }/auth/custom-prisma-adapter.ts | 0 apps/web/src/{utils => }/auth/merge-user.ts | 0 apps/web/src/pages/[locale]/auth/disable-notifications.tsx | 2 +- apps/web/src/pages/api/auth/[...nextauth].ts | 4 ++-- apps/web/src/pages/api/stripe/checkout.ts | 2 +- apps/web/src/pages/api/stripe/portal.ts | 2 +- apps/web/src/pages/api/trpc/[trpc].ts | 2 +- apps/web/src/trpc/routers/auth.ts | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) rename apps/web/src/{utils => }/auth.ts (98%) rename apps/web/src/{utils => }/auth/custom-prisma-adapter.ts (100%) rename apps/web/src/{utils => }/auth/merge-user.ts (100%) diff --git a/apps/web/src/utils/auth.ts b/apps/web/src/auth.ts similarity index 98% rename from apps/web/src/utils/auth.ts rename to apps/web/src/auth.ts index aad41a650..d3ad42a25 100644 --- a/apps/web/src/utils/auth.ts +++ b/apps/web/src/auth.ts @@ -15,11 +15,11 @@ import GoogleProvider from "next-auth/providers/google"; import { Provider } from "next-auth/providers/index"; import { posthog } from "@/app/posthog"; +import { CustomPrismaAdapter } from "@/auth/custom-prisma-adapter"; +import { mergeGuestsIntoUser } from "@/auth/merge-user"; import { env } from "@/env"; import type { RegistrationTokenPayload } from "@/trpc/types"; import { absoluteUrl } from "@/utils/absolute-url"; -import { CustomPrismaAdapter } from "@/utils/auth/custom-prisma-adapter"; -import { mergeGuestsIntoUser } from "@/utils/auth/merge-user"; import { getEmailClient } from "@/utils/emails"; import { getValueByPath } from "@/utils/get-value-by-path"; import { generateOtp, randomid } from "@/utils/nanoid"; diff --git a/apps/web/src/utils/auth/custom-prisma-adapter.ts b/apps/web/src/auth/custom-prisma-adapter.ts similarity index 100% rename from apps/web/src/utils/auth/custom-prisma-adapter.ts rename to apps/web/src/auth/custom-prisma-adapter.ts diff --git a/apps/web/src/utils/auth/merge-user.ts b/apps/web/src/auth/merge-user.ts similarity index 100% rename from apps/web/src/utils/auth/merge-user.ts rename to apps/web/src/auth/merge-user.ts diff --git a/apps/web/src/pages/[locale]/auth/disable-notifications.tsx b/apps/web/src/pages/[locale]/auth/disable-notifications.tsx index dc3bc1594..c8fcdaa1e 100644 --- a/apps/web/src/pages/[locale]/auth/disable-notifications.tsx +++ b/apps/web/src/pages/[locale]/auth/disable-notifications.tsx @@ -2,7 +2,7 @@ import { prisma } from "@rallly/database"; import { GetServerSideProps } from "next"; import type { DisableNotificationsPayload } from "@/trpc/types"; -import { getServerSession } from "@/utils/auth"; +import { getServerSession } from "@/auth"; import { decryptToken } from "@/utils/session"; const Page = () => { diff --git a/apps/web/src/pages/api/auth/[...nextauth].ts b/apps/web/src/pages/api/auth/[...nextauth].ts index 4635d2726..09e252547 100644 --- a/apps/web/src/pages/api/auth/[...nextauth].ts +++ b/apps/web/src/pages/api/auth/[...nextauth].ts @@ -1,13 +1,13 @@ import type { NextApiRequest, NextApiResponse } from "next"; import { posthogApiHandler } from "@/app/posthog"; -import { AuthApiRoute } from "@/utils/auth"; +import { AuthApiRoute } from "@/auth"; import { composeApiHandlers } from "@/utils/next"; export default async function auth(req: NextApiRequest, res: NextApiResponse) { if (req.method === "HEAD") { res.status(200).end(); - res.setHeader('Content-Length', '0'); + res.setHeader("Content-Length", "0"); } else { return composeApiHandlers(AuthApiRoute, posthogApiHandler)(req, res); } diff --git a/apps/web/src/pages/api/stripe/checkout.ts b/apps/web/src/pages/api/stripe/checkout.ts index b4d1d08be..a1747989a 100644 --- a/apps/web/src/pages/api/stripe/checkout.ts +++ b/apps/web/src/pages/api/stripe/checkout.ts @@ -4,7 +4,7 @@ import { NextApiRequest, NextApiResponse } from "next"; import { z } from "zod"; import { absoluteUrl } from "@/utils/absolute-url"; -import { getServerSession } from "@/utils/auth"; +import { getServerSession } from "@/auth"; export const config = { edge: true, diff --git a/apps/web/src/pages/api/stripe/portal.ts b/apps/web/src/pages/api/stripe/portal.ts index 2458847ab..6c8576d69 100644 --- a/apps/web/src/pages/api/stripe/portal.ts +++ b/apps/web/src/pages/api/stripe/portal.ts @@ -4,7 +4,7 @@ import { NextApiRequest, NextApiResponse } from "next"; import { z } from "zod"; import { absoluteUrl } from "@/utils/absolute-url"; -import { getServerSession } from "@/utils/auth"; +import { getServerSession } from "@/auth"; const inputSchema = z.object({ session_id: z.string().optional(), diff --git a/apps/web/src/pages/api/trpc/[trpc].ts b/apps/web/src/pages/api/trpc/[trpc].ts index 9150fdb52..c823a833a 100644 --- a/apps/web/src/pages/api/trpc/[trpc].ts +++ b/apps/web/src/pages/api/trpc/[trpc].ts @@ -4,7 +4,7 @@ import { createNextApiHandler } from "@trpc/server/adapters/next"; import { posthogApiHandler } from "@/app/posthog"; import { AppRouter, appRouter } from "@/trpc/routers"; -import { getServerSession } from "@/utils/auth"; +import { getServerSession } from "@/auth"; import { getEmailClient } from "@/utils/emails"; import { composeApiHandlers } from "@/utils/next"; diff --git a/apps/web/src/trpc/routers/auth.ts b/apps/web/src/trpc/routers/auth.ts index 80e8102bf..b48fe65dc 100644 --- a/apps/web/src/trpc/routers/auth.ts +++ b/apps/web/src/trpc/routers/auth.ts @@ -2,7 +2,7 @@ import { prisma } from "@rallly/database"; import { z } from "zod"; import { posthog } from "@/app/posthog"; -import { isEmailBlocked } from "@/utils/auth"; +import { isEmailBlocked } from "@/auth"; import { generateOtp } from "@/utils/nanoid"; import { createToken, decryptToken } from "@/utils/session";