mirror of https://github.com/logseq/logseq
chore: property type vars should be in property.type
also remove unused :block and :uuid typespull/11196/head
parent
a70b7bfb26
commit
c29d4a3a70
|
@ -12,7 +12,7 @@
|
|||
|
||||
(def internal-built-in-property-types
|
||||
"Valid property types only for use by internal built-in-properties"
|
||||
#{:keyword :map :coll :any :uuid :entity})
|
||||
#{:keyword :map :coll :any :entity})
|
||||
|
||||
(def user-built-in-property-types
|
||||
"Valid property types for users in order they appear in the UI"
|
||||
|
@ -25,6 +25,13 @@
|
|||
(assert (set/subset? closed-value-property-types (set user-built-in-property-types))
|
||||
"All closed value types are valid property types")
|
||||
|
||||
(def ref-property-types #{:page :date :entity})
|
||||
|
||||
(assert (set/subset? ref-property-types
|
||||
(into internal-built-in-property-types
|
||||
user-built-in-property-types))
|
||||
"All ref types are valid property types")
|
||||
|
||||
(def ^:private user-built-in-allowed-schema-attributes
|
||||
"Map of types to their set of allowed :schema attributes"
|
||||
(merge-with into
|
||||
|
@ -120,7 +127,6 @@
|
|||
entity?]
|
||||
;; internal usage
|
||||
:keyword keyword?
|
||||
:uuid uuid?
|
||||
:map map?
|
||||
;; coll elements are ordered as it's saved as a vec
|
||||
:coll coll?
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
[datascript.impl.entity :as de]
|
||||
[datascript.core :as d]
|
||||
[cljs-bean.transit]
|
||||
[logseq.db.frontend.property.type :as db-property-type]
|
||||
[logseq.db.frontend.property :as db-property]))
|
||||
|
||||
(defonce db-version-prefix "logseq_db_")
|
||||
|
@ -65,8 +66,6 @@
|
|||
(assoc :block/created-at updated-at))]
|
||||
block))
|
||||
|
||||
(def property-ref-types #{:page :block :date :entity})
|
||||
|
||||
(defn build-new-property
|
||||
"Build a standard new property so that it is is consistent across contexts. Takes
|
||||
an optional map with following keys:
|
||||
|
@ -92,7 +91,7 @@
|
|||
:db/cardinality (if (= :many (:cardinality prop-schema))
|
||||
:db.cardinality/many
|
||||
:db.cardinality/one)}
|
||||
(contains? property-ref-types (:type prop-schema))
|
||||
(contains? db-property-type/ref-property-types (:type prop-schema))
|
||||
(assoc :db/valueType :db.type/ref))))))
|
||||
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@
|
|||
[property {:keys [type cardinality]}]
|
||||
(let [ident (:db/ident property)
|
||||
cardinality (if (= cardinality :many) :db.cardinality/many :db.cardinality/one)
|
||||
type-data (when (and type (sqlite-util/property-ref-types type)) ; type changes
|
||||
type-data (when (and type (db-property-type/ref-property-types type)) ; type changes
|
||||
{:db/ident ident
|
||||
:db/valueType :db.type/ref
|
||||
:db/cardinality cardinality})]
|
||||
|
@ -642,7 +642,7 @@
|
|||
icon
|
||||
(assoc :logseq.property/icon icon)))]
|
||||
(let [hidden-tx
|
||||
(if (contains? sqlite-util/property-ref-types (:type property-schema))
|
||||
(if (contains? db-property-type/ref-property-types (:type property-schema))
|
||||
[]
|
||||
(let [page (get-property-hidden-page property)
|
||||
new-block (db-property-util/build-closed-value-block block-id resolved-value [:block/uuid (:block/uuid page)]
|
||||
|
@ -653,7 +653,7 @@
|
|||
(conj page)
|
||||
true
|
||||
(conj new-block))))
|
||||
new-values (if (contains? sqlite-util/property-ref-types (:type property-schema))
|
||||
new-values (if (contains? db-property-type/ref-property-types (:type property-schema))
|
||||
(vec (conj closed-values (:block/uuid (db/entity resolved-value))))
|
||||
(vec (conj closed-values block-id)))]
|
||||
(conj hidden-tx
|
||||
|
|
Loading…
Reference in New Issue