Compare commits

...

2 Commits

Author SHA1 Message Date
Dmitry Popov
df569def84 Merge branch 'main' into signature-custom-info 2024-11-19 23:00:25 +01:00
Dmitry Popov
a1514e75b7 feat(Signatures): Add signature custom info 2024-11-16 17:46:32 +01:00
4 changed files with 228 additions and 9 deletions

View File

@@ -17,6 +17,7 @@ defmodule WandererApp.Api.MapSystemSignature do
define(:update_linked_system, action: :update_linked_system)
define(:update_type, action: :update_type)
define(:update_group, action: :update_group)
define(:update_custom_info, action: :update_custom_info)
define(:by_id,
get_by: [:id],
@@ -40,10 +41,6 @@ defmodule WandererApp.Api.MapSystemSignature do
defaults [:read, :destroy]
read :all_active do
prepare build(sort: [updated_at: :desc])
end
create :create do
primary? true
@@ -63,6 +60,16 @@ defmodule WandererApp.Api.MapSystemSignature do
change manage_relationship(:system_id, :system, on_lookup: :relate, on_no_match: nil)
end
read :all_active do
prepare build(sort: [updated_at: :desc])
end
read :by_system_id do
argument(:system_id, :string, allow_nil?: false)
filter(expr(system_id == ^arg(:system_id)))
end
update :update do
accept [
:system_id,
@@ -92,10 +99,8 @@ defmodule WandererApp.Api.MapSystemSignature do
accept [:group]
end
read :by_system_id do
argument(:system_id, :string, allow_nil?: false)
filter(expr(system_id == ^arg(:system_id)))
update :update_custom_info do
accept [:custom_info]
end
end
@@ -129,6 +134,10 @@ defmodule WandererApp.Api.MapSystemSignature do
attribute :kind, :string
attribute :group, :string
attribute :custom_info, :string do
allow_nil? true
end
attribute :updated, :integer
create_timestamp(:inserted_at)

View File

@@ -328,7 +328,8 @@ defmodule WandererAppWeb.MapSignaturesEventHandler do
:description,
:kind,
:group,
:type
:type,
:custom_info
])
|> Map.put(:linked_system, MapEventHandler.get_system_static_info(linked_system_id))
|> Map.put(:inserted_at, inserted_at |> Calendar.strftime("%Y/%m/%d %H:%M:%S"))
@@ -352,6 +353,7 @@ defmodule WandererAppWeb.MapSignaturesEventHandler do
kind: kind,
group: group,
type: Map.get(signature, "type"),
custom_info: Map.get(signature, "custom_info"),
character_eve_id: character_eve_id
}
end)

View File

@@ -0,0 +1,21 @@
defmodule WandererApp.Repo.Migrations.AddSignatureCustomInfo do
@moduledoc """
Updates resources based on their most recent snapshots.
This file was autogenerated with `mix ash_postgres.generate_migrations`
"""
use Ecto.Migration
def up do
alter table(:map_system_signatures_v1) do
add :custom_info, :text
end
end
def down do
alter table(:map_system_signatures_v1) do
remove :custom_info
end
end
end

View File

@@ -0,0 +1,187 @@
{
"attributes": [
{
"allow_nil?": false,
"default": "fragment(\"gen_random_uuid()\")",
"generated?": false,
"primary_key?": true,
"references": null,
"size": null,
"source": "id",
"type": "uuid"
},
{
"allow_nil?": false,
"default": "nil",
"generated?": false,
"primary_key?": false,
"references": null,
"size": null,
"source": "eve_id",
"type": "text"
},
{
"allow_nil?": false,
"default": "nil",
"generated?": false,
"primary_key?": false,
"references": null,
"size": null,
"source": "character_eve_id",
"type": "text"
},
{
"allow_nil?": true,
"default": "nil",
"generated?": false,
"primary_key?": false,
"references": null,
"size": null,
"source": "name",
"type": "text"
},
{
"allow_nil?": true,
"default": "nil",
"generated?": false,
"primary_key?": false,
"references": null,
"size": null,
"source": "description",
"type": "text"
},
{
"allow_nil?": true,
"default": "nil",
"generated?": false,
"primary_key?": false,
"references": null,
"size": null,
"source": "type",
"type": "text"
},
{
"allow_nil?": true,
"default": "nil",
"generated?": false,
"primary_key?": false,
"references": null,
"size": null,
"source": "linked_system_id",
"type": "bigint"
},
{
"allow_nil?": true,
"default": "nil",
"generated?": false,
"primary_key?": false,
"references": null,
"size": null,
"source": "kind",
"type": "text"
},
{
"allow_nil?": true,
"default": "nil",
"generated?": false,
"primary_key?": false,
"references": null,
"size": null,
"source": "group",
"type": "text"
},
{
"allow_nil?": true,
"default": "nil",
"generated?": false,
"primary_key?": false,
"references": null,
"size": null,
"source": "custom_info",
"type": "text"
},
{
"allow_nil?": false,
"default": "fragment(\"(now() AT TIME ZONE 'utc')\")",
"generated?": false,
"primary_key?": false,
"references": null,
"size": null,
"source": "inserted_at",
"type": "utc_datetime_usec"
},
{
"allow_nil?": false,
"default": "fragment(\"(now() AT TIME ZONE 'utc')\")",
"generated?": false,
"primary_key?": false,
"references": null,
"size": null,
"source": "updated_at",
"type": "utc_datetime_usec"
},
{
"allow_nil?": true,
"default": "nil",
"generated?": false,
"primary_key?": false,
"references": {
"deferrable": false,
"destination_attribute": "id",
"destination_attribute_default": null,
"destination_attribute_generated": null,
"index?": false,
"match_type": null,
"match_with": null,
"multitenancy": {
"attribute": null,
"global": null,
"strategy": null
},
"name": "map_system_signatures_v1_system_id_fkey",
"on_delete": null,
"on_update": null,
"primary_key?": true,
"schema": "public",
"table": "map_system_v1"
},
"size": null,
"source": "system_id",
"type": "uuid"
}
],
"base_filter": null,
"check_constraints": [],
"custom_indexes": [],
"custom_statements": [],
"has_create_action": true,
"hash": "1EF4562557231FE7B0D1E0CC56B2CFB44BBEB015371777F72121AF7FB4DFCAA9",
"identities": [
{
"all_tenants?": false,
"base_filter": null,
"index_name": "map_system_signatures_v1_uniq_system_eve_id_index",
"keys": [
{
"type": "atom",
"value": "system_id"
},
{
"type": "atom",
"value": "eve_id"
}
],
"name": "uniq_system_eve_id",
"nils_distinct?": true,
"where": null
}
],
"multitenancy": {
"attribute": null,
"global": null,
"strategy": null
},
"repo": "Elixir.WandererApp.Repo",
"schema": null,
"table": "map_system_signatures_v1"
}