Skip to content

Commit

Permalink
remove archieval from project
Browse files Browse the repository at this point in the history
  • Loading branch information
yujonglee committed Oct 20, 2024
1 parent 6ff6914 commit 8ca8a69
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 36 deletions.
3 changes: 1 addition & 2 deletions core/.formatter.exs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
:ash,
:ash_phoenix,
:ash_postgres,
:ash_authentication,
:ash_archival
:ash_authentication
],
subdirectories: ["priv/*/migrations"],
plugins: [Phoenix.LiveView.HTMLFormatter],
Expand Down
12 changes: 1 addition & 11 deletions core/lib/canary/accounts/project.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ defmodule Canary.Accounts.Project do
use Ash.Resource,
domain: Canary.Accounts,
data_layer: AshPostgres.DataLayer,
extensions: [AshArchival.Resource],
authorizers: [Ash.Policy.Authorizer],
simple_notifiers: [Canary.Notifiers.Discord]

Expand All @@ -20,11 +19,6 @@ defmodule Canary.Accounts.Project do
identity :unique_public_key, [:public_key]
end

archive do
attribute :archived_at
exclude_read_actions [:read_all]
end

relationships do
belongs_to :account, Canary.Accounts.Account, allow_nil?: false
has_many :sources, Canary.Sources.Source
Expand All @@ -34,16 +28,12 @@ defmodule Canary.Accounts.Project do
actions do
defaults [:read]

read :read_all do
primary? false
end

create :create do
primary? true
accept [:account_id, :name]

change fn changeset, _ ->
key = "cp" <> String.slice(Ash.UUID.generate(), 0..7)
key = "cp_" <> String.slice(Ash.UUID.generate(), 0..7)

changeset
|> Ash.Changeset.force_change_attribute(:public_key, key)
Expand Down
3 changes: 1 addition & 2 deletions core/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ defmodule Canary.MixProject do
{:ex2ms, "~> 1.7"},
{:recon, "~> 2.5", override: true},
{:recon_ex,
github: "tatsuya6502/recon_ex", ref: "0ce4c5da777937a5bb57d3e68b9afcb9877c1c3b"},
{:ash_archival, "~> 1.0.4"}
github: "tatsuya6502/recon_ex", ref: "0ce4c5da777937a5bb57d3e68b9afcb9877c1c3b"}
] ++ deps_eval()
end

Expand Down
Loading

0 comments on commit 8ca8a69

Please sign in to comment.