   (korma/table :objective8.objectives)
   (korma/belongs-to user {:fk :created_by_id})
   (korma/prepare map->objective)
-  (korma/transform (unmap-with-username :objective)))
+  (korma/transform (-> (unmap :objective) with-username with-global-id)))
 
 (korma/defentity user
   (korma/pk :_id)

                 :_id (:_id m)
                 :_created_at (sql-time->iso-time-string (:_created_at m)))))

(defn unmap-with-username [data-key]
  (fn [m] (assoc (json-type->map (data-key m))
                 :_id (:_id m)
                 :_created_at (sql-time->iso-time-string (:_created_at m))
                 :username (:username m))))

(defn unmap-with-sql-time [data-key]
  (fn [m] (assoc (json-type->map (data-key m))
                 :_id (:_id m)
                 :_created_at (sql-time->iso-time-string (:_created_at m))
                 :_created_at_sql_time (:_created_at m)
                 :username (:username m))))

(declare objective user comment question answer invitation candidate bearer-token up-down-vote)


  (korma/table :objective8.drafts)
  (korma/belongs-to user {:fk :submitter_id})
  (korma/prepare map->draft)
  (korma/transform (-> (unmap :draft) with-username with-sql-time with-global-id)))

(korma/defentity bearer-token
  (korma/pk :_id)
