docs: Updates documentation to nest in the resources folder

This commit is contained in:
Britton Broderick 2023-02-26 09:29:44 -07:00 committed by James Harton
parent a15b55d6f3
commit 0a990b9dc1

View file

@ -185,14 +185,15 @@ At the end we should have the following directory structure:
```bash ```bash
lib/example lib/example
├── accounts ├── accounts
│   ├── registry.ex | ├── accounts.ex
│   ├── token.ex | └── resources
│   └── user.ex │   ├── registry.ex
├── accounts.ex │   ├── token.ex
|   └── user.ex
... ...
``` ```
**lib/example/accounts.ex** **lib/example/accounts/accounts.ex**
```elixir ```elixir
defmodule Example.Accounts do defmodule Example.Accounts do
@ -204,7 +205,7 @@ defmodule Example.Accounts do
end end
``` ```
**lib/example/accounts/user.ex** **lib/example/accounts/resources/user.ex**
```elixir ```elixir
defmodule Example.Accounts.User do defmodule Example.Accounts.User do
@ -241,12 +242,12 @@ defmodule Example.Accounts.User do
end end
identities do identities do
identity :unique_email, [:email] identity :email, [:email]
end end
end end
``` ```
**lib/example/accounts/token.ex** **lib/example/accounts/resources/token.ex**
```elixir ```elixir
defmodule Example.Accounts.Token do defmodule Example.Accounts.Token do
@ -508,9 +509,9 @@ Visit [`localhost:4000/sign-out`](http://localhost:4000/sign-out) from your brow
## Reset Password ## Reset Password
In this section we add a reset password functionality. Which is triggered by adding `resettable` in the `User` resource. Please replace the `strategies` block in `lib/example/accounts/user.ex` with the following code: In this section we add a reset password functionality. Which is triggered by adding `resettable` in the `User` resource. Please replace the `strategies` block in `lib/example/accounts/resources/user.ex` with the following code:
**lib/example/accounts/user.ex** **lib/example/accounts/resources/user.ex**
```elixir ```elixir
# [...] # [...]
@ -538,6 +539,7 @@ defmodule Example.Accounts.User.Senders.SendPasswordResetEmail do
use AshAuthentication.Sender use AshAuthentication.Sender
use ExampleWeb, :verified_routes use ExampleWeb, :verified_routes
@impl AshAuthentication.Sender
def send(user, token, _) do def send(user, token, _) do
Example.Accounts.Emails.deliver_reset_password_instructions( Example.Accounts.Emails.deliver_reset_password_instructions(
user, user,