diff --git a/app/api/applications/org/route.ts b/app/api/applications/org/route.ts new file mode 100644 index 0000000..9914b73 --- /dev/null +++ b/app/api/applications/org/route.ts @@ -0,0 +1,63 @@ +export const runtime = "nodejs"; + +import { NextResponse } from "next/server"; +import { PrismaClient } from "@prisma/client"; + +const prisma = new PrismaClient(); + +export async function POST(request: Request) { + try { + const body = await request.json(); + + const { companyName, projectTitle, budget, description } = body; + + // Server validation + if (!companyName || !projectTitle || !budget || !description) { + return NextResponse.json( + { error: "Missing required fields" }, + { status: 400 }, + ); + } + + const parsedBudget = Number(String(budget).replace(/[^0-9.-]+/g, "")); + + if (isNaN(parsedBudget)) { + return NextResponse.json( + { error: "Budget must be a valid number" }, + { status: 400 }, + ); + } + + const application = await prisma.application.create({ + data: { + type: "ORG", + status: "PENDING", + + submitterName: companyName, + submitterEmail: "N/A", // must be non-null, can change later + + payload: { + companyName, + projectTitle, + budget: parsedBudget, + description, + }, + }, + }); + + return NextResponse.json( + { + success: true, + id: application.id, + }, + { status: 201 }, + ); + } catch (error) { + console.error(error); + + return NextResponse.json( + { error: "Failed to create application" }, + { status: 500 }, + ); + } +} diff --git a/app/apply/org/page.tsx b/app/apply/org/page.tsx index 6bb0fd5..318d415 100644 --- a/app/apply/org/page.tsx +++ b/app/apply/org/page.tsx @@ -5,9 +5,7 @@ export default function OrgApplyPage() { return (
-

- Organization Application -

+

Organization Application

Coming soon.

@@ -17,4 +15,3 @@ export default function OrgApplyPage() { ); } - diff --git a/app/apply/page.tsx b/app/apply/page.tsx index 1ac0232..20cbde4 100644 --- a/app/apply/page.tsx +++ b/app/apply/page.tsx @@ -13,13 +13,22 @@ export default function ApplyPage() {

Application Types

- + Startup Application - + Org Application - + Team Application
@@ -27,4 +36,4 @@ export default function ApplyPage() {
); -} \ No newline at end of file +} diff --git a/auth.ts b/auth.ts index b9e609a..46b75b7 100644 --- a/auth.ts +++ b/auth.ts @@ -7,4 +7,5 @@ export const { auth, handlers, signIn, signOut } = NextAuth({ strategy: "jwt", maxAge: 30 * 24 * 60 * 60, // 30 days }, + secret: process.env.AUTH_SECRET, }); diff --git a/components/layout/PublicLayout.tsx b/components/layout/PublicLayout.tsx index c32a11d..8c1f1d6 100644 --- a/components/layout/PublicLayout.tsx +++ b/components/layout/PublicLayout.tsx @@ -19,7 +19,7 @@ export default function PublicLayout({
{children}
); diff --git a/package-lock.json b/package-lock.json index 9e939c9..0408ace 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1024,6 +1024,7 @@ "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.58.2.tgz", "integrity": "sha512-akea+6bHYBBfA9uQqSYmlJXn61cTa+jbO87xVLCWbTqbWadRVmhxlXATaOjOgcBaWU4ePo0wB41KMFv3o35IXA==", "license": "Apache-2.0", + "peer": true, "dependencies": { "playwright": "1.58.2" }, @@ -1190,7 +1191,7 @@ "license": "MIT", "optional": true, "dependencies": { - "tslib": "^2.4.0" + "tslib": "^2.8.0" } }, "node_modules/@types/json5": { @@ -1223,6 +1224,7 @@ "integrity": "sha512-z9VXpC7MWrhfWipitjNdgCauoMLRdIILQsAEV+ZesIzBq/oUlxk0m3ApZuMFCXdnS4U7KrI+l3WRUEGQ8K1QKw==", "devOptional": true, "license": "MIT", + "peer": true, "dependencies": { "@types/prop-types": "*", "csstype": "^3.2.2" @@ -1288,6 +1290,7 @@ "integrity": "sha512-klQbnPAAiGYFyI02+znpBRLyjL4/BrBd0nyWkdC0s/6xFLkXYQ8OoRrSkqacS1ddVxf/LDyODIKbQ5TgKAf/Fg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@typescript-eslint/scope-manager": "8.56.1", "@typescript-eslint/types": "8.56.1", @@ -1768,6 +1771,7 @@ "integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==", "dev": true, "license": "MIT", + "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -2870,6 +2874,7 @@ "deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", @@ -3052,6 +3057,7 @@ "integrity": "sha512-whOE1HFo/qJDyX4SnXzP4N6zOWn79WhnCUY/iDR0mPfQZO8wcYE4JClzI2oZrhBnnMUCBCHZhO6VQyoBU95mZA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@rtsao/scc": "^1.1.0", "array-includes": "^3.1.9", @@ -5562,6 +5568,7 @@ } ], "license": "MIT", + "peer": true, "dependencies": { "nanoid": "^3.3.11", "picocolors": "^1.1.1", @@ -5710,6 +5717,7 @@ "resolved": "https://registry.npmjs.org/preact/-/preact-10.24.3.tgz", "integrity": "sha512-Z2dPnBnMUfyQfSQ+GBdsGa16hz35YmLmtTLhM169uW944hYL6xzTYkJjC07j+Wosz733pMWx0fgON3JNw1jJQA==", "license": "MIT", + "peer": true, "funding": { "type": "opencollective", "url": "https://opencollective.com/preact" @@ -5757,6 +5765,7 @@ "devOptional": true, "hasInstallScript": true, "license": "Apache-2.0", + "peer": true, "dependencies": { "@prisma/config": "6.19.2", "@prisma/engines": "6.19.2" @@ -5851,6 +5860,7 @@ "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", "license": "MIT", + "peer": true, "dependencies": { "loose-envify": "^1.1.0" }, @@ -5863,6 +5873,7 @@ "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz", "integrity": "sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==", "license": "MIT", + "peer": true, "dependencies": { "loose-envify": "^1.1.0", "scheduler": "^0.23.0" @@ -6805,6 +6816,7 @@ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=12" }, @@ -6986,6 +6998,7 @@ "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", "devOptional": true, "license": "Apache-2.0", + "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver"