Skip to content

Commit

Permalink
✨ Add release date to albums
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewvy committed Nov 27, 2018
1 parent 9f7cd79 commit 3d4dc12
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/dojinlist/schemas/album.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ defmodule Dojinlist.Schemas.Album do
field :purchase_url, :string
field :is_verified, :boolean, default: false
field :cover_art, :string
field :release_date, :date

many_to_many :artists, Dojinlist.Schemas.Artist, join_through: "albums_artists"
many_to_many :genres, Dojinlist.Schemas.Genre, join_through: "albums_genres"
Expand Down Expand Up @@ -50,7 +51,8 @@ defmodule Dojinlist.Schemas.Album do
:event_id,
:is_verified,
:cover_art,
:creator_user_id
:creator_user_id,
:release_date
])
|> validate_required([:name])
end
Expand Down
1 change: 1 addition & 0 deletions lib/dojinlist_web/mutations/album.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ defmodule DojinlistWeb.Mutations.Album do
arg(:genre_ids, list_of(:id))
arg(:event_id, :id)
arg(:cover_art, :upload)
arg(:release_date, :date)

middleware(Absinthe.Relay.Node.ParseIDs, artist_ids: :artist)
middleware(Absinthe.Relay.Node.ParseIDs, genre_ids: :genre)
Expand Down
3 changes: 3 additions & 0 deletions lib/dojinlist_web/schema.ex
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ defmodule DojinlistWeb.Schema do
%Dojinlist.Schemas.BlogPost{}, _ ->
:blog_post

%Dojinlist.Schemas.UserLikeRating{}, _ ->
:rating_like

_, _ ->
nil
end)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
defmodule Dojinlist.Repo.Migrations.AddReleaseDateToAlbums do
use Ecto.Migration

def change do
alter table(:albums) do
add :release_date, :utc_datetime
end
end
end

0 comments on commit 3d4dc12

Please sign in to comment.