refactor(chalice): return file_key with first mob

This commit is contained in:
Taha Yassine Kraiem 2025-01-28 16:06:04 +01:00
parent d50ad9e579
commit 693634fb14

View file

@ -21,7 +21,23 @@ def __group_metadata(session, project_metadata):
def get_pre_replay(project_id, session_id):
with pg_client.PostgresClient() as cur:
query = cur.mogrify(
f"""\
SELECT encode(file_key,'hex') AS file_key
FROM public.sessions
WHERE project_id = %(project_id)s
AND session_id = %(session_id)s;""",
{"project_id": project_id, "session_id": session_id}
)
cur.execute(query=query)
data = cur.fetchone()
file_key = None
if data is not None:
file_key = data['file_key']
return {
'fileKey': file_key,
'domURL': [sessions_mobs.get_first_url(project_id=project_id, session_id=session_id, check_existence=False)]}