Move daily briefings to personal scratchpads, project reports under Project Status Reports parent
This commit is contained in:
+7
-5
@@ -81,11 +81,12 @@ def wiki_headers():
|
||||
return {"Authorization": f"Bearer {WIKI_TOKEN}"}
|
||||
|
||||
|
||||
def find_child_doc(parent_id, title):
|
||||
def find_child_doc(parent_id, title, collection_id=None):
|
||||
"""Search for a child doc by title under a given parent."""
|
||||
coll = collection_id or WIKI_COLLECTION_ID
|
||||
result = api_request(
|
||||
f"{WIKI_API}/documents.search",
|
||||
data={"query": title, "collectionId": WIKI_COLLECTION_ID},
|
||||
data={"query": title, "collectionId": coll},
|
||||
headers=wiki_headers(),
|
||||
method="POST",
|
||||
)
|
||||
@@ -96,9 +97,10 @@ def find_child_doc(parent_id, title):
|
||||
return None
|
||||
|
||||
|
||||
def ensure_child_doc(parent_id, title, body):
|
||||
def ensure_child_doc(parent_id, title, body, collection_id=None):
|
||||
"""Find or create a child doc under a parent. Returns doc ID."""
|
||||
doc_id = find_child_doc(parent_id, title)
|
||||
coll = collection_id or WIKI_COLLECTION_ID
|
||||
doc_id = find_child_doc(parent_id, title, collection_id=coll)
|
||||
if doc_id:
|
||||
return doc_id
|
||||
result = api_request(
|
||||
@@ -106,7 +108,7 @@ def ensure_child_doc(parent_id, title, body):
|
||||
data={
|
||||
"title": title,
|
||||
"text": body,
|
||||
"collectionId": WIKI_COLLECTION_ID,
|
||||
"collectionId": coll,
|
||||
"parentDocumentId": parent_id,
|
||||
"publish": True,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user