 (schema/defn ^:always-validate list-labels-by-org-user :- [common/Label]
   [conn org-uuid :- lib-schema/UniqueID user-id :- lib-schema/UniqueID]
   {:pre [(db-common/conn? conn)]}
-  (db-common/read-resources conn table-name :org-uuid-user-id-labels [[org-uuid user-id]]))+  (db-common/read-resources conn table-name :org-uuid-user-id-labels [[org-uuid user-id]]))
+
+(comment
+  (require '[oc.storage.resources.org :as org])
+  (require '[oc.storage.resources.entry :as entry])
+  (require '[clojure.pprint :refer (pprint)])
+
+  (def carrot (org/get-org conn "carrot"))
+  (def author (:author carrot))
+  (println (create-label! conn (->label "My label test" (:uuid carrot) author)))
+
+  (def test-xss (create-label! conn (->label "<style>Test</style>out" (:uuid carrot) author)))
+  (delete-label! conn (:uuid test-xss))
+
+  (def test-label (get-label conn (:uuid carrot) "my-label-test"))
+
+  (update-label! conn (:uuid test-label) {:name "My label test updated"})
+  (:name (get-label conn (:uuid carrot) "my-label-test"))
+
+  (pprint (list-labels-by-org conn (:uuid carrot)))
+
+
+  (label-slug-for-org conn (:uuid carrot) "My label test") ;; => my-label-test-1
+
+  (label-used-by! conn (:uuid test-label) (:uuid carrot) author)
+
+  (def tmp-labels (list-labels-by-org-user conn (:uuid carrot) (:user-id author)))
+
+  (labels-used-by! conn (mapv :uuid (take 2 tmp-labels)) (:uuid carrot) author)
+
+  (labels-unused-by! conn (mapv :uuid (take 2 tmp-labels)) (:uuid carrot) author)
+
+  (delete-label! conn (:uuid test-label))
+
+  (get-label conn (:uuid carrot) "my-label-test"))
  {:pre [(db-common/conn? conn)]}
  (timbre/debugf "Updating label %s (%s) for org %s user %s" (:name updating-label) (:uuid updating-label) (:org-uuid updating-label) (-> updating-label :author :user-id))
  (when-let [original-label (get-label conn label-uuid)]
    (let [updated-label (merge original-label (ignore-props updating-label))]
      (schema/validate common/Label updated-label)
      (db-common/update-resource conn table-name primary-key label-uuid updated-label))))


(ns oc.storage.resources.label
  (:require [oc.lib.schema :as lib-schema]
            [oc.lib.html :as lib-html]
            [taoensso.timbre :as timbre]
            [schema.core :as schema]
            [oc.storage.resources.common :as common]
