-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
1,108 additions
and
134 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { NextRequest, NextResponse } from "next/server"; | ||
import { sendEmail } from "@/lib/firebase/database/email"; | ||
|
||
export async function POST(req: NextRequest) { | ||
try { | ||
const body = await req.json(); | ||
await sendEmail(body); | ||
return NextResponse.json({message: 'Emails successfully sent'}, {status: 200}); | ||
} catch (err) { | ||
console.error("Error in POST request:", err); | ||
return NextResponse.json({error: 'Error sending email'}, {status: 500}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { NextRequest, NextResponse } from 'next/server'; | ||
import { assignSurveys } from '@/lib/firebase/database/users'; | ||
|
||
export async function POST(req: NextRequest) { | ||
try { | ||
if (!req.body) { | ||
return NextResponse.json({ error: 'Missing Request Body' }, { status: 400 }); | ||
} | ||
|
||
// IMPORTANT: Assumes userIds, surveyIds are string arrays! | ||
const { userIds, surveyIds } = await req.json(); | ||
|
||
try { | ||
await assignSurveys(userIds, surveyIds); | ||
return NextResponse.json({ message: 'Successfully assigned Surveys'}, { status: 200 }); | ||
} catch { | ||
return NextResponse.json({ error: 'Error with Assigning Surveys' }, { status: 404 }); | ||
} | ||
|
||
} catch (error) { | ||
return NextResponse.json({ error: 'Failed to Load Data' }, { status: 500 }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { NextRequest, NextResponse } from 'next/server'; | ||
import { removeSurveys } from '@/lib/firebase/database/users'; | ||
|
||
export async function POST(req: NextRequest) { | ||
try { | ||
if (!req.body) { | ||
return NextResponse.json({ error: 'Missing Request Body' }, { status: 400 }); | ||
} | ||
|
||
// IMPORTANT: Assumes userIds, surveyIds are string arrays! | ||
const { userIds, surveyIds } = await req.json(); | ||
|
||
try { | ||
await removeSurveys(userIds, surveyIds); | ||
return NextResponse.json({ message: 'Successfully assigned Surveys'}, { status: 200 }); | ||
} catch { | ||
return NextResponse.json({ error: 'Error with Assigning Surveys' }, { status: 404 }); | ||
} | ||
|
||
} catch (error) { | ||
return NextResponse.json({ error: 'Failed to Load Data' }, { status: 500 }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.