feat(reports): allow reports to hold multiple events

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2023-06-05 18:32:29 +02:00
parent 538139eefa
commit f2ac3e2e5d
21 changed files with 185 additions and 104 deletions

View File

@@ -21,7 +21,7 @@ defmodule Mobilizon.Reports do
def get_report(id) do
Report
|> Repo.get(id)
|> Repo.preload([:reported, :reporter, :manager, :event, :comments, :notes])
|> Repo.preload([:reported, :reporter, :manager, :events, :comments, :notes])
end
@doc """
@@ -33,7 +33,7 @@ defmodule Mobilizon.Reports do
%Report{}
|> Report.changeset(attrs)
|> Repo.insert() do
{:ok, Repo.preload(report, [:event, :reported, :reporter, :comments])}
{:ok, Repo.preload(report, [:events, :reported, :reporter, :comments])}
end
end
@@ -102,7 +102,7 @@ defmodule Mobilizon.Reports do
@spec list_reports_query(atom()) :: Ecto.Query.t()
defp list_reports_query(status) do
Report
|> preload([:reported, :reporter, :manager, :event, :comments, :notes])
|> preload([:reported, :reporter, :manager, :events, :comments, :notes])
|> where([r], r.status == ^status)
end