Skip to content

Commit

Permalink
Merge branch 'main' into dp/upgrade-guardian-controller
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsp45 committed Jan 11, 2024
2 parents cbb79be + dfa555b commit 17f2ff5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/bokken/events.ex
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,16 @@ defmodule Bokken.Events do
|> Map.fetch!(:events)
end

def list_events(%{"order" => order}) do
query =
if order == "asc",
do: from(e in Event, order_by: [asc: e.start_time]),
else: from(e in Event, order_by: [desc: e.start_time])

Repo.all(query)
|> Repo.preload([:location, :team])
end

def list_events(_args) do
Event
|> Repo.all()
Expand Down

0 comments on commit 17f2ff5

Please sign in to comment.