Extract Artists context
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
defmodule MusicLibraryWeb.ArtistLive.Show do
|
||||
use MusicLibraryWeb, :live_view
|
||||
|
||||
alias MusicLibrary.Records
|
||||
alias MusicLibrary.{Artists, Records}
|
||||
|
||||
@impl true
|
||||
def mount(_params, _session, socket) do
|
||||
@@ -10,7 +10,7 @@ defmodule MusicLibraryWeb.ArtistLive.Show do
|
||||
|
||||
@impl true
|
||||
def handle_params(%{"musicbrainz_id" => musicbrainz_id}, _, socket) do
|
||||
artist = Records.get_artist!(musicbrainz_id)
|
||||
artist = Artists.get_artist!(musicbrainz_id)
|
||||
|
||||
grouped_artist_records =
|
||||
musicbrainz_id
|
||||
@@ -24,7 +24,7 @@ defmodule MusicLibraryWeb.ArtistLive.Show do
|
||||
# TODO: make it a stream
|
||||
|> assign(:artist_records, grouped_artist_records)
|
||||
|> assign_async(:artist_info, fn ->
|
||||
with {:ok, artist_info} <- Records.get_artist_info(artist) do
|
||||
with {:ok, artist_info} <- Artists.get_artist_info(artist) do
|
||||
{:ok, %{artist_info: artist_info}}
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -3,7 +3,7 @@ defmodule MusicLibraryWeb.StatsLive.Index do
|
||||
|
||||
import MusicLibraryWeb.StatsLive.DataComponents
|
||||
|
||||
alias MusicLibrary.{Collection, Records, Wishlist}
|
||||
alias MusicLibrary.{Artists, Collection, Records, Wishlist}
|
||||
alias Records.Record
|
||||
|
||||
def mount(_params, _session, socket) do
|
||||
@@ -25,7 +25,7 @@ defmodule MusicLibraryWeb.StatsLive.Index do
|
||||
collected_release_ids = Collection.collected_release_ids(release_ids)
|
||||
wishlisted_release_ids = Wishlist.wishlisted_release_ids(release_ids)
|
||||
|
||||
artist_ids = Records.get_all_artist_ids()
|
||||
artist_ids = Artists.get_all_artist_ids()
|
||||
|
||||
if connected?(socket) do
|
||||
LastFm.Feed.subscribe()
|
||||
@@ -88,7 +88,7 @@ defmodule MusicLibraryWeb.StatsLive.Index do
|
||||
collected_release_ids = Collection.collected_release_ids(release_ids)
|
||||
wishlisted_release_ids = Wishlist.wishlisted_release_ids(release_ids)
|
||||
|
||||
artist_ids = Records.get_all_artist_ids()
|
||||
artist_ids = Artists.get_all_artist_ids()
|
||||
|
||||
{:noreply,
|
||||
socket
|
||||
|
||||
Reference in New Issue
Block a user