refactor(chalice): return file_key with first mob (#2980)
This commit is contained in:
parent
14f72dbbd7
commit
ac519a0a10
1 changed files with 16 additions and 0 deletions
|
|
@ -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)]}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue