feat: add calendar event deletion with confirmation
All checks were successful
Deploy / deploy (push) Successful in 4m37s

This commit is contained in:
Cosmo
2026-04-22 18:28:13 +00:00
parent 000e25ddb1
commit 4874466985
2 changed files with 77 additions and 2 deletions

View File

@@ -145,3 +145,31 @@ export async function POST(req: Request) {
return NextResponse.json({ error: err.message || 'Failed to create event' }, { status: 500 })
}
}
export async function DELETE(req: Request) {
const { searchParams } = new URL(req.url)
const eventId = searchParams.get('eventId')
const calendarId = searchParams.get('calendarId')
if (!eventId) {
return NextResponse.json({ error: 'eventId is required' }, { status: 400 })
}
const auth = getAuth(false)
if (!auth) {
return NextResponse.json({ error: 'not_configured' }, { status: 500 })
}
const targetCalendarId = calendarId || process.env.DANIIL_CALENDAR_ID || 'daniilklimov25@gmail.com'
const calendarClient = google.calendar({ version: 'v3', auth: auth as any })
try {
await calendarClient.events.delete({
calendarId: targetCalendarId,
eventId,
})
return NextResponse.json({ success: true })
} catch (err: any) {
return NextResponse.json({ error: err.message || 'Failed to delete event' }, { status: 500 })
}
}