Add the module to represent a blogpost.

This commit is contained in:
Jessica Canady 2024-07-30 11:49:01 -04:00
parent f7c9ad7da9
commit 55be98eae9
Signed by: phoenix
SSH key fingerprint: SHA256:aaLOzOrLi+0n4eDZNQKH97PehwRt6KSE5fYJc+ZRKCQ

View file

@ -1,8 +1,8 @@
defmodule JOL.Blog.Post do
@enforce_keys [:title, :body, :draft, :date, :tags]
defstruct [:title, :body, :draft, :date, :tags]
@enforce_keys [:author, :draft, :title, :body, :tags, :date]
defstruct [:author, :draft, :title, :body, :tags, :date]
def build(_filename, attrs, body) do
struct!(__MODULE__, [body: body] ++ Map.to_list(attrs))
struct!(__MODULE__, [author: "Jessica Phoenix Canady", body: body] ++ Map.to_list(attrs))
end
end