From 48bf849f4b04522af59e850e30cacc28ba4a4854 Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Thu, 16 Jan 2025 14:07:52 +0100 Subject: [PATCH] feat(api): session highlights get a single record --- api/chalicelib/core/sessions/sessions_notes.py | 1 + api/routers/core_dynamic.py | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/api/chalicelib/core/sessions/sessions_notes.py b/api/chalicelib/core/sessions/sessions_notes.py index aaef2fab6..e5790e51e 100644 --- a/api/chalicelib/core/sessions/sessions_notes.py +++ b/api/chalicelib/core/sessions/sessions_notes.py @@ -30,6 +30,7 @@ def get_note(tenant_id, project_id, user_id, note_id, share=None): row = helper.dict_to_camel_case(row) if row: row["createdAt"] = TimeUTC.datetime_to_timestamp(row["createdAt"]) + row["updatedAt"] = TimeUTC.datetime_to_timestamp(row["updatedAt"]) return row diff --git a/api/routers/core_dynamic.py b/api/routers/core_dynamic.py index 6c78fcc9f..79215fd4c 100644 --- a/api/routers/core_dynamic.py +++ b/api/routers/core_dynamic.py @@ -467,6 +467,17 @@ def comment_assignment(projectId: int, sessionId: int, issueId: str, } +@app.get('/{projectId}/notes/{noteId}', tags=["sessions", "notes"]) +def get_note_by_id(projectId: int, noteId: int, context: schemas.CurrentContext = Depends(OR_context)): + data = sessions_notes.get_note(tenant_id=context.tenant_id, project_id=projectId, note_id=noteId, + user_id=context.user_id) + if "errors" in data: + return data + return { + 'data': data + } + + @app.post('/{projectId}/sessions/{sessionId}/notes', tags=["sessions", "notes"]) def create_note(projectId: int, sessionId: int, data: schemas.SessionNoteSchema = Body(...), context: schemas.CurrentContext = Depends(OR_context)):