Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extend article schema to include `favorite` virtual field.
- Loading branch information
1 parent
115fc14
commit d8529a8
Showing
27 changed files
with
660 additions
and
111 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
defmodule Conduit.Blog.Commands.FavoriteArticle do | ||
defstruct [ | ||
article_uuid: "", | ||
favorited_by_author_uuid: "", | ||
] | ||
|
||
use ExConstructor | ||
use Vex.Struct | ||
|
||
validates :article_uuid, uuid: true | ||
validates :favorited_by_author_uuid, uuid: true | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
defmodule Conduit.Blog.Commands.UnfavoriteArticle do | ||
defstruct [ | ||
article_uuid: "", | ||
unfavorited_by_author_uuid: "", | ||
] | ||
|
||
use ExConstructor | ||
use Vex.Struct | ||
|
||
validates :article_uuid, uuid: true | ||
validates :unfavorited_by_author_uuid, uuid: true | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
defmodule Conduit.Blog.Events.ArticleFavorited do | ||
@derive [Poison.Encoder] | ||
defstruct [ | ||
:article_uuid, | ||
:favorited_by_author_uuid, | ||
:favorite_count, | ||
] | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
defmodule Conduit.Blog.Events.ArticleUnfavorited do | ||
@derive [Poison.Encoder] | ||
defstruct [ | ||
:article_uuid, | ||
:unfavorited_by_author_uuid, | ||
:favorite_count, | ||
] | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
defmodule Conduit.Blog.Projections.FavoritedArticle do | ||
use Ecto.Schema | ||
|
||
@primary_key false | ||
|
||
schema "blog_favorited_articles" do | ||
field :article_uuid, :binary_id, primary_key: true | ||
field :favorited_by_author_uuid, :binary_id, primary_key: true | ||
|
||
timestamps() | ||
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
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
Oops, something went wrong.