mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 05:23:03 +12:00
improvement: add date
support (#68)
This commit is contained in:
parent
0092af6a94
commit
5f2019027d
2 changed files with 5 additions and 1 deletions
|
@ -23,6 +23,7 @@ defmodule Ash.Type do
|
|||
boolean: [ecto_type: :boolean, filters: [:eq, :not_eq], sortable?: true],
|
||||
int: [ecto_type: :integer, filters: [:eq, :in, :not_eq, :not_in], sortable?: true],
|
||||
uuid: [ecto_type: :binary_id, filters: [:eq, :in, :not_eq, :not_in], sortable?: true],
|
||||
date: [ecto_type: :date, filters: [:eq, :in, :not_eq, :not_in], sortable?: true],
|
||||
utc_datetime: [
|
||||
ecto_type: :utc_datetime,
|
||||
filters: [:eq, :in, :not_eq, :not_in],
|
||||
|
|
|
@ -16,6 +16,7 @@ defmodule Ash.Test.Actions.CreateTest do
|
|||
attributes do
|
||||
attribute :id, :uuid, primary_key?: true, default: &Ecto.UUID.generate/0
|
||||
attribute :bio, :string
|
||||
attribute :date, :date
|
||||
end
|
||||
|
||||
relationships do
|
||||
|
@ -113,7 +114,9 @@ defmodule Ash.Test.Actions.CreateTest do
|
|||
describe "simple creates" do
|
||||
test "allows creating a record with valid attributes" do
|
||||
assert %Post{title: "foo", contents: "bar"} =
|
||||
Api.create!(Post, attributes: %{title: "foo", contents: "bar"})
|
||||
Api.create!(Post,
|
||||
attributes: %{title: "foo", contents: "bar", date: Date.utc_today()}
|
||||
)
|
||||
end
|
||||
|
||||
test "constant default values are set properly" do
|
||||
|
|
Loading…
Reference in a new issue