hooked up create event

This commit is contained in:
2025-11-27 13:08:33 -05:00
parent 4dc121c018
commit 81716d4a4f
6 changed files with 80 additions and 51 deletions

View File

@@ -1,5 +1,5 @@
import { Request, Response } from "express";
import { getEventAttendance, getEventDetails, getShortEventsInRange, setAttendanceStatus } from "../services/calendarService";
import { createEvent, getEventAttendance, getEventDetails, getShortEventsInRange, setAttendanceStatus } from "../services/calendarService";
import { CalendarAttendance, CalendarEvent } from "@app/shared/types/calendar";
const express = require('express');
@@ -63,9 +63,18 @@ r.get('/:id', async (req: Request, res: Response) => {
})
//post a new calendar event
r.post('/', async (req, res) => {
//post a new calendar event
r.post('/', async (req: Request, res: Response) => {
try {
const member = req.user.id;
let event: CalendarEvent = req.body;
console.log(event);
createEvent(event);
res.sendStatus(200);
} catch (error) {
console.error('Failed to create event:', error);
res.status(500).json(error);
}
})
module.exports.calendarRouter = r;