fix(api): incorrect property type key

This commit is contained in:
charlie
2025-03-21 15:27:03 +08:00
parent c51d43332a
commit 1565e7541d
2 changed files with 7 additions and 3 deletions

View File

@@ -215,7 +215,7 @@ test('(DB graph): block related apis',
prop1 = await callAPI('get_property', 'map1')
const b1p = await callAPI('get_block_property', b1.uuid, 'map1')
expect(prop1.schema.type).toBe('map')
expect(prop1.type).toBe('map')
expect(b1p).toEqual({a: 1})
// await page.pause()

View File

@@ -903,7 +903,10 @@
[k]
(this-as this
(p/let [prop (-get-property this k)]
(bean/->js (sdk-utils/normalize-keyword-for-json prop)))))
(-> prop
(assoc :type (:logseq.property/type prop))
(sdk-utils/normalize-keyword-for-json)
(bean/->js)))))
(defn ^:export upsert_property
"schema:
@@ -929,7 +932,8 @@
(string? (:cardinality schema))
(update :cardinality keyword)
(string? (:type schema))
(update :type keyword))
(-> (assoc :logseq.property/type (keyword (:type schema)))
(dissoc :type)))
p (db-property-handler/upsert-property! k schema
(cond-> opts
name