hooked up create event
This commit is contained in:
@@ -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;
|
||||
Reference in New Issue
Block a user