Add the module to represent a blogpost.

This commit is contained in:
Jessica Canady 2024-06-04 12:13:06 -04:00
parent dee6088508
commit 924c89b52f
Signed by: phoenix
SSH key fingerprint: SHA256:aaLOzOrLi+0n4eDZNQKH97PehwRt6KSE5fYJc+ZRKCQ

8
lib/jol/blog/post.ex Normal file
View 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