feat(api): count recorded sessions endpoint
feat(nginx): block public access to count recorded sessions endpoint
This commit is contained in:
parent
33719cbc5a
commit
3cc3fc27a1
2 changed files with 11 additions and 0 deletions
|
|
@ -897,3 +897,8 @@ def sessions_live_search(projectId, context):
|
|||
def get_heatmaps_by_url(projectId, context):
|
||||
data = app.current_request.json_body
|
||||
return {"data": heatmaps.get_by_url(project_id=projectId, data=data)}
|
||||
|
||||
|
||||
@app.route('/general_stats', methods=['GET'], authorizer=None)
|
||||
def get_general_stats():
|
||||
return {"data": {"sessions:": sessions.count_all()}}
|
||||
|
|
|
|||
|
|
@ -765,3 +765,9 @@ def delete_sessions_by_user_ids(project_id, user_ids):
|
|||
cur.execute(query=query)
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def count_all():
|
||||
with pg_client.PostgresClient() as cur:
|
||||
row = cur.execute(query="SELECT COUNT(session_id) AS count FROM public.sessions")
|
||||
return row.get("count", 0)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue