fix(apis): refine schema handling for property visibility and type

This commit is contained in:
charlie
2026-05-22 17:13:37 +08:00
parent a50407846f
commit 43dd736aca

View File

@@ -132,7 +132,7 @@
property-ident (api-block/get-db-ident-from-property-name k' this)
_ (api-block/ensure-property-upsert-control this property-ident k')
schema (or (some-> schema
(update-keys #(if (contains? #{:hide :public} %)
(update-keys #(if (contains? #{:public} %)
(keyword (str (name %) "?")) %)))
{})
_ (when (:type schema)
@@ -140,11 +140,15 @@
schema (cond-> schema
(string? (:cardinality schema))
(-> (assoc :db/cardinality (->cardinality (:cardinality schema)))
(dissoc :cardinality))
(dissoc :cardinality))
(boolean? (:hide schema))
(-> (assoc :logseq.property/hide? (:hide schema))
(dissoc :hide))
(string? (:type schema))
(-> (assoc :logseq.property/type (keyword (:type schema)))
(dissoc :type)))
(dissoc :type)))
p (db-property-handler/upsert-property! property-ident schema
(assoc opts :property-name k'))]
(db/entity (:db/id p))))