|
@@ -1,39 +1,39 @@
|
|
|
(ns frontend.handler.property
|
|
(ns frontend.handler.property
|
|
|
"Block properties handler."
|
|
"Block properties handler."
|
|
|
- (:require [frontend.handler.db-based.property :as db-property]
|
|
|
|
|
|
|
+ (:require [frontend.handler.db-based.property :as db-property-handler]
|
|
|
[frontend.handler.file-based.property :as file-property]
|
|
[frontend.handler.file-based.property :as file-property]
|
|
|
[frontend.config :as config]
|
|
[frontend.config :as config]
|
|
|
[frontend.state :as state]
|
|
[frontend.state :as state]
|
|
|
[frontend.db :as db]))
|
|
[frontend.db :as db]))
|
|
|
|
|
|
|
|
-(def user-face-builtin-schema-types db-property/user-face-builtin-schema-types)
|
|
|
|
|
-(def internal-builtin-schema-types db-property/internal-builtin-schema-types)
|
|
|
|
|
|
|
+(def user-face-builtin-schema-types db-property-handler/user-face-builtin-schema-types)
|
|
|
|
|
+(def internal-builtin-schema-types db-property-handler/internal-builtin-schema-types)
|
|
|
|
|
|
|
|
(defn remove-block-property!
|
|
(defn remove-block-property!
|
|
|
[repo block-id key]
|
|
[repo block-id key]
|
|
|
(if (config/db-based-graph? repo)
|
|
(if (config/db-based-graph? repo)
|
|
|
- (db-property/remove-block-property! repo block-id key)
|
|
|
|
|
|
|
+ (db-property-handler/remove-block-property! repo block-id key)
|
|
|
(file-property/remove-block-property! block-id key)))
|
|
(file-property/remove-block-property! block-id key)))
|
|
|
|
|
|
|
|
(defn set-block-property!
|
|
(defn set-block-property!
|
|
|
[repo block-id key v & opts]
|
|
[repo block-id key v & opts]
|
|
|
(if (config/db-based-graph? repo)
|
|
(if (config/db-based-graph? repo)
|
|
|
(if (nil? v)
|
|
(if (nil? v)
|
|
|
- (db-property/remove-block-property! repo block-id key)
|
|
|
|
|
- (db-property/set-block-property! repo block-id key v opts))
|
|
|
|
|
|
|
+ (db-property-handler/remove-block-property! repo block-id key)
|
|
|
|
|
+ (db-property-handler/set-block-property! repo block-id key v opts))
|
|
|
(file-property/set-block-property! block-id key v)))
|
|
(file-property/set-block-property! block-id key v)))
|
|
|
|
|
|
|
|
(defn update-property!
|
|
(defn update-property!
|
|
|
[repo property-uuid opts]
|
|
[repo property-uuid opts]
|
|
|
{:pre [(uuid? property-uuid)]}
|
|
{:pre [(uuid? property-uuid)]}
|
|
|
(when (config/db-based-graph? repo)
|
|
(when (config/db-based-graph? repo)
|
|
|
- (db-property/update-property! repo property-uuid opts)))
|
|
|
|
|
|
|
+ (db-property-handler/update-property! repo property-uuid opts)))
|
|
|
|
|
|
|
|
(defn delete-property-value!
|
|
(defn delete-property-value!
|
|
|
"Delete value if a property has multiple values"
|
|
"Delete value if a property has multiple values"
|
|
|
[repo block property-id property-value]
|
|
[repo block property-id property-value]
|
|
|
(when (config/db-based-graph? repo)
|
|
(when (config/db-based-graph? repo)
|
|
|
- (db-property/delete-property-value! repo block property-id property-value)))
|
|
|
|
|
|
|
+ (db-property-handler/delete-property-value! repo block property-id property-value)))
|
|
|
|
|
|
|
|
(defn set-editing-new-property!
|
|
(defn set-editing-new-property!
|
|
|
[value]
|
|
[value]
|
|
@@ -48,13 +48,13 @@
|
|
|
[repo class-uuid k-name]
|
|
[repo class-uuid k-name]
|
|
|
(when-let [class (db/entity repo [:block/uuid class-uuid])]
|
|
(when-let [class (db/entity repo [:block/uuid class-uuid])]
|
|
|
(when (config/db-based-graph? repo)
|
|
(when (config/db-based-graph? repo)
|
|
|
- (db-property/class-add-property! repo class k-name))))
|
|
|
|
|
|
|
+ (db-property-handler/class-add-property! repo class k-name))))
|
|
|
|
|
|
|
|
(defn class-remove-property!
|
|
(defn class-remove-property!
|
|
|
[repo class-uuid k-uuid]
|
|
[repo class-uuid k-uuid]
|
|
|
(when-let [class (db/entity repo [:block/uuid class-uuid])]
|
|
(when-let [class (db/entity repo [:block/uuid class-uuid])]
|
|
|
(when (config/db-based-graph? repo)
|
|
(when (config/db-based-graph? repo)
|
|
|
- (db-property/class-remove-property! repo class k-uuid))))
|
|
|
|
|
|
|
+ (db-property-handler/class-remove-property! repo class k-uuid))))
|
|
|
|
|
|
|
|
(defn remove-id-property
|
|
(defn remove-id-property
|
|
|
[repo format content]
|
|
[repo format content]
|
|
@@ -70,15 +70,15 @@
|
|
|
(defn batch-remove-block-property!
|
|
(defn batch-remove-block-property!
|
|
|
[repo block-ids key]
|
|
[repo block-ids key]
|
|
|
(if (config/db-based-graph? repo)
|
|
(if (config/db-based-graph? repo)
|
|
|
- (db-property/batch-remove-property! repo block-ids key)
|
|
|
|
|
|
|
+ (db-property-handler/batch-remove-property! repo block-ids key)
|
|
|
(file-property/batch-remove-block-property! block-ids key)))
|
|
(file-property/batch-remove-block-property! block-ids key)))
|
|
|
|
|
|
|
|
(defn batch-set-block-property!
|
|
(defn batch-set-block-property!
|
|
|
[repo block-ids key value]
|
|
[repo block-ids key value]
|
|
|
(if (config/db-based-graph? repo)
|
|
(if (config/db-based-graph? repo)
|
|
|
(if (nil? value)
|
|
(if (nil? value)
|
|
|
- (db-property/batch-remove-property! repo block-ids key)
|
|
|
|
|
- (db-property/batch-set-property! repo block-ids key value))
|
|
|
|
|
|
|
+ (db-property-handler/batch-remove-property! repo block-ids key)
|
|
|
|
|
+ (db-property-handler/batch-set-property! repo block-ids key value))
|
|
|
(file-property/batch-set-block-property! block-ids key value)))
|
|
(file-property/batch-set-block-property! block-ids key value)))
|
|
|
|
|
|
|
|
(defn file-batch-set-property!
|
|
(defn file-batch-set-property!
|
|
@@ -89,5 +89,5 @@
|
|
|
(defn replace-key-with-id!
|
|
(defn replace-key-with-id!
|
|
|
[repo m]
|
|
[repo m]
|
|
|
(if (config/db-based-graph? repo)
|
|
(if (config/db-based-graph? repo)
|
|
|
- (db-property/replace-key-with-id! m)
|
|
|
|
|
|
|
+ (db-property-handler/replace-key-with-id! m)
|
|
|
m))
|
|
m))
|