Add the module to represent a blogpost.
This commit is contained in:
parent
dee6088508
commit
924c89b52f
8
lib/jol/blog/post.ex
Normal file
8
lib/jol/blog/post.ex
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
defmodule JOL.Blog.Post do
|
||||||
|
@enforce_keys [:author, :draft, :title, :body, :tags, :date]
|
||||||
|
defstruct [:author, :draft, :title, :body, :tags, :date]
|
||||||
|
|
||||||
|
def build(_filename, attrs, body) do
|
||||||
|
struct!(__MODULE__, [author: "Jessica Phoenix Canady", body: body] ++ Map.to_list(attrs))
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue