Skip to content

Commit

Permalink
update guide
Browse files Browse the repository at this point in the history
  • Loading branch information
jechol committed Mar 1, 2024
1 parent 720a45a commit 9c3c744
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions documentation/tutorials/get-started-with-paper-trail.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,18 @@ Valid options are `:snapshot` and `:changes_only` and `:full_diff`.
`{ subject: "new subject", body: "unchanged body", author: { name: "bob"}}`

### Changes Only

`:changes_only` will json dump the contents of only the attributes that have changed.
Note if any part of an embedded attribute and array of embedded attributes, changes then the entire top level attribute is dumped.

`{ subject: "new subject" }`

### Full Diff

`:full_diff` will json dump the contents of each attribute.

`{ subject: { from: "subject", to: "new subject" }, body: { unchanged: "unchanged_body" }}, author: { changes: { unchanged: "bob" }}`


## Associating Versions with Actors

You can record the actor who made the change by declaring one or more resources that can be actors.
Expand Down Expand Up @@ -130,7 +131,7 @@ For example:

```elixir
paper_trail do
mixin MyApp.MyResource.PaperTrailMixin
mixin {MyApp.MyResource.PaperTrailMixin, :graphql, [:my_resource_version]}
version_extensions extensions: [AshGraphql.Resource]
end
```
Expand All @@ -140,10 +141,10 @@ And then you can define a module like so:
```elixir
defmodule MyApp.MyResource.PaperTrailMixin do

defmacro __using__(_) do
def graphql(type) do
quote do
graphql do
type :my_resource_version
type unquote(type)

queries do
list :list_versions, action: :read
Expand Down

0 comments on commit 9c3c744

Please sign in to comment.