sriky27
sriky27
AEAsh Elixir
Created by sriky27 on 6/5/2023 in #support
Possibility to have prepare statement for create, update, delete actions
Hi Zach Question I see that there a possibility to have a prepare statement for the read action but not for the others. Is there a possibility to add them in the future. If not what was the reasoning for it. Reason for asking was to inject the cache for all the actions Thanks Srikanth
4 replies
AEAsh Elixir
Created by sriky27 on 4/14/2023 in #support
cross_join on a Ash.Query
Hi I am able to do a cross_join on a Ecto.Query style. I am not able to convert to the Ecto.Query -> Ash.Query o r I am not able to perfrom Ecto.Query.from style cross_join on the Ash.Query in the prepare fn. Please advise.
17 replies
AEAsh Elixir
Created by sriky27 on 3/13/2023 in #support
Cache layer to Ash rest api
Hi How could we add the cache layers tot he Ash rest api end points. Any suggestions. -Sriky
7 replies
AEAsh Elixir
Created by sriky27 on 3/13/2023 in #support
Exdocs for Ash rest api
Hi Is there a recommended way to document the JsonApi in Ash. Should we use the ex_docs, where the end points are declared. Or are there any other recommendations. -Sriky
7 replies
AEAsh Elixir
Created by sriky27 on 2/21/2023 in #support
query filter with fragment issues
HI I am trying to do the following
read :time_slots do
argument :start_date, :utc_datetime do
allow_nil?(false)
end

argument :end_date, :utc_datetime do
allow_nil?(false)
end

argument :duration, :integer do
allow_nil?(true)
end

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

prepare(fn query, _ ->
start_date = Ash.Query.get_argument(query, :start_date)
end_date = Ash.Query.get_argument(query, :end_date)
duration = Ash.Query.get_argument(query, :duration)
qresource_id = Ash.Query.get_argument(query, :resource_id)

query
|> Ash.Query.filter(
fragment(
"""
SELECT DISTINCT start_at FROM reservation_items e cross join generate_series(?::timestamp , ?::timestamp, '30 min'::interval) as t
WHERE tsrange(e.start_at, e.end_at) @> t AND NOT(e.canceled) AND e.resource_id = ?;
""",
start_date,
end_date,
qresource_id
)
)
end)
end
read :time_slots do
argument :start_date, :utc_datetime do
allow_nil?(false)
end

argument :end_date, :utc_datetime do
allow_nil?(false)
end

argument :duration, :integer do
allow_nil?(true)
end

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

prepare(fn query, _ ->
start_date = Ash.Query.get_argument(query, :start_date)
end_date = Ash.Query.get_argument(query, :end_date)
duration = Ash.Query.get_argument(query, :duration)
qresource_id = Ash.Query.get_argument(query, :resource_id)

query
|> Ash.Query.filter(
fragment(
"""
SELECT DISTINCT start_at FROM reservation_items e cross join generate_series(?::timestamp , ?::timestamp, '30 min'::interval) as t
WHERE tsrange(e.start_at, e.end_at) @> t AND NOT(e.canceled) AND e.resource_id = ?;
""",
start_date,
end_date,
qresource_id
)
)
end)
end
I am getting invalid argument :resource_id
9 replies
AEAsh Elixir
Created by sriky27 on 2/19/2023 in #support
custom statement constraint
Hi How do I check for the constraint defined in the custom statement. Like the one defined here https://discord.com/channels/711271361523351632/1071850815872040961/1071883244410253433 Any suggestions and tips would be great. Thanks for your help. -Sriky
12 replies