Skip to content

Commit cb97168

Browse files
committed
collection: rename creation_date to created_datetime
1 parent 02184a0 commit cb97168

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

lib/data/collection.ex

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,32 @@ defmodule Memorable.Data.Collection do
88
Collections are comprised of the following fields:
99
- `id`: An [ID](`t:Memorable.Util.id/0`) representing the collection
1010
- `name`: The human-readable name of the collection
11-
- `creation_date`: A `DateTime` representing the time at which the collection was created.
11+
- `created_datetime`: A `DateTime` representing the time at which the collection was created.
1212
"""
1313
@moduledoc since: "1.0.0"
1414

15-
@derive {Inspect, only: [:id, :name, :creation_date]}
16-
use Memento.Table, attributes: [:id, :name, :creation_date]
15+
@derive {Inspect, only: [:id, :name, :created_datetime]}
16+
use Memento.Table, attributes: [:id, :name, :created_datetime]
1717

18-
@type t :: %__MODULE__{id: Memorable.Util.id(), name: String.t(), creation_date: DateTime.t()}
18+
@type t :: %__MODULE__{
19+
id: Memorable.Util.id(),
20+
name: String.t(),
21+
created_datetime: DateTime.t()
22+
}
1923

2024
@doc """
2125
Creates a new collection.
2226
2327
Accepts the name to give the collection, and creates a new collection with a randomly-generated ID, and the current
24-
time as the `creation_date`.
28+
time as the `created_datetime`.
2529
"""
2630
@doc since: "1.0.0"
2731
@spec new(String.t()) :: t()
2832
def new(name) do
2933
%__MODULE__{
3034
id: Memorable.Util.generate_id(),
3135
name: name,
32-
creation_date: DateTime.utc_now()
36+
created_datetime: DateTime.utc_now()
3337
}
3438
end
3539

test/data/collection_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ defmodule Memorable.Data.CollectionTest do
1515
test "creates a collection with the given name", %{collection: collection} do
1616
assert String.length(collection.id) == 26
1717
assert collection.name == "Diffies"
18-
assert %DateTime{} = collection.creation_date
18+
assert %DateTime{} = collection.created_datetime
1919
end
2020
end
2121

0 commit comments

Comments
 (0)