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