mirror of
https://github.com/logseq/logseq.git
synced 2026-06-01 19:01:22 +00:00
enhance: get_tag_objects support either block/uuid or db ident
This commit is contained in:
@@ -1187,8 +1187,8 @@
|
||||
(db-api/remove-property property))))
|
||||
|
||||
(def ^:export get_all_tags db-api/get-all-tags)
|
||||
(def ^:export get-all-properties db-api/get-all-properties)
|
||||
(def ^:export get-tag-objects db-api/get-tag-objects)
|
||||
(def ^:export get_all_properties db-api/get-all-properties)
|
||||
(def ^:export get_tag_objects db-api/get-tag-objects)
|
||||
|
||||
;; file based graph APIs
|
||||
(def ^:export get_current_graph_templates file-api/get_current_graph_templates)
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
[frontend.handler.page :as page-handler]
|
||||
[frontend.modules.layout.core]
|
||||
[frontend.state :as state]
|
||||
[frontend.util :as util]
|
||||
[logseq.api.block :as api-block]
|
||||
[logseq.db :as ldb]
|
||||
[logseq.outliner.core :as outliner-core]
|
||||
@@ -109,11 +110,14 @@
|
||||
result->js))
|
||||
|
||||
(defn get-tag-objects
|
||||
[class-uuid]
|
||||
(let [id (sdk-utils/uuid-or-throw-error class-uuid)
|
||||
class (db/entity [:block/uuid id])]
|
||||
[class-uuid-or-ident]
|
||||
(let [eid (if (util/uuid-string? class-uuid-or-ident)
|
||||
(when-let [id (sdk-utils/uuid-or-throw-error class-uuid-or-ident)]
|
||||
[:block/uuid id])
|
||||
(keyword (api-block/sanitize-user-property-name class-uuid-or-ident)))
|
||||
class (db/entity eid)]
|
||||
(if-not class
|
||||
(throw (ex-info (str "Tag not exists with id: " class-uuid) {}))
|
||||
(throw (ex-info (str "Tag not exists with id: " eid) {}))
|
||||
(p/let [result (state/<invoke-db-worker :thread-api/get-class-objects
|
||||
(state/get-current-repo)
|
||||
(:db/id class))]
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
[m]
|
||||
(->> (remove (fn [[k _v]]
|
||||
(or (= "block.temp" (namespace k))
|
||||
(contains? #{:logseq.property.embedding/hnsw-label-updated-at} k))) m)
|
||||
(contains? #{:logseq.property.embedding/hnsw-label-updated-at :block/tx-id} k))) m)
|
||||
(into {})))
|
||||
|
||||
(defn normalize-keyword-for-json
|
||||
|
||||
Reference in New Issue
Block a user