Skip to content

Commit

Permalink
feat!: update to ash v3
Browse files Browse the repository at this point in the history
  • Loading branch information
moissela committed May 31, 2024
1 parent 50c0c97 commit 375d51b
Show file tree
Hide file tree
Showing 25 changed files with 30 additions and 96 deletions.
2 changes: 0 additions & 2 deletions .envrc

This file was deleted.

6 changes: 3 additions & 3 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ defmodule AshUUID.MixProject do
[
app: @name,
version: @version,
elixir: "~> 1.16",
elixir: "~> 1.14",
start_permanent: Mix.env() == :prod,
elixirc_paths: elixirc_paths(Mix.env()),
preferred_cli_env: preferred_cli_env(),
Expand Down Expand Up @@ -43,8 +43,8 @@ defmodule AshUUID.MixProject do
defp deps do
[
{:uniq, "~> 0.6"},
{:ash, "~> 3.0.0-rc.0"},
{:ash_postgres, "~> 2.0.0-rc.0"},
{:ash, "~> 3.0.0"},
{:ash_postgres, "~> 2.0.0"},
# Testing, documentation, and release tools
{:mix_test_interactive, ">= 0.0.0", only: :test, runtime: false},
{:mix_audit, ">= 0.0.0", only: [:dev, :test], runtime: false},
Expand Down
30 changes: 15 additions & 15 deletions mix.lock

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions test/ash_uuid_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ defmodule AshUUIDTest do
test "testing embedded things" do
embedded_thing =
AshUUID.Test.EmbeddedThing
|> Ash.Changeset.for_create(:create, %{})
|> Ash.Changeset.for_create(:create, %{}, domain: AshUUID.Test)
|> Ash.create!()

assert %AshUUID.Test.EmbeddedThing{} = embedded_thing
Expand Down Expand Up @@ -376,29 +376,29 @@ defmodule AshUUIDTest do

default_standard_result =
AshUUID.Test.EmbeddedThing
|> Ash.ActionInput.for_action(:default_standard_argument_test, %{id: raw_uuid}, api: AshUUID.Test)
|> Ash.ActionInput.for_action(:default_standard_argument_test, %{id: raw_uuid}, domain: AshUUID.Test)
|> Ash.run_action()

expected_uuid = "embedded_#{encoded_uuid}"
assert {:ok, ^expected_uuid} = default_standard_result

override_standard_result =
AshUUID.Test.EmbeddedThing
|> Ash.ActionInput.for_action(:override_standard_argument_test, %{id: raw_uuid}, api: AshUUID.Test)
|> Ash.ActionInput.for_action(:override_standard_argument_test, %{id: raw_uuid}, domain: AshUUID.Test)
|> Ash.run_action()

assert {:ok, ^encoded_uuid} = override_standard_result

default_uuid_result =
AshUUID.Test.EmbeddedThing
|> Ash.ActionInput.for_action(:default_uuid_argument_test, %{id: raw_uuid}, api: AshUUID.Test)
|> Ash.ActionInput.for_action(:default_uuid_argument_test, %{id: raw_uuid}, domain: AshUUID.Test)
|> Ash.run_action()

assert {:ok, ^prefixed_uuid} = default_uuid_result

override_uuid_result =
AshUUID.Test.EmbeddedThing
|> Ash.ActionInput.for_action(:override_uuid_argument_test, %{id: raw_uuid}, api: AshUUID.Test)
|> Ash.ActionInput.for_action(:override_uuid_argument_test, %{id: raw_uuid}, domain: AshUUID.Test)
|> Ash.run_action()

assert {:ok, ^encoded_uuid} = override_uuid_result
Expand All @@ -407,7 +407,7 @@ defmodule AshUUIDTest do
test "testing malformed inputs" do
result =
AshUUID.Test.EmbeddedThing
|> Ash.ActionInput.for_action(:default_standard_argument_test, %{id: "malformed"}, api: AshUUID.Test)
|> Ash.ActionInput.for_action(:default_standard_argument_test, %{id: "malformed"}, domain: AshUUID.Test)
|> Ash.run_action()

assert {:error, %Ash.Error.Invalid{}} = result
Expand All @@ -419,7 +419,7 @@ defmodule AshUUIDTest do
result =
AshUUID.Test.EmbeddedThing
|> Ash.ActionInput.for_action(:default_uuid_argument_test, %{id: "wrong-prefix_#{encoded_uuid}"},
api: AshUUID.Test
domain: AshUUID.Test
)
|> Ash.run_action()

Expand All @@ -428,7 +428,7 @@ defmodule AshUUIDTest do
result =
AshUUID.Test.EmbeddedThing
|> Ash.ActionInput.for_action(:not_strict_uuid_argument_test, %{id: "wrong-prefix_#{encoded_uuid}"},
api: AshUUID.Test
domain: AshUUID.Test
)
|> Ash.run_action()

Expand Down
2 changes: 1 addition & 1 deletion test/support/repo.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ defmodule AshUUID.Test.Repo do
@doc false
@impl AshPostgres.Repo
def installed_extensions do
["uuid-ossp", "citext", AshUUID.PostgresExtension]
["ash-functions", "uuid-ossp", "citext", AshUUID.PostgresExtension]
end
end
3 changes: 0 additions & 3 deletions test/support/resources/avocado.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ defmodule AshUUID.Test.Avocado do

use Ash.Resource, domain: AshUUID.Test, data_layer: AshPostgres.DataLayer, extensions: [AshUUID]

code_interface do
end

postgres do
table "avocados"
repo AshUUID.Test.Repo
Expand Down
3 changes: 0 additions & 3 deletions test/support/resources/avocado_smoothie.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ defmodule AshUUID.Test.AvocadoSmoothie do

use Ash.Resource, domain: AshUUID.Test, data_layer: AshPostgres.DataLayer, extensions: [AshUUID]

code_interface do
end

postgres do
table "avocado_smoothies"
repo AshUUID.Test.Repo
Expand Down
3 changes: 0 additions & 3 deletions test/support/resources/banana.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ defmodule AshUUID.Test.Banana do

use Ash.Resource, domain: AshUUID.Test, data_layer: AshPostgres.DataLayer, extensions: [AshUUID]

code_interface do
end

postgres do
table "bananas"
repo AshUUID.Test.Repo
Expand Down
3 changes: 0 additions & 3 deletions test/support/resources/banana_smoothie.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ defmodule AshUUID.Test.BananaSmoothie do

use Ash.Resource, domain: AshUUID.Test, data_layer: AshPostgres.DataLayer, extensions: [AshUUID]

code_interface do
end

postgres do
table "banana_smoothies"
repo AshUUID.Test.Repo
Expand Down
3 changes: 0 additions & 3 deletions test/support/resources/blib.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ defmodule AshUUID.Test.Blib do

use Ash.Resource, domain: AshUUID.Test, data_layer: AshPostgres.DataLayer, extensions: [AshUUID]

code_interface do
end

postgres do
table "blibs"
repo AshUUID.Test.Repo
Expand Down
3 changes: 0 additions & 3 deletions test/support/resources/blib_blob.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ defmodule AshUUID.Test.BlibBlob do

use Ash.Resource, domain: AshUUID.Test, data_layer: AshPostgres.DataLayer, extensions: [AshUUID]

code_interface do
end

postgres do
table "blibs_blobs"
repo AshUUID.Test.Repo
Expand Down
3 changes: 0 additions & 3 deletions test/support/resources/blob.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ defmodule AshUUID.Test.Blob do

use Ash.Resource, domain: AshUUID.Test, data_layer: AshPostgres.DataLayer, extensions: [AshUUID]

code_interface do
end

postgres do
table "blobs"
repo AshUUID.Test.Repo
Expand Down
5 changes: 1 addition & 4 deletions test/support/resources/embedded_thing.ex
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
defmodule AshUUID.Test.EmbeddedThing do
@moduledoc false

use Ash.Resource, domain: AshUUID.Test, data_layer: :embedded, extensions: [AshUUID]

code_interface do
end
use Ash.Resource, data_layer: :embedded, extensions: [AshUUID]

attributes do
uuid_attribute :id
Expand Down
3 changes: 0 additions & 3 deletions test/support/resources/lime.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ defmodule AshUUID.Test.Lime do

use Ash.Resource, domain: AshUUID.Test, data_layer: AshPostgres.DataLayer, extensions: [AshUUID]

code_interface do
end

postgres do
table "limes"
repo AshUUID.Test.Repo
Expand Down
3 changes: 0 additions & 3 deletions test/support/resources/lime_smoothie.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ defmodule AshUUID.Test.LimeSmoothie do

use Ash.Resource, domain: AshUUID.Test, data_layer: AshPostgres.DataLayer, extensions: [AshUUID]

code_interface do
end

postgres do
table "lime_smoothies"
repo AshUUID.Test.Repo
Expand Down
3 changes: 0 additions & 3 deletions test/support/resources/mango.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ defmodule AshUUID.Test.Mango do

use Ash.Resource, domain: AshUUID.Test, data_layer: AshPostgres.DataLayer, extensions: [AshUUID]

code_interface do
end

postgres do
table "mangos"
repo AshUUID.Test.Repo
Expand Down
3 changes: 0 additions & 3 deletions test/support/resources/mango_smoothie.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ defmodule AshUUID.Test.MangoSmoothie do

use Ash.Resource, domain: AshUUID.Test, data_layer: AshPostgres.DataLayer, extensions: [AshUUID]

code_interface do
end

postgres do
table "mango_smoothies"
repo AshUUID.Test.Repo
Expand Down
3 changes: 0 additions & 3 deletions test/support/resources/orange.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ defmodule AshUUID.Test.Orange do

use Ash.Resource, domain: AshUUID.Test, data_layer: AshPostgres.DataLayer, extensions: [AshUUID]

code_interface do
end

postgres do
table "oranges"
repo AshUUID.Test.Repo
Expand Down
3 changes: 0 additions & 3 deletions test/support/resources/orange_smoothie.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ defmodule AshUUID.Test.OrangeSmoothie do

use Ash.Resource, domain: AshUUID.Test, data_layer: AshPostgres.DataLayer, extensions: [AshUUID]

code_interface do
end

postgres do
table "orange_smoothies"
repo AshUUID.Test.Repo
Expand Down
3 changes: 0 additions & 3 deletions test/support/resources/pineapple.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ defmodule AshUUID.Test.Pineapple do

use Ash.Resource, domain: AshUUID.Test, data_layer: AshPostgres.DataLayer, extensions: [AshUUID]

code_interface do
end

postgres do
table "pineapples"
repo AshUUID.Test.Repo
Expand Down
3 changes: 0 additions & 3 deletions test/support/resources/pineapple_smoothie.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ defmodule AshUUID.Test.PineappleSmoothie do

use Ash.Resource, domain: AshUUID.Test, data_layer: AshPostgres.DataLayer, extensions: [AshUUID]

code_interface do
end

postgres do
table "pineapple_smoothies"
repo AshUUID.Test.Repo
Expand Down
3 changes: 0 additions & 3 deletions test/support/resources/template.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ defmodule AshUUID.Test.Template do

use Ash.Resource, domain: AshUUID.Test, data_layer: AshPostgres.DataLayer, extensions: [AshUUID]

code_interface do
end

postgres do
table "templates"
repo AshUUID.Test.Repo
Expand Down
3 changes: 0 additions & 3 deletions test/support/resources/volatile_thing.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ defmodule AshUUID.Test.VolatileThing do

use Ash.Resource, domain: AshUUID.Test, extensions: [AshUUID]

code_interface do
end

attributes do
uuid_attribute :id
end
Expand Down
3 changes: 0 additions & 3 deletions test/support/resources/wrapper_thing.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ defmodule AshUUID.Test.WrapperThing do

use Ash.Resource, domain: AshUUID.Test, data_layer: AshPostgres.DataLayer, extensions: [AshUUID]

code_interface do
end

postgres do
table "wrapper_things"
repo AshUUID.Test.Repo
Expand Down
11 changes: 2 additions & 9 deletions vsc.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,18 @@
}
],
"settings": {
"[elixir]": { "editor.defaultFormatter": "elixir-tools.elixir-tools" },
"[phoenix-heex]": {
"editor.defaultFormatter": "animus-coop.vscode-elixir-mix-formatter"
},
"[elixir]": { "editor.defaultFormatter": "JakeBecker.elixir-ls" },
"editor.acceptSuggestionOnEnter": "off",
"editor.bracketPairColorization.enabled": true,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"editor.guides.bracketPairs": "active",
"editor.insertSpaces": true,
"editor.quickSuggestions": {
"strings": true
},
"editor.quickSuggestions": { "strings": true },
"editor.tabSize": 2,
"editor.trimAutoWhitespace": false,
"editor.wordBasedSuggestions": "off",
"elixir-tools.credo.enable": true,
"elixir-tools.nextls.enable": true,
"elixirLS.dialyzerEnabled": true,
"elixirLS.enableTestLenses": true,
"elixirLS.fetchDeps": true,
Expand All @@ -45,7 +39,6 @@
".direnv": true,
".elixir_ls": true,
".elixir-tools": true,
".nix": true,
"deps": true,
"legacy": true,
"priv/plts": true,
Expand Down

0 comments on commit 375d51b

Please sign in to comment.