-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3498 from nulib/4095-ark-handling
Make sure ARKs update properly
- Loading branch information
Showing
16 changed files
with
533 additions
and
238 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
defmodule Meadow.Data.Schemas.ArkCache do | ||
@moduledoc """ | ||
Schema for caching ARKs | ||
""" | ||
use Ecto.Schema | ||
import Ecto.Changeset | ||
|
||
@primary_key {:ark, :string, autogenerate: false, read_after_writes: true} | ||
schema "ark_cache" do | ||
field(:creator, :string) | ||
field(:title, :string) | ||
field(:publisher, :string) | ||
field(:publication_year, :string) | ||
field(:resource_type, :string) | ||
field(:status, :string) | ||
field(:target, :string) | ||
field(:work_id, Ecto.UUID) | ||
end | ||
|
||
def changeset(ark \\ %__MODULE__{}, params) | ||
def changeset(nil, params), do: changeset(params) | ||
|
||
def changeset(ark, params) do | ||
cast(ark, params, [ | ||
:ark, | ||
:creator, | ||
:title, | ||
:publisher, | ||
:publication_year, | ||
:resource_type, | ||
:status, | ||
:target, | ||
:work_id | ||
]) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.