Improve relationship UI handling (#42)

* Added tabbed view; improved relationships for media profile

* Adds new maybe_limit method for queries

* Improves UI for media items, associated tasks
This commit is contained in:
Kieran
2024-02-29 18:35:51 -08:00
committed by GitHub
parent 7809a25f2d
commit be8bcf0eb2
16 changed files with 292 additions and 127 deletions
+29
View File
@@ -1,6 +1,9 @@
defmodule Pinchflat.RepoTest do
use Pinchflat.DataCase
import Pinchflat.ProfilesFixtures
alias Pinchflat.Repo
alias Pinchflat.Profiles.MediaProfile
alias Pinchflat.JobFixtures.TestJobWorker
describe "insert_unique_job/1" do
@@ -23,4 +26,30 @@ defmodule Pinchflat.RepoTest do
assert {:error, _} = Pinchflat.Repo.insert_unique_job(%Ecto.Changeset{})
end
end
describe "maybe_limit/2" do
test "applies a limit if provided" do
media_profile_fixture()
media_profile_fixture()
result =
MediaProfile
|> Repo.maybe_limit(1)
|> Repo.aggregate(:count, :id)
assert result == 1
end
test "does not apply a limit if not provided" do
media_profile_fixture()
media_profile_fixture()
result =
MediaProfile
|> Repo.maybe_limit(nil)
|> Repo.aggregate(:count, :id)
assert result == 2
end
end
end