Skip to content

Commit

Permalink
Upcoming Events API
Browse files Browse the repository at this point in the history
  • Loading branch information
silasary committed Nov 5, 2023
1 parent 11785d6 commit 792e19b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions gatherling/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,22 @@
}
break;

case 'upcoming_events':
$events = [];
$db = Database::getConnection();
$query = $db->query('SELECT e.name as name FROM events e
WHERE e.start > NOW()
ORDER BY e.start ASC');
while ($row = $query->fetch_assoc()) {
$events[] = $row['name'];
}
$query->close();
foreach ($events as $eventname) {
$event = new Event($eventname);
$result[$event->name] = repr_json_event($event);
}
break;

case 'create_series':
$series = $_REQUEST['series'];
$active = true;
Expand Down

0 comments on commit 792e19b

Please sign in to comment.