read :feed do description "Get the feed of tweets for a user" argument :user_id, :uuid do allow_nil? false end prepare build(load: [:items], sort: [item_order: :asc]) filter expr(visible_to(user_id: arg(:user_id))) end----------------- relationships do has_many :items, Tweet.Tweets.Item end--------------- aggregates do first :item_order, :items, :row_order
read :feed do description "Get the feed of tweets for a user" argument :user_id, :uuid do allow_nil? false end prepare build(load: [:items], sort: [item_order: :asc]) filter expr(visible_to(user_id: arg(:user_id))) end----------------- relationships do has_many :items, Tweet.Tweets.Item end--------------- aggregates do first :item_order, :items, :row_order
item.ex
attributes do attribute :row_order, :integer do allow_nil? true end
attributes do attribute :row_order, :integer do allow_nil? true end
liveview file
defp assign_twees(socket) do tweets = Tweets.Tweet.feed!(socket.assigns.current_user.id, load: tweet_load(socket.assigns.current_user) ) ... defp tweet_load(current_user) do [ :author_email, :author, items: [ :sum_item_count, ] ] end
defp assign_twees(socket) do tweets = Tweets.Tweet.feed!(socket.assigns.current_user.id, load: tweet_load(socket.assigns.current_user) ) ... defp tweet_load(current_user) do [ :author_email, :author, items: [ :sum_item_count, ] ] end
The Elixir backend framework for unparalleled productivity. Declarative tools that let you stop wasting time. Use with Phoenix LiveView or build APIs in minutes for your front-end of choice.