dj_goku
dj_goku
AEAsh Elixir
Created by dj_goku on 3/23/2023 in #showcase
Proof of Concept using Ash
Thank you for that reference!
10 replies
AEAsh Elixir
Created by dj_goku on 3/23/2023 in #showcase
Proof of Concept using Ash
I'll have to look at the docs more on actions and code_interface.
10 replies
AEAsh Elixir
Created by dj_goku on 3/23/2023 in #showcase
Proof of Concept using Ash
Thank you! The thing that held me up from trying those actions was how I would pass things into those actions.
10 replies
AEAsh Elixir
Created by dj_goku on 3/23/2023 in #showcase
Proof of Concept using Ash
Ok, thanks for the skim.
10 replies
AEAsh Elixir
Created by dj_goku on 3/22/2023 in #support
Does order matter in filtering resources?
Well now all my tests pass!
6 replies
AEAsh Elixir
Created by dj_goku on 3/22/2023 in #support
Does order matter in filtering resources?
FUBAR! UGH Thank you!
6 replies
AEAsh Elixir
Created by dj_goku on 3/20/2023 in #support
Calculate aggregations?
Have a good rest of your day/night Zach!
17 replies
AEAsh Elixir
Created by dj_goku on 3/20/2023 in #support
Calculate aggregations?
Ok, thanks! That is what I thought it would be! Phew. I think I am done. I'll share once I am done with this little project.
17 replies
AEAsh Elixir
Created by dj_goku on 3/20/2023 in #support
Calculate aggregations?
Well it is the combination of the aggregates and calculation!
17 replies
AEAsh Elixir
Created by dj_goku on 3/20/2023 in #support
Calculate aggregations?
expr(count_of_user_1_one_on_ones - count_of_user_2_one_on_ones)
17 replies
AEAsh Elixir
Created by dj_goku on 3/20/2023 in #support
Calculate aggregations?
AHHH
17 replies
AEAsh Elixir
Created by dj_goku on 3/20/2023 in #support
Calculate aggregations?
It is summing how many one_on_one where they were :user_1_id and subtracting that from the sum of one_on_one where they were :user_2_id
17 replies
AEAsh Elixir
Created by dj_goku on 3/20/2023 in #support
Calculate aggregations?
defmodule Mod.OneOnOne do
use Ash.Resource,
data_layer: AshPostgres.DataLayer

postgres do
table("one_on_one")
repo(Mod.Repo)
end

actions do
defaults([:create, :read, :update, :destroy])

update :assign do
accept([])

argument :user_1_id, :uuid do
allow_nil?(false)
end

argument :user_2_id, :uuid do
allow_nil?(false)
end

# change(manage_relationship(:user_1_id, :user, type: :append_and_remove))
# change(manage_relationship(:user_2_id, :user, type: :append_and_remove))
end
end

attributes do
uuid_primary_key(:id)
end

relationships do
belongs_to :user_1_id, User
belongs_to :user_2_id, User
end
end
defmodule Mod.OneOnOne do
use Ash.Resource,
data_layer: AshPostgres.DataLayer

postgres do
table("one_on_one")
repo(Mod.Repo)
end

actions do
defaults([:create, :read, :update, :destroy])

update :assign do
accept([])

argument :user_1_id, :uuid do
allow_nil?(false)
end

argument :user_2_id, :uuid do
allow_nil?(false)
end

# change(manage_relationship(:user_1_id, :user, type: :append_and_remove))
# change(manage_relationship(:user_2_id, :user, type: :append_and_remove))
end
end

attributes do
uuid_primary_key(:id)
end

relationships do
belongs_to :user_1_id, User
belongs_to :user_2_id, User
end
end
sum_one_on_one(user_1, :user_1_id) - sum_one_on_one(user_1, :user_2_id)
17 replies
AEAsh Elixir
Created by dj_goku on 3/20/2023 in #support
Postgres Table(s)
I can open a new support if you want. But I want to have I think a calculation where I sum one query, sum another query and then subtract sum_one minus sum_two. I would normally do this separately in a context with 2 functions. One that sums and then another than calls the sum function but then subtracts the two sums.
37 replies
AEAsh Elixir
Created by dj_goku on 3/20/2023 in #support
Postgres Table(s)
I have been all over the site tonight. LOL I have seen this page at least once.
37 replies
AEAsh Elixir
Created by dj_goku on 3/20/2023 in #support
Postgres Table(s)
phew, that is a lot to digest. 😄
37 replies
AEAsh Elixir
Created by dj_goku on 3/20/2023 in #support
Postgres Table(s)
I want to commit 3 resources since I don't want something dangling if one of the 3 resources aren't committed.
37 replies
AEAsh Elixir
Created by dj_goku on 3/20/2023 in #support
Postgres Table(s)
Thanks! you were right though, I couldn't use %User{}
37 replies
AEAsh Elixir
Created by dj_goku on 3/20/2023 in #support
Postgres Table(s)
Ok, it is hard to use the wrong uuid.
37 replies
AEAsh Elixir
Created by dj_goku on 3/20/2023 in #support
Postgres Table(s)
Oh, so then it would be better to do manage_relationship right?
37 replies