From 44d0da8f464660cdead388a6f69dc4fae97dbe09 Mon Sep 17 00:00:00 2001 From: Charlotte Allen Date: Mon, 27 Jan 2020 17:13:09 -0800 Subject: [PATCH] Add basic post generation method --- .gitignore | 1 + src/clj/shapey_shifty/posts/core.clj | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 src/clj/shapey_shifty/posts/core.clj diff --git a/.gitignore b/.gitignore index 0d2092a..e4c8262 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ profiles.clj /node_modules /log +*.swp diff --git a/src/clj/shapey_shifty/posts/core.clj b/src/clj/shapey_shifty/posts/core.clj new file mode 100644 index 0000000..1f75014 --- /dev/null +++ b/src/clj/shapey_shifty/posts/core.clj @@ -0,0 +1,18 @@ +(ns shapey-shifty.posts.core) + +(defn create-empty-post [] {:type nil :properties {:name nil :author nil :published nil :content nil}}) + +(defn set-publish-date [post date] + (assoc-in post [:properties :published] date)) + +(defn set-type [post post-type] + (assoc post :type post-type)) + +(defn set-author [post author] + (assoc-in post [:properties :author] author)) + +(defn set-name [post post-name] + (assoc-in post [:properties :name] post-name)) + +(defn set-content [post post-content] + (assoc-in post [:properties :content] post-content))