Merge remote-tracking branch 'origin/api-v1.7.0' into dev
This commit is contained in:
commit
20644140e2
5 changed files with 31 additions and 5 deletions
|
|
@ -860,7 +860,7 @@ def all_issue_types(context: schemas.CurrentContext = Depends(OR_context)):
|
|||
|
||||
|
||||
@app.get('/{projectId}/assist/sessions', tags=["assist"])
|
||||
def sessions_live(projectId: int, userId: str = None, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
def get_sessions_live(projectId: int, userId: str = None, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
data = assist.get_live_sessions_ws_user_id(projectId, user_id=userId)
|
||||
return {'data': data}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@ public_app, app, app_apikey = get_routers()
|
|||
@app_apikey.get('/v1/{projectKey}/users/{userId}/sessions', tags=["api"])
|
||||
def get_user_sessions(projectKey: str, userId: str, start_date: int = None, end_date: int = None):
|
||||
projectId = projects.get_internal_project_id(projectKey)
|
||||
|
||||
if projectId is None:
|
||||
return {"errors": ["invalid projectKey"]}
|
||||
return {
|
||||
'data': sessions.get_user_sessions(
|
||||
project_id=projectId,
|
||||
|
|
@ -26,6 +27,8 @@ def get_user_sessions(projectKey: str, userId: str, start_date: int = None, end_
|
|||
@app_apikey.get('/v1/{projectKey}/sessions/{sessionId}/events', tags=["api"])
|
||||
def get_session_events(projectKey: str, sessionId: int):
|
||||
projectId = projects.get_internal_project_id(projectKey)
|
||||
if projectId is None:
|
||||
return {"errors": ["invalid projectKey"]}
|
||||
return {
|
||||
'data': events.get_by_sessionId2_pg(
|
||||
project_id=projectId,
|
||||
|
|
@ -37,6 +40,8 @@ def get_session_events(projectKey: str, sessionId: int):
|
|||
@app_apikey.get('/v1/{projectKey}/users/{userId}', tags=["api"])
|
||||
def get_user_details(projectKey: str, userId: str):
|
||||
projectId = projects.get_internal_project_id(projectKey)
|
||||
if projectId is None:
|
||||
return {"errors": ["invalid projectKey"]}
|
||||
return {
|
||||
'data': sessions.get_session_user(
|
||||
project_id=projectId,
|
||||
|
|
@ -48,6 +53,8 @@ def get_user_details(projectKey: str, userId: str):
|
|||
@app_apikey.delete('/v1/{projectKey}/users/{userId}', tags=["api"])
|
||||
def schedule_to_delete_user_data(projectKey: str, userId: str):
|
||||
projectId = projects.get_internal_project_id(projectKey)
|
||||
if projectId is None:
|
||||
return {"errors": ["invalid projectKey"]}
|
||||
data = {"action": "delete_user_data",
|
||||
"reference_id": userId,
|
||||
"description": f"Delete user sessions of userId = {userId}",
|
||||
|
|
@ -61,6 +68,8 @@ def schedule_to_delete_user_data(projectKey: str, userId: str):
|
|||
@app_apikey.get('/v1/{projectKey}/jobs', tags=["api"])
|
||||
def get_jobs(projectKey: str):
|
||||
projectId = projects.get_internal_project_id(projectKey)
|
||||
if projectId is None:
|
||||
return {"errors": ["invalid projectKey"]}
|
||||
return {
|
||||
'data': jobs.get_all(project_id=projectId)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,8 +34,7 @@ def get_by_tenant_id(tenant_id):
|
|||
t.created_at,
|
||||
'{license.EDITION}' AS edition,
|
||||
t.version_number,
|
||||
t.opt_out,
|
||||
t.tenant_key
|
||||
t.opt_out
|
||||
FROM public.tenants AS t
|
||||
WHERE t.tenant_id = %(tenantId)s AND t.deleted_at ISNULL
|
||||
LIMIT 1;""",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#!/bin/bash
|
||||
bash env_vars.sh
|
||||
cd sourcemap-reader
|
||||
nohup npm start &> /tmp/sourcemap-reader.log &
|
||||
cd ..
|
||||
|
|
|
|||
|
|
@ -1,4 +1,10 @@
|
|||
from fastapi import Depends, Body
|
||||
|
||||
import schemas
|
||||
from chalicelib.utils import assist_helper
|
||||
from chalicelib.core import projects
|
||||
from or_dependencies import OR_context
|
||||
from routers import core
|
||||
from routers.base import get_routers
|
||||
|
||||
public_app, app, app_apikey = get_routers()
|
||||
|
|
@ -10,3 +16,16 @@ def get_assist_credentials():
|
|||
if "errors" in credentials:
|
||||
return credentials
|
||||
return {"data": credentials}
|
||||
|
||||
|
||||
@app_apikey.get('/v1/{projectKey}/assist/sessions', tags=["api"])
|
||||
def get_sessions_live(projectKey: str, userId: str = None, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return core.get_sessions_live(projectId=projects.get_internal_project_id(projectKey),
|
||||
userId=userId, context=context)
|
||||
|
||||
|
||||
@app_apikey.post('/v1/{projectKey}/assist/sessions', tags=["api"])
|
||||
def sessions_live(projectKey: int, data: schemas.LiveSessionsSearchPayloadSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return core.sessions_live(projectId=projects.get_internal_project_id(projectKey),
|
||||
data=data, context=context)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue