-
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.
feat(meeting): ✨ setting up new schema
- Loading branch information
Showing
2 changed files
with
136 additions
and
0 deletions.
There are no files selected for viewing
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,39 @@ | ||
import { PrismaClient } from "@prisma/client"; | ||
|
||
const prisma = new PrismaClient(); | ||
|
||
export async function POST({ request }: { request: Request }) { | ||
const body = await request.json(); | ||
|
||
try { | ||
// Update a meeting in the database | ||
const updatedMeeting = await prisma.meeting.create({ | ||
data: { | ||
title: body.title, | ||
description: body.description, | ||
startTime: body.startTime, | ||
endTime: body.endTime, | ||
location: body.location, | ||
hostId: body.hostId, | ||
created_at: Math.floor(Date.now() / 1000), | ||
}, | ||
}); | ||
return new Response( | ||
JSON.stringify({ message: "Meeting was updated successfully", updatedMeeting }), | ||
{ | ||
status: 200, | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
}, | ||
); | ||
} catch (error) { | ||
console.error("error", error); | ||
return new Response(JSON.stringify({ error: "Failed to create the meeting" }), { | ||
status: 500, | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
}); | ||
} | ||
} |