From d55864713a32a6cc28714f2f87a5cde56824739e Mon Sep 17 00:00:00 2001 From: Zach Daniel Date: Sat, 6 Apr 2024 15:20:22 -0400 Subject: [PATCH] chore: small doc updates, remove incorrect/old docs --- documentation/topics/actions.md | 2 -- documentation/topics/phoenix.md | 18 ------------ .../topics/store-context-in-process.md | 11 -------- .../upgrade.md => topics/upgrading-to-3.0.md} | 0 documentation/tutorials/get-started.md | 28 +++++++++---------- mix.exs | 8 ++---- 6 files changed, 16 insertions(+), 51 deletions(-) delete mode 100644 documentation/topics/phoenix.md delete mode 100644 documentation/topics/store-context-in-process.md rename documentation/{how_to/upgrade.md => topics/upgrading-to-3.0.md} (100%) diff --git a/documentation/topics/actions.md b/documentation/topics/actions.md index 68a05941..e8b3988a 100644 --- a/documentation/topics/actions.md +++ b/documentation/topics/actions.md @@ -154,7 +154,6 @@ end The following steps are performed when you call `Ash.Query.for_read/4`. -- [Gather Process Context](/documentation/topics/store-context-in-process.md) - Cast input arguments - `d:Ash.Resource.Dsl.actions.read.argument` - Set default argument values - `d:Ash.Resource.Dsl.actions.read.argument|default` - Add errors for missing required arguments | `d:Ash.Resource.Dsl.actions.read.argument|allow_nil?` @@ -213,7 +212,6 @@ end The following steps are run when calling `Ash.Changeset.for_create/4`, `Ash.Changeset.for_update/4` or `Ash.Changeset.for_destroy/4`. -- [Gather process context](/documentation/topics/store-context-in-process.md) - Cast input params | This is any arguments in addition to any accepted attributes - Set argument defaults - Require any missing arguments diff --git a/documentation/topics/phoenix.md b/documentation/topics/phoenix.md deleted file mode 100644 index dd92f905..00000000 --- a/documentation/topics/phoenix.md +++ /dev/null @@ -1,18 +0,0 @@ -# Phoenix - -Ash plays nicely with phoenix. There are a few things to consider when using them side-by-side. - -## Adding Ash to an existing Phoenix app - -To add Ash to an existing application is easy, generally only involves updating your `Ecto.Repo` to use `AshPostgres.Repo` if you are using `AshPostgres`. Other than that, you can follow the guides as usual. - -## Creating a new Phoenix app - -If you want to use `AshPostgres`, you have two options here: - -1. create a phoenix app as normal, and when you set up `AshPostgres`, ignore the steps for creating the repo, and instead update it to use `AshPostgres.Repo`. -2. create the app with `--no-ecto` and follow the AshPostgres guide getting started guide fully. - -## Using Extensions - -If you are using extensions like AshGraphql or AshJsonApi, you will want to follow their getting started guides separately. \ No newline at end of file diff --git a/documentation/topics/store-context-in-process.md b/documentation/topics/store-context-in-process.md deleted file mode 100644 index 3159b8d0..00000000 --- a/documentation/topics/store-context-in-process.md +++ /dev/null @@ -1,11 +0,0 @@ -# Store Context In Process - -There are various things that can be stored in the process dictionary as opposed to passing them to every function. This is a stylistic choice, and in many cases could lead to *less* clear code, so use with caution. See the functions in the `Ash` module for more. - -The following things can be stored in the process: - -- Query/changeset context, will be merged with the context of any query/changeset before it is run. -- The current actor (i.e current_user) -- Whether or not to run authorization, i.e `authorize?` -- The current tracer -- The current tenant diff --git a/documentation/how_to/upgrade.md b/documentation/topics/upgrading-to-3.0.md similarity index 100% rename from documentation/how_to/upgrade.md rename to documentation/topics/upgrading-to-3.0.md diff --git a/documentation/tutorials/get-started.md b/documentation/tutorials/get-started.md index ae70056a..9158a51c 100644 --- a/documentation/tutorials/get-started.md +++ b/documentation/tutorials/get-started.md @@ -150,7 +150,7 @@ defmodule Helpdesk.Support.Ticket do # Use the default implementation of the :read action defaults [:read] - # and a custom create action, which we'll customize later + # and a create action, which we'll customize later create :create end @@ -591,24 +591,24 @@ Where Ash shines however, is all of the tools that can work *with* your resource #### Get Help -- Check out [ElixirForum](https://elixirforum.com/c/elixir-framework-forums/ash-framework-forum/123) +- Check out [ElixirForum](https://elixirforum.com/c/ash-framework-forum) - Join our [Discord server](https://discord.gg/D7FNG2q) - Open a [GitHub issue](https://github.com/ash-project/ash/issues/new/choose) +#### Persist your data + +See [The AshPostgres getting started guide](https://hexdocs.pm/ash_postgres) to see how to back your resources with Postgres. This is highly recommended, as the Postgres data layer provides tons of advanced capabilities. + +#### Add a web API + +Check out [AshJsonApi](https://hexdocs.pm/ash_json_api) and [AshGraphql](https://hexdocs.pm/ash_graphql) extensions to build APIs around your resource + +#### Authorize access and work with users + +See the [Policies guide](/documentation/topics/policies.md) for information on how to authorize access to your resources using actors and policies. + #### Clean up your code that uses Ash? Creating and using changesets manually can be verbose, and they all look very similar. Luckily, Ash has your back and can help you build high quality interfaces for you! Check out the [Code Interface Guide](/documentation/topics/code-interface.md) to derive things like `Helpdesk.Support.Ticket.assign!(representative.id)` - -#### Persist your data - -See [The AshPostgres getting started guide](https://hexdocs.pm/ash_postgres/get-started-with-postgres.html) to see how to back your resources with Postgres. This is highly recommended, as the Postgres data layer provides tons of advanced capabilities. - -#### Add a web API - -Check out the `AshJsonApi` and `AshGraphql` extensions to build APIs around your resources - -#### Authorize access and work with users - -See the [Policies guide](/documentation/topics/policies.md) for information on how to authorize access to your resources using actors and policies. diff --git a/mix.exs b/mix.exs index 3d645b6e..330b36b9 100644 --- a/mix.exs +++ b/mix.exs @@ -75,13 +75,11 @@ defmodule Ash.MixProject do "documentation/topics/multitenancy.md", "documentation/topics/notifiers.md", "documentation/topics/pagination.md", - "documentation/topics/phoenix.md", "documentation/topics/policies.md", "documentation/topics/pub_sub.md", "documentation/topics/reactor.md", "documentation/topics/relationships.md", "documentation/topics/security.md", - "documentation/topics/store-context-in-process.md", "documentation/topics/testing.md", "documentation/topics/timeouts.md", "documentation/topics/validations.md", @@ -107,6 +105,7 @@ defmodule Ash.MixProject do "documentation/topics/about_ash/what-is-ash.md", "documentation/topics/about_ash/design-principles.md", "documentation/topics/about_ash/contributing-to-ash.md", + "documentation/topics/upgrading-to-3.0.md", "CHANGELOG.md" ], "How To": [], @@ -127,7 +126,6 @@ defmodule Ash.MixProject do "documentation/how_to/defining-manual-relationships.md", "documentation/how_to/handle-errors.md", "documentation/how_to/structure-your-project.md", - "documentation/how_to/upgrade.md", "documentation/how_to/use-without-data-layers.md", "documentation/how_to/validate-changes.md", "documentation/how_to/auto-format-code.md", @@ -150,13 +148,11 @@ defmodule Ash.MixProject do "documentation/topics/multitenancy.md", "documentation/topics/notifiers.md", "documentation/topics/pagination.md", - "documentation/topics/phoenix.md", "documentation/topics/policies.md", "documentation/topics/pub_sub.md", "documentation/topics/reactor.md", "documentation/topics/relationships.md", "documentation/topics/security.md", - "documentation/topics/store-context-in-process.md", "documentation/topics/testing.md", "documentation/topics/timeouts.md", "documentation/topics/validations.md" @@ -165,7 +161,7 @@ defmodule Ash.MixProject do skip_undefined_reference_warnings_on: [ "CHANGELOG.md", "documentation/topics/glossary.md", - "documentation/how_to/upgrade.md" + "documentation/topics/upgrading-to-3.0.md" ], nest_modules_by_prefix: [ Ash.Error,