From 083ea5bd19172381bb53e95aaf98eaabef839c54 Mon Sep 17 00:00:00 2001 From: MohamedBassem Date: Tue, 6 Feb 2024 12:26:29 +0000 Subject: Move the web app into a subdir --- app/api/auth/[...nextauth]/route.tsx | 3 -- app/api/v1/links/route.ts | 60 --------------------------- app/favicon.ico | Bin 25931 -> 0 bytes app/globals.css | 76 ----------------------------------- app/layout.tsx | 22 ---------- app/page.tsx | 15 ------- 6 files changed, 176 deletions(-) delete mode 100644 app/api/auth/[...nextauth]/route.tsx delete mode 100644 app/api/v1/links/route.ts delete mode 100644 app/favicon.ico delete mode 100644 app/globals.css delete mode 100644 app/layout.tsx delete mode 100644 app/page.tsx (limited to 'app') diff --git a/app/api/auth/[...nextauth]/route.tsx b/app/api/auth/[...nextauth]/route.tsx deleted file mode 100644 index bfcda516..00000000 --- a/app/api/auth/[...nextauth]/route.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import { authHandler } from "@/lib/auth"; - -export { authHandler as GET, authHandler as POST } diff --git a/app/api/v1/links/route.ts b/app/api/v1/links/route.ts deleted file mode 100644 index 5be1018e..00000000 --- a/app/api/v1/links/route.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { authOptions } from "@/lib/auth"; -import prisma from "@/lib/prisma"; -import { ZNewBookmarkedLinkRequest, ZGetLinksResponse, ZBookmarkedLink } from "@/lib/types/api/links"; -import { getServerSession } from "next-auth"; -import { NextRequest, NextResponse } from "next/server"; - -export async function POST(request: NextRequest) { - // TODO: We probably should be using an API key here instead of the session; - const session = await getServerSession(authOptions); - if (!session) { - return new Response(null, { status: 401 }); - } - - const linkRequest = ZNewBookmarkedLinkRequest.safeParse(await request.json()); - - if (!linkRequest.success) { - return NextResponse.json({ - error: linkRequest.error.toString(), - }, { status: 400 }); - } - - const link = await prisma.bookmarkedLink.create({ - data: { - url: linkRequest.data.url, - userId: session.user.id, - } - }); - - let response: ZBookmarkedLink = { ...link }; - - return NextResponse.json(response, { status: 201 }); -} - -export async function GET() { - // TODO: We probably should be using an API key here instead of the session; - const session = await getServerSession(authOptions); - if (!session) { - return new Response(null, { status: 401 }); - } - const links = await prisma.bookmarkedLink.findMany({ - where: { - userId: session.user.id, - }, - select: { - id: true, - url: true, - createdAt: true, - details: { - select: { - title: true, - description: true, - imageUrl: true, - } - }, - } - }); - - let response: ZGetLinksResponse = { links }; - return NextResponse.json(response); -} diff --git a/app/favicon.ico b/app/favicon.ico deleted file mode 100644 index 718d6fea..00000000 Binary files a/app/favicon.ico and /dev/null differ diff --git a/app/globals.css b/app/globals.css deleted file mode 100644 index 6a757250..00000000 --- a/app/globals.css +++ /dev/null @@ -1,76 +0,0 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; - -@layer base { - :root { - --background: 0 0% 100%; - --foreground: 222.2 84% 4.9%; - - --card: 0 0% 100%; - --card-foreground: 222.2 84% 4.9%; - - --popover: 0 0% 100%; - --popover-foreground: 222.2 84% 4.9%; - - --primary: 222.2 47.4% 11.2%; - --primary-foreground: 210 40% 98%; - - --secondary: 210 40% 96.1%; - --secondary-foreground: 222.2 47.4% 11.2%; - - --muted: 210 40% 96.1%; - --muted-foreground: 215.4 16.3% 46.9%; - - --accent: 210 40% 96.1%; - --accent-foreground: 222.2 47.4% 11.2%; - - --destructive: 0 84.2% 60.2%; - --destructive-foreground: 210 40% 98%; - - --border: 214.3 31.8% 91.4%; - --input: 214.3 31.8% 91.4%; - --ring: 222.2 84% 4.9%; - - --radius: 0.5rem; - } - - .dark { - --background: 222.2 84% 4.9%; - --foreground: 210 40% 98%; - - --card: 222.2 84% 4.9%; - --card-foreground: 210 40% 98%; - - --popover: 222.2 84% 4.9%; - --popover-foreground: 210 40% 98%; - - --primary: 210 40% 98%; - --primary-foreground: 222.2 47.4% 11.2%; - - --secondary: 217.2 32.6% 17.5%; - --secondary-foreground: 210 40% 98%; - - --muted: 217.2 32.6% 17.5%; - --muted-foreground: 215 20.2% 65.1%; - - --accent: 217.2 32.6% 17.5%; - --accent-foreground: 210 40% 98%; - - --destructive: 0 62.8% 30.6%; - --destructive-foreground: 210 40% 98%; - - --border: 217.2 32.6% 17.5%; - --input: 217.2 32.6% 17.5%; - --ring: 212.7 26.8% 83.9%; - } -} - -@layer base { - * { - @apply border-border; - } - body { - @apply bg-background text-foreground; - } -} \ No newline at end of file diff --git a/app/layout.tsx b/app/layout.tsx deleted file mode 100644 index 3314e478..00000000 --- a/app/layout.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import type { Metadata } from "next"; -import { Inter } from "next/font/google"; -import "./globals.css"; - -const inter = Inter({ subsets: ["latin"] }); - -export const metadata: Metadata = { - title: "Create Next App", - description: "Generated by create next app", -}; - -export default function RootLayout({ - children, -}: Readonly<{ - children: React.ReactNode; -}>) { - return ( - - {children} - - ); -} diff --git a/app/page.tsx b/app/page.tsx deleted file mode 100644 index 2df40508..00000000 --- a/app/page.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { LoginButton } from "../components/auth/login"; -import { LogoutButton } from "../components/auth/logout"; - -export default function Home() { - return ( -
-
- -
-
- -
-
- ); -} -- cgit v1.2.3-70-g09d2