refactor(chalice): return file_key with first mob (#2980)

This commit is contained in:
Kraiem Taha Yassine 2025-01-28 16:07:17 +01:00 committed by GitHub
parent 14f72dbbd7
commit ac519a0a10
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -19,7 +19,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)]}