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,11 +1,12 @@
import pool from '../db';
import { CalendarEventShort, CalendarSignup, CalendarEvent, CalendarAttendance } from "@app/shared/types/calendar"
import { toDateTime } from "@app/shared/utils/time"
export async function createEvent(eventObject: Omit<CalendarEvent, 'id' | 'created_at' | 'updated_at' | 'cancelled'>) {
const sql = `
INSERT INTO calendar_events
(name, start, end, location, color, description, creator)
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
VALUES (?, ?, ?, ?, ?, ?, ?)
`;
const params = [
eventObject.name,
@@ -40,8 +41,8 @@ export async function updateEvent(eventObject: CalendarEvent) {
const params = [
eventObject.name,
eventObject.start,
eventObject.end,
toDateTime(eventObject.start),
toDateTime(eventObject.end),
eventObject.location,
eventObject.color,
eventObject.description ?? null,