Bananoid
Bananoid
AEAsh Elixir
Created by Bananoid on 8/30/2023 in #support
PGVector
Is it possible to use pgvector extension? https://github.com/pgvector/pgvector-elixir
5 replies
AEAsh Elixir
Created by Bananoid on 8/2/2023 in #support
Does Api.bulk_create support action's arguments?
I'm try to create items that are related to the workspace by using bulk_create
create :create do
primary? true
accept [:start, :result]

argument :workspace_id, :uuid do
allow_nil? false
end

change manage_relationship(:workspace_id, :workspace, type: :append_and_remove)
end
create :create do
primary? true
accept [:start, :result]

argument :workspace_id, :uuid do
allow_nil? false
end

change manage_relationship(:workspace_id, :workspace, type: :append_and_remove)
end
but I don't know how to pass workspace_id as an argument
19 replies
AEAsh Elixir
Created by Bananoid on 7/6/2023 in #support
How to create a second resource on a create action?
what is the best way yo create a second resource durning the creation of a first one? for example in a Workspace resource that should have a Wallet resource as has_one relationship
6 replies
AEAsh Elixir
Created by Bananoid on 7/5/2023 in #support
Many_to_many on email destination
I'm try to create a many to may relationship between a workspace and a user, using user email instead of the user id. But when i try to create the a WorkspaceUser I get an error:
** (Ash.Error.Invalid) Input Invalid

* Invalid value provided for user: cannot provide structs that don't match the destination.
(ash 2.9.21) lib/ash/api/api.ex:2077: Ash.Api.unwrap_or_raise!/3
iex:16: (file)
** (Ash.Error.Invalid) Input Invalid

* Invalid value provided for user: cannot provide structs that don't match the destination.
(ash 2.9.21) lib/ash/api/api.ex:2077: Ash.Api.unwrap_or_raise!/3
iex:16: (file)
The relation in Workspace is
many_to_many :users, User do
api Accounts.Api
through WorkspaceUser
source_attribute :id
source_attribute_on_join_resource :workspace_id
destination_attribute :email
destination_attribute_on_join_resource :email
validate_destination_attribute? false
end
many_to_many :users, User do
api Accounts.Api
through WorkspaceUser
source_attribute :id
source_attribute_on_join_resource :workspace_id
destination_attribute :email
destination_attribute_on_join_resource :email
validate_destination_attribute? false
end

In WorkspaceUser
relationships do
belongs_to :workspace, Workspace do
api Api
primary_key? true
allow_nil? false
# attribute_type :uuid
end

belongs_to :user, User do
api Accounts.Api
primary_key? true
allow_nil? false
# source_attribute :email
# destination_attribute :email
# attribute_type :ci_string
end
end
relationships do
belongs_to :workspace, Workspace do
api Api
primary_key? true
allow_nil? false
# attribute_type :uuid
end

belongs_to :user, User do
api Accounts.Api
primary_key? true
allow_nil? false
# source_attribute :email
# destination_attribute :email
# attribute_type :ci_string
end
end
The action that throw the error is
create :assign do
argument :workspace_id, :uuid do
allow_nil? false
end

argument :email, :ci_string do
allow_nil? false
end

accept [:role, :status]

change manage_relationship(:email, :user, type: :append_and_remove)
change manage_relationship(:workspace_id, :workspace, type: :append_and_remove)
end
create :assign do
argument :workspace_id, :uuid do
allow_nil? false
end

argument :email, :ci_string do
allow_nil? false
end

accept [:role, :status]

change manage_relationship(:email, :user, type: :append_and_remove)
change manage_relationship(:workspace_id, :workspace, type: :append_and_remove)
end
16 replies