 
 ;; ----- Create saveable company doc ----
 
-(defn real-sections [company]
+(defn real-sections
+  "Select all non-placeholder sections from a company map"
+  [company]
   (med/remove-vals :placeholder (select-keys company common/section-names)))
 
 (defn complete-real-sections
+  "For each non-placeholder section in the company add an author,
+   the company's slug and the section name"
   [company user]
   (let [rs (real-sections company)
         add-info (fn [[k section-data]]


(s/defn add-updated-at
  [{:keys [section-name] :as section} :- common/Section ts]
  (let [notes-section? (contains? common/notes-sections section-name)]
    (cond-> (assoc section :updated-at ts)
      (and notes-section? (:notes section)) (assoc-in [:notes :updated-at] ts))))

(s/defn create-company!
  [company :- common/Company]
  (s/validate common/Company company) ; throw if invalid
  (let [real-sections     (real-sections company)
        ts                (common/current-timestamp)
        rs-w-ts           (med/map-vals #(add-updated-at % ts) real-sections)]
    (doseq [[_ section] real-sections]
      (common/create-resource common/section-table-name section ts))
    (common/create-resource table-name (merge company rs-w-ts) ts)))

    (merge company (into {} (map add-info rs)))))

(s/defn ->company :- common/Company
  "Take a minimal map describing a company and a user and 'fill the blanks'"
  [company-props user]
  (let [slug (or (:slug company-props) (slug/find-available-slug (:name company-props) (taken-slugs)))]
    (-> company-props
