Skip to content

Commit

Permalink
docs: remove registries from docs and examples
Browse files Browse the repository at this point in the history
  • Loading branch information
zachdaniel committed Aug 15, 2023
1 parent d7e03ce commit 561e9bc
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 41 deletions.
5 changes: 0 additions & 5 deletions config/dev.exs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ config :ash_authentication, Example.Repo,
show_sensitive_data_on_connection_error: true,
pool_size: 10

config :ash_authentication, Example,
resources: [
registry: Example.Registry
]

config :ash_authentication,
authentication: [
strategies: [
Expand Down
5 changes: 0 additions & 5 deletions config/test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ config :ash_authentication, Example.Repo,
pool: Ecto.Adapters.SQL.Sandbox,
pool_size: 10

config :ash_authentication, Example,
resources: [
registry: Example.Registry
]

config :bcrypt_elixir, :log_rounds, 4

config :ash, :disable_async?, true
Expand Down
2 changes: 1 addition & 1 deletion dev/dev_server/json_api_router.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule DevServer.JsonApiRouter do
@moduledoc false
use AshJsonApi.Api.Router, api: Example, registry: Example.Registry
use AshJsonApi.Api.Router, api: Example
end
22 changes: 4 additions & 18 deletions documentation/tutorials/getting-started-with-authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ defmodule MyApp.Accounts do
use Ash.Api

resources do
registry MyApp.Accounts.Registry
resource MyApp.Accounts.User
resource MyApp.Accounts.Token
end
end
```
Expand All @@ -113,21 +114,6 @@ Be sure to add it to the `ash_apis` config in your `config.exs`
config :my_app, :ash_apis, [..., MyApp.Accounts]
```

Next, let's define our registry:

```elixir
# lib/my_app/accounts/registry.ex

defmodule MyApp.Accounts.Registry do
use Ash.Registry, extensions: [Ash.Registry.ResourceValidations]

entries do
entry MyApp.Accounts.User
entry MyApp.Accounts.Token
end
end
```

Next, let's define our `Token` resource. This resource is needed
if token generation is enabled for any resources in your application. Most of
the contents are auto-generated, so we just need to provide the data layer
Expand All @@ -152,7 +138,7 @@ defmodule MyApp.Accounts.Token do
table "tokens"
repo MyApp.Repo
end

# If using policies, add the following bypass:
# policies do
# bypass AshAuthentication.Checks.AshAuthenticationInteraction do
Expand Down Expand Up @@ -205,7 +191,7 @@ defmodule MyApp.Accounts.User do
identities do
identity :unique_email, [:email]
end

# If using policies, add the folowing bypass:
# policies do
# bypass AshAuthentication.Checks.AshAuthenticationInteraction do
Expand Down
5 changes: 4 additions & 1 deletion test/support/example.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ defmodule Example do
use Ash.Api, otp_app: :ash_authentication, extensions: [AshGraphql.Api, AshJsonApi.Api]

resources do
registry Example.Registry
resource Example.User
resource Example.UserWithTokenRequired
resource Example.Token
resource Example.UserIdentity
end

json_api do
Expand Down
11 changes: 0 additions & 11 deletions test/support/example/registry.ex

This file was deleted.

0 comments on commit 561e9bc

Please sign in to comment.