Skip to content

Commit ea84580

Browse files
clean up document copy workflow
1 parent f6a8c1e commit ea84580

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

app/src/app/utils/api/apiHandlers/saveMap.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const saveMap = async (latestMetadata: DocumentMetadata | null) => {
1818
user_id: useMapStore.getState().userID,
1919
copy_from_doc:
2020
mapDocument?.access === 'read' && mapDocument?.public_id
21-
? mapDocument?.public_id
21+
? `${mapDocument?.public_id}`
2222
: mapDocument?.document_id,
2323
});
2424

backend/app/main.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ async def create_document(
206206
total_assignments = 0
207207

208208
if data.copy_from_doc is not None:
209-
copy_document_id = data.copy_from_doc
209+
copy_document_id = parse_document_id(data.copy_from_doc)
210210
if not copy_document_id:
211211
raise HTTPException(status_code=404, detail="Document not found")
212212
data.copy_from_doc = copy_document_id
@@ -252,8 +252,11 @@ async def create_document(
252252
)
253253

254254
if data.metadata is not None:
255+
logger.info(
256+
f"Updating metadata for document: {document_id if not data.copy_from_doc else copied_document.document_id}"
257+
)
255258
await update_districtrmap_metadata(
256-
document_id=document_id, metadata=data.metadata.dict(), session=session
259+
document=copied_document, metadata=data.metadata, session=session
257260
)
258261

259262
stmt = (

0 commit comments

Comments
 (0)