@@ -77,6 +77,13 @@ defmodule Eventos.Events do
|
||||
Repo.get_by(Event, url: url)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Gets an event by it's UUID
|
||||
"""
|
||||
def get_event_by_uuid(uuid) do
|
||||
Repo.get_by(Event, uuid: uuid)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Gets a single event, with all associations loaded.
|
||||
"""
|
||||
@@ -93,6 +100,14 @@ defmodule Eventos.Events do
|
||||
Repo.preload(event, [:organizer_actor, :category, :sessions, :tracks, :tags, :participants, :address])
|
||||
end
|
||||
|
||||
@doc """
|
||||
Gets a full event by it's UUID
|
||||
"""
|
||||
def get_event_full_by_uuid(uuid) do
|
||||
event = Repo.get_by(Event, uuid: uuid)
|
||||
Repo.preload(event, [:organizer_actor, :category, :sessions, :tracks, :tags, :participants, :address])
|
||||
end
|
||||
|
||||
@spec get_event_full_by_name_and_slug!(String.t, String.t) :: Event.t
|
||||
def get_event_full_by_name_and_slug!(name, slug) do
|
||||
query = case String.split(name, "@") do
|
||||
@@ -139,7 +154,8 @@ defmodule Eventos.Events do
|
||||
def create_event(attrs \\ %{}) do
|
||||
%Event{}
|
||||
|> Event.changeset(attrs)
|
||||
|> Repo.insert()
|
||||
|> Repo.insert!()
|
||||
|> Repo.preload([:organizer_actor])
|
||||
end
|
||||
|
||||
@doc """
|
||||
|
||||
Reference in New Issue
Block a user