Fix front-end, allow events to be created by a group, allow to get sessions from an event
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -32,6 +32,7 @@ defmodule Eventos.Groups.Group do
|
||||
"""
|
||||
use Ecto.Schema
|
||||
import Ecto.Changeset
|
||||
alias Eventos.Events.Event
|
||||
alias Eventos.Groups.{Group, Member, Request}
|
||||
alias Eventos.Accounts.Account
|
||||
alias Eventos.Groups.Group.TitleSlug
|
||||
@@ -43,7 +44,8 @@ defmodule Eventos.Groups.Group do
|
||||
field :slug, TitleSlug.Type
|
||||
field :uri, :string
|
||||
field :url, :string
|
||||
many_to_many :accounts, Account, join_through: Member
|
||||
many_to_many :members, Account, join_through: Member
|
||||
has_many :organized_events, Event, [foreign_key: :organizer_group_id]
|
||||
has_many :requests, Request
|
||||
|
||||
timestamps()
|
||||
|
||||
@@ -37,6 +37,14 @@ defmodule Eventos.Groups do
|
||||
"""
|
||||
def get_group!(id), do: Repo.get!(Group, id)
|
||||
|
||||
@doc """
|
||||
Gets a single group, with all associations loaded.
|
||||
"""
|
||||
def get_group_full!(id) do
|
||||
group = Repo.get!(Group, id)
|
||||
Repo.preload(group, [:members, :organized_events])
|
||||
end
|
||||
|
||||
@doc """
|
||||
Creates a group.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user