mirror of
https://github.com/ash-project/ash_archival.git
synced 2024-09-19 13:02:55 +12:00
improvement: Add attribute_type to configure archived_at timestamp (#56)
This commit is contained in:
parent
a354c910c7
commit
51a53143ab
2 changed files with 7 additions and 1 deletions
|
@ -8,6 +8,11 @@ defmodule AshArchival.Resource do
|
|||
default: :archived_at,
|
||||
doc: "The attribute in which to store the archival flag (the current datetime)."
|
||||
],
|
||||
attribute_type: [
|
||||
type: :atom,
|
||||
default: :utc_datetime_usec,
|
||||
doc: "The attribute type."
|
||||
],
|
||||
base_filter?: [
|
||||
type: :atom,
|
||||
default: false,
|
||||
|
|
|
@ -33,8 +33,9 @@ defmodule AshArchival.Resource.Transformers.SetupArchival do
|
|||
|
||||
defp add_archived_at(dsl_state) do
|
||||
attribute = AshArchival.Resource.Info.archive_attribute!(dsl_state)
|
||||
attribute_type = AshArchival.Resource.Info.archive_attribute_type!(dsl_state)
|
||||
|
||||
Ash.Resource.Builder.add_new_attribute(dsl_state, attribute, :utc_datetime_usec,
|
||||
Ash.Resource.Builder.add_new_attribute(dsl_state, attribute, attribute_type,
|
||||
public?: false,
|
||||
allow_nil?: true
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue