Files
wanderer/lib/wanderer_app/api/user_activity.ex
Dmitry Popov cb41a33546 Custom signatures (#37)
* feat(signatures): Add custom info to system signatures

* feat(connections): Add custom info to system connections

* feat(Map): Add system signature type

* feat(Map): Update wormhole types info

* feat(Map): Add undo action for removed systems

* feat(Map): Delete systems on Backspace hotkey

* feat(Map): Update k-space systems background & styles

* feat(Map): Update systems status background styles

* feat(Map): add support for new wh type data. add signatures settings modal menu; reworked signatures widget - was added info of wormhole;

---------

Co-authored-by: achichenkov <aleksei.chichenkov@telleqt.ai>
2024-10-24 13:10:17 +04:00

126 lines
2.5 KiB
Elixir

defmodule WandererApp.Api.UserActivity do
@moduledoc false
use Ash.Resource,
domain: WandererApp.Api,
data_layer: AshPostgres.DataLayer
postgres do
repo(WandererApp.Repo)
table("user_activity_v1")
custom_indexes do
index [:entity_id, :event_type, :inserted_at], unique: true
end
end
code_interface do
define(:new, action: :new)
define(:read, action: :read)
end
actions do
default_accept [
:entity_id,
:entity_type,
:event_type,
:event_data
]
defaults [:create, :update, :destroy]
read :read do
primary?(true)
pagination(offset?: true, keyset?: true)
end
create :new do
accept [:entity_id, :entity_type, :event_type, :event_data]
primary?(true)
argument :user_id, :uuid, allow_nil?: false
argument :character_id, :uuid, allow_nil?: true
change manage_relationship(:user_id, :user, on_lookup: :relate, on_no_match: nil)
change manage_relationship(:character_id, :character, on_lookup: :relate, on_no_match: nil)
end
destroy :archive do
soft? false
end
end
attributes do
uuid_primary_key :id
attribute :entity_id, :string do
allow_nil? false
end
attribute :entity_type, :atom do
default "map"
constraints(
one_of: [
:map,
:access_list
]
)
allow_nil?(false)
end
attribute :event_type, :atom do
default "custom"
constraints(
one_of: [
:custom,
:hub_added,
:hub_removed,
:system_added,
:systems_removed,
:system_updated,
:character_added,
:character_removed,
:character_updated,
:map_added,
:map_removed,
:map_updated,
:map_acl_added,
:map_acl_removed,
:map_acl_updated,
:map_acl_member_added,
:map_acl_member_removed,
:map_acl_member_updated,
:map_connection_added,
:map_connection_updated,
:map_connection_removed
]
)
allow_nil?(false)
end
attribute :event_data, :string
create_timestamp(:inserted_at)
update_timestamp(:updated_at)
end
relationships do
belongs_to :character, WandererApp.Api.Character do
allow_nil? true
attribute_writable? true
end
belongs_to :user, WandererApp.Api.User do
primary_key? true
allow_nil? false
attribute_writable? true
end
end
end