feat(chalice): full async endpoints
This commit is contained in:
parent
d5d20404c2
commit
2424cc4749
4 changed files with 214 additions and 214 deletions
|
|
@ -23,7 +23,7 @@ public_app, app, app_apikey = get_routers()
|
|||
|
||||
|
||||
@public_app.post('/login', tags=["authentication"])
|
||||
def login(data: schemas.UserLoginSchema = Body(...)):
|
||||
async def login(data: schemas.UserLoginSchema = Body(...)):
|
||||
if helper.allow_captcha() and not captcha.is_valid(data.g_recaptcha_response):
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||
|
|
@ -56,27 +56,27 @@ def login(data: schemas.UserLoginSchema = Body(...)):
|
|||
|
||||
|
||||
@app.get('/logout', tags=["login", "logout"])
|
||||
def logout_user(response: Response, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def logout_user(response: Response, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
response.delete_cookie("jwt")
|
||||
return {"data": "success"}
|
||||
|
||||
|
||||
@app.post('/{projectId}/sessions/search', tags=["sessions"])
|
||||
def sessions_search(projectId: int, data: schemas.FlatSessionsSearchPayloadSchema = Body(...),
|
||||
async def sessions_search(projectId: int, data: schemas.FlatSessionsSearchPayloadSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
data = sessions.search_sessions(data=data, project_id=projectId, user_id=context.user_id)
|
||||
return {'data': data}
|
||||
|
||||
|
||||
@app.post('/{projectId}/sessions/search/ids', tags=["sessions"])
|
||||
def session_ids_search(projectId: int, data: schemas.FlatSessionsSearchPayloadSchema = Body(...),
|
||||
async def session_ids_search(projectId: int, data: schemas.FlatSessionsSearchPayloadSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
data = sessions.search_sessions(data=data, project_id=projectId, user_id=context.user_id, ids_only=True)
|
||||
return {'data': data}
|
||||
|
||||
|
||||
@app.get('/{projectId}/events/search', tags=["events"])
|
||||
def events_search(projectId: int, q: str,
|
||||
async def events_search(projectId: int, q: str,
|
||||
type: Union[schemas.FilterType, schemas.EventType,
|
||||
schemas.PerformanceEventType, schemas.FetchFilterType,
|
||||
schemas.GraphqlFilterType, str] = None,
|
||||
|
|
@ -108,7 +108,7 @@ def events_search(projectId: int, q: str,
|
|||
|
||||
|
||||
@app.get('/{projectId}/integrations', tags=["integrations"])
|
||||
def get_integrations_status(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_integrations_status(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
data = integrations_global.get_global_integrations_status(tenant_id=context.tenant_id,
|
||||
user_id=context.user_id,
|
||||
project_id=projectId)
|
||||
|
|
@ -116,7 +116,7 @@ def get_integrations_status(projectId: int, context: schemas.CurrentContext = De
|
|||
|
||||
|
||||
@app.post('/{projectId}/integrations/{integration}/notify/{webhookId}/{source}/{sourceId}', tags=["integrations"])
|
||||
def integration_notify(projectId: int, integration: str, webhookId: int, source: str, sourceId: str,
|
||||
async def integration_notify(projectId: int, integration: str, webhookId: int, source: str, sourceId: str,
|
||||
data: schemas.IntegrationNotificationSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
comment = None
|
||||
|
|
@ -140,144 +140,144 @@ def integration_notify(projectId: int, integration: str, webhookId: int, source:
|
|||
|
||||
|
||||
@app.get('/integrations/sentry', tags=["integrations"])
|
||||
def get_all_sentry(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_all_sentry(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_sentry.get_all(tenant_id=context.tenant_id)}
|
||||
|
||||
|
||||
@app.get('/{projectId}/integrations/sentry', tags=["integrations"])
|
||||
def get_sentry(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_sentry(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_sentry.get(project_id=projectId)}
|
||||
|
||||
|
||||
@app.post('/{projectId}/integrations/sentry', tags=["integrations"])
|
||||
def add_edit_sentry(projectId: int, data: schemas.SentrySchema = Body(...),
|
||||
async def add_edit_sentry(projectId: int, data: schemas.SentrySchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_sentry.add_edit(tenant_id=context.tenant_id, project_id=projectId, data=data.dict())}
|
||||
|
||||
|
||||
@app.delete('/{projectId}/integrations/sentry', tags=["integrations"])
|
||||
def delete_sentry(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_sentry(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_sentry.delete(tenant_id=context.tenant_id, project_id=projectId)}
|
||||
|
||||
|
||||
@app.get('/{projectId}/integrations/sentry/events/{eventId}', tags=["integrations"])
|
||||
def proxy_sentry(projectId: int, eventId: str, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def proxy_sentry(projectId: int, eventId: str, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_sentry.proxy_get(tenant_id=context.tenant_id, project_id=projectId, event_id=eventId)}
|
||||
|
||||
|
||||
@app.get('/integrations/datadog', tags=["integrations"])
|
||||
def get_all_datadog(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_all_datadog(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_datadog.get_all(tenant_id=context.tenant_id)}
|
||||
|
||||
|
||||
@app.get('/{projectId}/integrations/datadog', tags=["integrations"])
|
||||
def get_datadog(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_datadog(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_datadog.get(project_id=projectId)}
|
||||
|
||||
|
||||
@app.post('/{projectId}/integrations/datadog', tags=["integrations"])
|
||||
def add_edit_datadog(projectId: int, data: schemas.DatadogSchema = Body(...),
|
||||
async def add_edit_datadog(projectId: int, data: schemas.DatadogSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_datadog.add_edit(tenant_id=context.tenant_id, project_id=projectId, data=data.dict())}
|
||||
|
||||
|
||||
@app.delete('/{projectId}/integrations/datadog', tags=["integrations"])
|
||||
def delete_datadog(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_datadog(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_datadog.delete(tenant_id=context.tenant_id, project_id=projectId)}
|
||||
|
||||
|
||||
@app.get('/integrations/stackdriver', tags=["integrations"])
|
||||
def get_all_stackdriver(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_all_stackdriver(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_stackdriver.get_all(tenant_id=context.tenant_id)}
|
||||
|
||||
|
||||
@app.get('/{projectId}/integrations/stackdriver', tags=["integrations"])
|
||||
def get_stackdriver(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_stackdriver(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_stackdriver.get(project_id=projectId)}
|
||||
|
||||
|
||||
@app.post('/{projectId}/integrations/stackdriver', tags=["integrations"])
|
||||
def add_edit_stackdriver(projectId: int, data: schemas.StackdriverSchema = Body(...),
|
||||
async def add_edit_stackdriver(projectId: int, data: schemas.StackdriverSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_stackdriver.add_edit(tenant_id=context.tenant_id, project_id=projectId, data=data.dict())}
|
||||
|
||||
|
||||
@app.delete('/{projectId}/integrations/stackdriver', tags=["integrations"])
|
||||
def delete_stackdriver(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_stackdriver(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_stackdriver.delete(tenant_id=context.tenant_id, project_id=projectId)}
|
||||
|
||||
|
||||
@app.get('/integrations/newrelic', tags=["integrations"])
|
||||
def get_all_newrelic(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_all_newrelic(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_newrelic.get_all(tenant_id=context.tenant_id)}
|
||||
|
||||
|
||||
@app.get('/{projectId}/integrations/newrelic', tags=["integrations"])
|
||||
def get_newrelic(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_newrelic(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_newrelic.get(project_id=projectId)}
|
||||
|
||||
|
||||
@app.post('/{projectId}/integrations/newrelic', tags=["integrations"])
|
||||
def add_edit_newrelic(projectId: int, data: schemas.NewrelicSchema = Body(...),
|
||||
async def add_edit_newrelic(projectId: int, data: schemas.NewrelicSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_newrelic.add_edit(tenant_id=context.tenant_id, project_id=projectId, data=data.dict())}
|
||||
|
||||
|
||||
@app.delete('/{projectId}/integrations/newrelic', tags=["integrations"])
|
||||
def delete_newrelic(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_newrelic(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_newrelic.delete(tenant_id=context.tenant_id, project_id=projectId)}
|
||||
|
||||
|
||||
@app.get('/integrations/rollbar', tags=["integrations"])
|
||||
def get_all_rollbar(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_all_rollbar(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_rollbar.get_all(tenant_id=context.tenant_id)}
|
||||
|
||||
|
||||
@app.get('/{projectId}/integrations/rollbar', tags=["integrations"])
|
||||
def get_rollbar(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_rollbar(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_rollbar.get(project_id=projectId)}
|
||||
|
||||
|
||||
@app.post('/{projectId}/integrations/rollbar', tags=["integrations"])
|
||||
def add_edit_rollbar(projectId: int, data: schemas.RollbarSchema = Body(...),
|
||||
async def add_edit_rollbar(projectId: int, data: schemas.RollbarSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_rollbar.add_edit(tenant_id=context.tenant_id, project_id=projectId, data=data.dict())}
|
||||
|
||||
|
||||
@app.delete('/{projectId}/integrations/rollbar', tags=["integrations"])
|
||||
def delete_datadog(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_datadog(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_rollbar.delete(tenant_id=context.tenant_id, project_id=projectId)}
|
||||
|
||||
|
||||
@app.post('/integrations/bugsnag/list_projects', tags=["integrations"])
|
||||
def list_projects_bugsnag(data: schemas.BugsnagBasicSchema = Body(...),
|
||||
async def list_projects_bugsnag(data: schemas.BugsnagBasicSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_bugsnag.list_projects(auth_token=data.authorizationToken)}
|
||||
|
||||
|
||||
@app.get('/integrations/bugsnag', tags=["integrations"])
|
||||
def get_all_bugsnag(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_all_bugsnag(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_bugsnag.get_all(tenant_id=context.tenant_id)}
|
||||
|
||||
|
||||
@app.get('/{projectId}/integrations/bugsnag', tags=["integrations"])
|
||||
def get_bugsnag(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_bugsnag(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_bugsnag.get(project_id=projectId)}
|
||||
|
||||
|
||||
@app.post('/{projectId}/integrations/bugsnag', tags=["integrations"])
|
||||
def add_edit_bugsnag(projectId: int, data: schemas.BugsnagSchema = Body(...),
|
||||
async def add_edit_bugsnag(projectId: int, data: schemas.BugsnagSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_bugsnag.add_edit(tenant_id=context.tenant_id, project_id=projectId, data=data.dict())}
|
||||
|
||||
|
||||
@app.delete('/{projectId}/integrations/bugsnag', tags=["integrations"])
|
||||
def delete_bugsnag(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_bugsnag(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_bugsnag.delete(tenant_id=context.tenant_id, project_id=projectId)}
|
||||
|
||||
|
||||
@app.post('/integrations/cloudwatch/list_groups', tags=["integrations"])
|
||||
def list_groups_cloudwatch(data: schemas.CloudwatchBasicSchema = Body(...),
|
||||
async def list_groups_cloudwatch(data: schemas.CloudwatchBasicSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_cloudwatch.list_log_groups(aws_access_key_id=data.awsAccessKeyId,
|
||||
aws_secret_access_key=data.awsSecretAccessKey,
|
||||
|
|
@ -285,77 +285,77 @@ def list_groups_cloudwatch(data: schemas.CloudwatchBasicSchema = Body(...),
|
|||
|
||||
|
||||
@app.get('/integrations/cloudwatch', tags=["integrations"])
|
||||
def get_all_cloudwatch(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_all_cloudwatch(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_cloudwatch.get_all(tenant_id=context.tenant_id)}
|
||||
|
||||
|
||||
@app.get('/{projectId}/integrations/cloudwatch', tags=["integrations"])
|
||||
def get_cloudwatch(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_cloudwatch(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_cloudwatch.get(project_id=projectId)}
|
||||
|
||||
|
||||
@app.post('/{projectId}/integrations/cloudwatch', tags=["integrations"])
|
||||
def add_edit_cloudwatch(projectId: int, data: schemas.CloudwatchSchema = Body(...),
|
||||
async def add_edit_cloudwatch(projectId: int, data: schemas.CloudwatchSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_cloudwatch.add_edit(tenant_id=context.tenant_id, project_id=projectId, data=data.dict())}
|
||||
|
||||
|
||||
@app.delete('/{projectId}/integrations/cloudwatch', tags=["integrations"])
|
||||
def delete_cloudwatch(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_cloudwatch(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_cloudwatch.delete(tenant_id=context.tenant_id, project_id=projectId)}
|
||||
|
||||
|
||||
@app.get('/integrations/elasticsearch', tags=["integrations"])
|
||||
def get_all_elasticsearch(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_all_elasticsearch(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_elasticsearch.get_all(tenant_id=context.tenant_id)}
|
||||
|
||||
|
||||
@app.get('/{projectId}/integrations/elasticsearch', tags=["integrations"])
|
||||
def get_elasticsearch(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_elasticsearch(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_elasticsearch.get(project_id=projectId)}
|
||||
|
||||
|
||||
@app.post('/integrations/elasticsearch/test', tags=["integrations"])
|
||||
def test_elasticsearch_connection(data: schemas.ElasticsearchBasicSchema = Body(...),
|
||||
async def test_elasticsearch_connection(data: schemas.ElasticsearchBasicSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_elasticsearch.ping(tenant_id=context.tenant_id, **data.dict())}
|
||||
|
||||
|
||||
@app.post('/{projectId}/integrations/elasticsearch', tags=["integrations"])
|
||||
def add_edit_elasticsearch(projectId: int, data: schemas.ElasticsearchSchema = Body(...),
|
||||
async def add_edit_elasticsearch(projectId: int, data: schemas.ElasticsearchSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {
|
||||
"data": log_tool_elasticsearch.add_edit(tenant_id=context.tenant_id, project_id=projectId, data=data.dict())}
|
||||
|
||||
|
||||
@app.delete('/{projectId}/integrations/elasticsearch', tags=["integrations"])
|
||||
def delete_elasticsearch(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_elasticsearch(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_elasticsearch.delete(tenant_id=context.tenant_id, project_id=projectId)}
|
||||
|
||||
|
||||
@app.get('/integrations/sumologic', tags=["integrations"])
|
||||
def get_all_sumologic(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_all_sumologic(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_sumologic.get_all(tenant_id=context.tenant_id)}
|
||||
|
||||
|
||||
@app.get('/{projectId}/integrations/sumologic', tags=["integrations"])
|
||||
def get_sumologic(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_sumologic(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_sumologic.get(project_id=projectId)}
|
||||
|
||||
|
||||
@app.post('/{projectId}/integrations/sumologic', tags=["integrations"])
|
||||
def add_edit_sumologic(projectId: int, data: schemas.SumologicSchema = Body(...),
|
||||
async def add_edit_sumologic(projectId: int, data: schemas.SumologicSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_sumologic.add_edit(tenant_id=context.tenant_id, project_id=projectId, data=data.dict())}
|
||||
|
||||
|
||||
@app.delete('/{projectId}/integrations/sumologic', tags=["integrations"])
|
||||
def delete_sumologic(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_sumologic(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": log_tool_sumologic.delete(tenant_id=context.tenant_id, project_id=projectId)}
|
||||
|
||||
|
||||
@app.get('/integrations/issues', tags=["integrations"])
|
||||
def get_integration_status(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_integration_status(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
error, integration = integrations_manager.get_integration(tenant_id=context.tenant_id,
|
||||
user_id=context.user_id)
|
||||
if error is not None and integration is None:
|
||||
|
|
@ -364,7 +364,7 @@ def get_integration_status(context: schemas.CurrentContext = Depends(OR_context)
|
|||
|
||||
|
||||
@app.get('/integrations/jira', tags=["integrations"])
|
||||
def get_integration_status_jira(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_integration_status_jira(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
error, integration = integrations_manager.get_integration(tenant_id=context.tenant_id,
|
||||
user_id=context.user_id,
|
||||
tool=integration_jira_cloud.PROVIDER)
|
||||
|
|
@ -374,7 +374,7 @@ def get_integration_status_jira(context: schemas.CurrentContext = Depends(OR_con
|
|||
|
||||
|
||||
@app.get('/integrations/github', tags=["integrations"])
|
||||
def get_integration_status_github(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_integration_status_github(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
error, integration = integrations_manager.get_integration(tenant_id=context.tenant_id,
|
||||
user_id=context.user_id,
|
||||
tool=integration_github.PROVIDER)
|
||||
|
|
@ -384,7 +384,7 @@ def get_integration_status_github(context: schemas.CurrentContext = Depends(OR_c
|
|||
|
||||
|
||||
@app.post('/integrations/jira', tags=["integrations"])
|
||||
def add_edit_jira_cloud(data: schemas.JiraSchema = Body(...),
|
||||
async def add_edit_jira_cloud(data: schemas.JiraSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
if not data.url.endswith('atlassian.net'):
|
||||
return {"errors": ["url must be a valid JIRA URL (example.atlassian.net)"]}
|
||||
|
|
@ -397,7 +397,7 @@ def add_edit_jira_cloud(data: schemas.JiraSchema = Body(...),
|
|||
|
||||
|
||||
@app.post('/integrations/github', tags=["integrations"])
|
||||
def add_edit_github(data: schemas.GithubSchema = Body(...),
|
||||
async def add_edit_github(data: schemas.GithubSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
error, integration = integrations_manager.get_integration(tool=integration_github.PROVIDER,
|
||||
tenant_id=context.tenant_id,
|
||||
|
|
@ -408,7 +408,7 @@ def add_edit_github(data: schemas.GithubSchema = Body(...),
|
|||
|
||||
|
||||
@app.delete('/integrations/issues', tags=["integrations"])
|
||||
def delete_default_issue_tracking_tool(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_default_issue_tracking_tool(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
error, integration = integrations_manager.get_integration(tenant_id=context.tenant_id,
|
||||
user_id=context.user_id)
|
||||
if error is not None and integration is None:
|
||||
|
|
@ -417,7 +417,7 @@ def delete_default_issue_tracking_tool(context: schemas.CurrentContext = Depends
|
|||
|
||||
|
||||
@app.delete('/integrations/jira', tags=["integrations"])
|
||||
def delete_jira_cloud(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_jira_cloud(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
error, integration = integrations_manager.get_integration(tool=integration_jira_cloud.PROVIDER,
|
||||
tenant_id=context.tenant_id,
|
||||
user_id=context.user_id,
|
||||
|
|
@ -428,7 +428,7 @@ def delete_jira_cloud(context: schemas.CurrentContext = Depends(OR_context)):
|
|||
|
||||
|
||||
@app.delete('/integrations/github', tags=["integrations"])
|
||||
def delete_github(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_github(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
error, integration = integrations_manager.get_integration(tool=integration_github.PROVIDER,
|
||||
tenant_id=context.tenant_id,
|
||||
user_id=context.user_id,
|
||||
|
|
@ -439,7 +439,7 @@ def delete_github(context: schemas.CurrentContext = Depends(OR_context)):
|
|||
|
||||
|
||||
@app.get('/integrations/issues/list_projects', tags=["integrations"])
|
||||
def get_all_issue_tracking_projects(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_all_issue_tracking_projects(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
error, integration = integrations_manager.get_integration(tenant_id=context.tenant_id,
|
||||
user_id=context.user_id)
|
||||
if error is not None:
|
||||
|
|
@ -451,7 +451,7 @@ def get_all_issue_tracking_projects(context: schemas.CurrentContext = Depends(OR
|
|||
|
||||
|
||||
@app.get('/integrations/issues/{integrationProjectId}', tags=["integrations"])
|
||||
def get_integration_metadata(integrationProjectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_integration_metadata(integrationProjectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
error, integration = integrations_manager.get_integration(tenant_id=context.tenant_id,
|
||||
user_id=context.user_id)
|
||||
if error is not None:
|
||||
|
|
@ -463,7 +463,7 @@ def get_integration_metadata(integrationProjectId: int, context: schemas.Current
|
|||
|
||||
|
||||
@app.get('/{projectId}/assignments', tags=["assignment"])
|
||||
def get_all_assignments(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_all_assignments(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
data = sessions_assignments.get_all(project_id=projectId, user_id=context.user_id)
|
||||
return {
|
||||
'data': data
|
||||
|
|
@ -471,7 +471,7 @@ def get_all_assignments(projectId: int, context: schemas.CurrentContext = Depend
|
|||
|
||||
|
||||
@app.post('/{projectId}/sessions/{sessionId}/assign/projects/{integrationProjectId}', tags=["assignment"])
|
||||
def create_issue_assignment(projectId: int, sessionId: int, integrationProjectId,
|
||||
async def create_issue_assignment(projectId: int, sessionId: int, integrationProjectId,
|
||||
data: schemas.AssignmentSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
data = sessions_assignments.create_new_assignment(tenant_id=context.tenant_id, project_id=projectId,
|
||||
|
|
@ -488,12 +488,12 @@ def create_issue_assignment(projectId: int, sessionId: int, integrationProjectId
|
|||
|
||||
|
||||
@app.get('/{projectId}/gdpr', tags=["projects", "gdpr"])
|
||||
def get_gdpr(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_gdpr(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": projects.get_gdpr(project_id=projectId)}
|
||||
|
||||
|
||||
@app.post('/{projectId}/gdpr', tags=["projects", "gdpr"])
|
||||
def edit_gdpr(projectId: int, data: schemas.GdprSchema = Body(...),
|
||||
async def edit_gdpr(projectId: int, data: schemas.GdprSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
result = projects.edit_gdpr(project_id=projectId, gdpr=data.dict())
|
||||
if "errors" in result:
|
||||
|
|
@ -502,43 +502,43 @@ def edit_gdpr(projectId: int, data: schemas.GdprSchema = Body(...),
|
|||
|
||||
|
||||
@public_app.post('/password/reset-link', tags=["reset password"])
|
||||
def reset_password_handler(data: schemas.ForgetPasswordPayloadSchema = Body(...)):
|
||||
async def reset_password_handler(data: schemas.ForgetPasswordPayloadSchema = Body(...)):
|
||||
if len(data.email) < 5:
|
||||
return {"errors": ["please provide a valid email address"]}
|
||||
return reset_password.reset(data=data)
|
||||
|
||||
|
||||
@app.get('/{projectId}/metadata', tags=["metadata"])
|
||||
def get_metadata(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_metadata(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": metadata.get(project_id=projectId)}
|
||||
|
||||
|
||||
@app.post('/{projectId}/metadata/list', tags=["metadata"])
|
||||
def add_edit_delete_metadata(projectId: int, data: schemas.MetadataListSchema = Body(...),
|
||||
async def add_edit_delete_metadata(projectId: int, data: schemas.MetadataListSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return metadata.add_edit_delete(tenant_id=context.tenant_id, project_id=projectId, new_metas=data.list)
|
||||
|
||||
|
||||
@app.post('/{projectId}/metadata', tags=["metadata"])
|
||||
def add_metadata(projectId: int, data: schemas.MetadataBasicSchema = Body(...),
|
||||
async def add_metadata(projectId: int, data: schemas.MetadataBasicSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return metadata.add(tenant_id=context.tenant_id, project_id=projectId, new_name=data.key)
|
||||
|
||||
|
||||
@app.post('/{projectId}/metadata/{index}', tags=["metadata"])
|
||||
def edit_metadata(projectId: int, index: int, data: schemas.MetadataBasicSchema = Body(...),
|
||||
async def edit_metadata(projectId: int, index: int, data: schemas.MetadataBasicSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return metadata.edit(tenant_id=context.tenant_id, project_id=projectId, index=index,
|
||||
new_name=data.key)
|
||||
|
||||
|
||||
@app.delete('/{projectId}/metadata/{index}', tags=["metadata"])
|
||||
def delete_metadata(projectId: int, index: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_metadata(projectId: int, index: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return metadata.delete(tenant_id=context.tenant_id, project_id=projectId, index=index)
|
||||
|
||||
|
||||
@app.get('/{projectId}/metadata/search', tags=["metadata"])
|
||||
def search_metadata(projectId: int, q: str, key: str, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def search_metadata(projectId: int, q: str, key: str, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
if len(q) == 0 and len(key) == 0:
|
||||
return {"data": []}
|
||||
if len(q) == 0:
|
||||
|
|
@ -549,72 +549,72 @@ def search_metadata(projectId: int, q: str, key: str, context: schemas.CurrentCo
|
|||
|
||||
|
||||
@app.get('/{projectId}/integration/sources', tags=["integrations"])
|
||||
def search_integrations(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def search_integrations(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return log_tools.search(project_id=projectId)
|
||||
|
||||
|
||||
@app.get('/{projectId}/sample_rate', tags=["projects"])
|
||||
def get_capture_status(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_capture_status(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": projects.get_capture_status(project_id=projectId)}
|
||||
|
||||
|
||||
@app.post('/{projectId}/sample_rate', tags=["projects"])
|
||||
def update_capture_status(projectId: int, data: schemas.SampleRateSchema = Body(...),
|
||||
async def update_capture_status(projectId: int, data: schemas.SampleRateSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": projects.update_capture_status(project_id=projectId, changes=data.dict())}
|
||||
|
||||
|
||||
@app.get('/announcements', tags=["announcements"])
|
||||
def get_all_announcements(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_all_announcements(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": announcements.get_all(user_id=context.user_id)}
|
||||
|
||||
|
||||
@app.get('/announcements/view', tags=["announcements"])
|
||||
def get_all_announcements(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_all_announcements(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": announcements.view(user_id=context.user_id)}
|
||||
|
||||
|
||||
@app.get('/show_banner', tags=["banner"])
|
||||
def errors_merge(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def errors_merge(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": False}
|
||||
|
||||
|
||||
@app.post('/{projectId}/alerts', tags=["alerts"])
|
||||
def create_alert(projectId: int, data: schemas.AlertSchema = Body(...),
|
||||
async def create_alert(projectId: int, data: schemas.AlertSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return alerts.create(project_id=projectId, data=data)
|
||||
|
||||
|
||||
@app.get('/{projectId}/alerts', tags=["alerts"])
|
||||
def get_all_alerts(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_all_alerts(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": alerts.get_all(project_id=projectId)}
|
||||
|
||||
|
||||
@app.get('/{projectId}/alerts/triggers', tags=["alerts", "customMetrics"])
|
||||
def get_alerts_triggers(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_alerts_triggers(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": alerts.get_predefined_values() \
|
||||
+ custom_metrics.get_series_for_alert(project_id=projectId, user_id=context.user_id)}
|
||||
|
||||
|
||||
@app.get('/{projectId}/alerts/{alertId}', tags=["alerts"])
|
||||
def get_alert(projectId: int, alertId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_alert(projectId: int, alertId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": alerts.get(id=alertId)}
|
||||
|
||||
|
||||
@app.post('/{projectId}/alerts/{alertId}', tags=["alerts"])
|
||||
def update_alert(projectId: int, alertId: int, data: schemas.AlertSchema = Body(...),
|
||||
async def update_alert(projectId: int, alertId: int, data: schemas.AlertSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return alerts.update(id=alertId, data=data)
|
||||
|
||||
|
||||
@app.delete('/{projectId}/alerts/{alertId}', tags=["alerts"])
|
||||
def delete_alert(projectId: int, alertId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_alert(projectId: int, alertId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return alerts.delete(project_id=projectId, alert_id=alertId)
|
||||
|
||||
|
||||
@app_apikey.put('/{projectKey}/sourcemaps/', tags=["sourcemaps"])
|
||||
@app_apikey.put('/{projectKey}/sourcemaps', tags=["sourcemaps"])
|
||||
def sign_sourcemap_for_upload(projectKey: str, data: schemas.SourcemapUploadPayloadSchema = Body(...),
|
||||
async def sign_sourcemap_for_upload(projectKey: str, data: schemas.SourcemapUploadPayloadSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
project_id = projects.get_internal_project_id(projectKey)
|
||||
if project_id is None:
|
||||
|
|
@ -624,59 +624,59 @@ def sign_sourcemap_for_upload(projectKey: str, data: schemas.SourcemapUploadPayl
|
|||
|
||||
|
||||
@app.get('/config/weekly_report', tags=["weekly report config"])
|
||||
def get_weekly_report_config(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_weekly_report_config(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": weekly_report.get_config(user_id=context.user_id)}
|
||||
|
||||
|
||||
@app.post('/config/weekly_report', tags=["weekly report config"])
|
||||
def edit_weekly_report_config(data: schemas.WeeklyReportConfigSchema = Body(...),
|
||||
async def edit_weekly_report_config(data: schemas.WeeklyReportConfigSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": weekly_report.edit_config(user_id=context.user_id, weekly_report=data.weekly_report)}
|
||||
|
||||
|
||||
@app.get('/{projectId}/issue_types', tags=["issues"])
|
||||
def issue_types(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def issue_types(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": issues.get_all_types()}
|
||||
|
||||
|
||||
@app.get('/issue_types', tags=["issues"])
|
||||
def all_issue_types(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def all_issue_types(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": issues.get_all_types()}
|
||||
|
||||
|
||||
@app.get('/{projectId}/assist/sessions', tags=["assist"])
|
||||
def get_sessions_live(projectId: int, userId: str = None, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async 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}
|
||||
|
||||
|
||||
@app.post('/{projectId}/assist/sessions', tags=["assist"])
|
||||
def sessions_live(projectId: int, data: schemas.LiveSessionsSearchPayloadSchema = Body(...),
|
||||
async def sessions_live(projectId: int, data: schemas.LiveSessionsSearchPayloadSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
data = assist.get_live_sessions_ws(projectId, body=data)
|
||||
return {'data': data}
|
||||
|
||||
|
||||
@app.post('/{projectId}/mobile/{sessionId}/urls', tags=['mobile'])
|
||||
def mobile_signe(projectId: int, sessionId: int, data: schemas.MobileSignPayloadSchema = Body(...),
|
||||
async def mobile_signe(projectId: int, sessionId: int, data: schemas.MobileSignPayloadSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": mobile.sign_keys(project_id=projectId, session_id=sessionId, keys=data.keys)}
|
||||
|
||||
|
||||
@public_app.post('/signup', tags=['signup'])
|
||||
@public_app.put('/signup', tags=['signup'])
|
||||
def signup_handler(data: schemas.UserSignupSchema = Body(...)):
|
||||
async def signup_handler(data: schemas.UserSignupSchema = Body(...)):
|
||||
return signup.create_step1(data)
|
||||
|
||||
|
||||
@app.post('/projects', tags=['projects'])
|
||||
def create_project(data: schemas.CreateProjectSchema = Body(...),
|
||||
async def create_project(data: schemas.CreateProjectSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return projects.create(tenant_id=context.tenant_id, user_id=context.user_id, data=data)
|
||||
|
||||
|
||||
@app.get('/projects/{projectId}', tags=['projects'])
|
||||
def get_project(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_project(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
data = projects.get_project(tenant_id=context.tenant_id, project_id=projectId, include_last_session=True,
|
||||
include_gdpr=True)
|
||||
if data is None:
|
||||
|
|
@ -685,18 +685,18 @@ def get_project(projectId: int, context: schemas.CurrentContext = Depends(OR_con
|
|||
|
||||
|
||||
@app.put('/projects/{projectId}', tags=['projects'])
|
||||
def edit_project(projectId: int, data: schemas.CreateProjectSchema = Body(...),
|
||||
async def edit_project(projectId: int, data: schemas.CreateProjectSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return projects.edit(tenant_id=context.tenant_id, user_id=context.user_id, data=data, project_id=projectId)
|
||||
|
||||
|
||||
@app.delete('/projects/{projectId}', tags=['projects'])
|
||||
def delete_project(projectId, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_project(projectId, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return projects.delete(tenant_id=context.tenant_id, user_id=context.user_id, project_id=projectId)
|
||||
|
||||
|
||||
@app.get('/client/new_api_key', tags=['client'])
|
||||
def generate_new_tenant_token(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def generate_new_tenant_token(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {
|
||||
'data': tenants.generate_new_api_key(context.tenant_id)
|
||||
}
|
||||
|
|
@ -704,28 +704,28 @@ def generate_new_tenant_token(context: schemas.CurrentContext = Depends(OR_conte
|
|||
|
||||
@app.post('/client', tags=['client'])
|
||||
@app.put('/client', tags=['client'])
|
||||
def edit_client(data: schemas.UpdateTenantSchema = Body(...),
|
||||
async def edit_client(data: schemas.UpdateTenantSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return tenants.update(tenant_id=context.tenant_id, user_id=context.user_id, data=data)
|
||||
|
||||
|
||||
@app.get('/notifications', tags=['notifications'])
|
||||
def get_notifications(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_notifications(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": notifications.get_all(tenant_id=context.tenant_id, user_id=context.user_id)}
|
||||
|
||||
|
||||
@app.get('/notifications/count', tags=['notifications'])
|
||||
def get_notifications_count(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_notifications_count(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": notifications.get_all_count(tenant_id=context.tenant_id, user_id=context.user_id)}
|
||||
|
||||
|
||||
@app.get('/notifications/{notificationId}/view', tags=['notifications'])
|
||||
def view_notifications(notificationId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def view_notifications(notificationId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": notifications.view_notification(notification_ids=[notificationId], user_id=context.user_id)}
|
||||
|
||||
|
||||
@app.post('/notifications/view', tags=['notifications'])
|
||||
def batch_view_notifications(data: schemas.NotificationsViewSchema,
|
||||
async def batch_view_notifications(data: schemas.NotificationsViewSchema,
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": notifications.view_notification(notification_ids=data.ids,
|
||||
startTimestamp=data.startTimestamp,
|
||||
|
|
@ -735,83 +735,83 @@ def batch_view_notifications(data: schemas.NotificationsViewSchema,
|
|||
|
||||
|
||||
@app.get('/boarding', tags=['boarding'])
|
||||
def get_boarding_state(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_boarding_state(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": boarding.get_state(tenant_id=context.tenant_id)}
|
||||
|
||||
|
||||
@app.get('/boarding/installing', tags=['boarding'])
|
||||
def get_boarding_state_installing(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_boarding_state_installing(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": boarding.get_state_installing(tenant_id=context.tenant_id)}
|
||||
|
||||
|
||||
@app.get('/boarding/identify-users', tags=["boarding"])
|
||||
def get_boarding_state_identify_users(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_boarding_state_identify_users(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": boarding.get_state_identify_users(tenant_id=context.tenant_id)}
|
||||
|
||||
|
||||
@app.get('/boarding/manage-users', tags=["boarding"])
|
||||
def get_boarding_state_manage_users(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_boarding_state_manage_users(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": boarding.get_state_manage_users(tenant_id=context.tenant_id)}
|
||||
|
||||
|
||||
@app.get('/boarding/integrations', tags=["boarding"])
|
||||
def get_boarding_state_integrations(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_boarding_state_integrations(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": boarding.get_state_integrations(tenant_id=context.tenant_id)}
|
||||
|
||||
|
||||
@app.get('/integrations/slack/channels', tags=["integrations"])
|
||||
def get_slack_channels(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_slack_channels(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": webhook.get_by_type(tenant_id=context.tenant_id, webhook_type=schemas.WebhookType.slack)}
|
||||
|
||||
|
||||
@app.get('/integrations/slack/{webhookId}', tags=["integrations"])
|
||||
def get_slack_webhook(webhookId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_slack_webhook(webhookId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": Slack.get_integration(tenant_id=context.tenant_id, integration_id=webhookId)}
|
||||
|
||||
|
||||
@app.delete('/integrations/slack/{webhookId}', tags=["integrations"])
|
||||
def delete_slack_integration(webhookId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_slack_integration(webhookId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return webhook.delete(tenant_id=context.tenant_id, webhook_id=webhookId)
|
||||
|
||||
|
||||
@app.put('/webhooks', tags=["webhooks"])
|
||||
def add_edit_webhook(data: schemas.CreateEditWebhookSchema = Body(...),
|
||||
async def add_edit_webhook(data: schemas.CreateEditWebhookSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": webhook.add_edit(tenant_id=context.tenant_id, data=data.dict(), replace_none=True)}
|
||||
|
||||
|
||||
@app.get('/webhooks', tags=["webhooks"])
|
||||
def get_webhooks(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_webhooks(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": webhook.get_by_tenant(tenant_id=context.tenant_id, replace_none=True)}
|
||||
|
||||
|
||||
@app.delete('/webhooks/{webhookId}', tags=["webhooks"])
|
||||
def delete_webhook(webhookId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_webhook(webhookId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": webhook.delete(tenant_id=context.tenant_id, webhook_id=webhookId)}
|
||||
|
||||
|
||||
@app.get('/client/members', tags=["client"])
|
||||
def get_members(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_members(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": users.get_members(tenant_id=context.tenant_id)}
|
||||
|
||||
|
||||
@app.get('/client/members/{memberId}/reset', tags=["client"])
|
||||
def reset_reinvite_member(memberId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def reset_reinvite_member(memberId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return users.reset_member(tenant_id=context.tenant_id, editor_id=context.user_id, user_id_to_update=memberId)
|
||||
|
||||
|
||||
@app.delete('/client/members/{memberId}', tags=["client"])
|
||||
def delete_member(memberId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_member(memberId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return users.delete_member(tenant_id=context.tenant_id, user_id=context.user_id, id_to_delete=memberId)
|
||||
|
||||
|
||||
@app.get('/account/new_api_key', tags=["account"])
|
||||
def generate_new_user_token(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def generate_new_user_token(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": users.generate_new_api_key(user_id=context.user_id)}
|
||||
|
||||
|
||||
@app.post('/account/password', tags=["account"])
|
||||
def change_client_password(data: schemas.EditUserPasswordSchema = Body(...),
|
||||
async def change_client_password(data: schemas.EditUserPasswordSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return users.change_password(email=context.email, old_password=data.old_password,
|
||||
new_password=data.new_password, tenant_id=context.tenant_id,
|
||||
|
|
@ -819,34 +819,34 @@ def change_client_password(data: schemas.EditUserPasswordSchema = Body(...),
|
|||
|
||||
|
||||
@app.post('/{projectId}/saved_search', tags=["savedSearch"])
|
||||
def add_saved_search(projectId: int, data: schemas.SavedSearchSchema = Body(...),
|
||||
async def add_saved_search(projectId: int, data: schemas.SavedSearchSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return saved_search.create(project_id=projectId, user_id=context.user_id, data=data)
|
||||
|
||||
|
||||
@app.get('/{projectId}/saved_search', tags=["savedSearch"])
|
||||
def get_saved_searches(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_saved_searches(projectId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": saved_search.get_all(project_id=projectId, user_id=context.user_id, details=True)}
|
||||
|
||||
|
||||
@app.get('/{projectId}/saved_search/{search_id}', tags=["savedSearch"])
|
||||
def get_saved_search(projectId: int, search_id: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_saved_search(projectId: int, search_id: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": saved_search.get(project_id=projectId, search_id=search_id, user_id=context.user_id)}
|
||||
|
||||
|
||||
@app.post('/{projectId}/saved_search/{search_id}', tags=["savedSearch"])
|
||||
def update_saved_search(projectId: int, search_id: int, data: schemas.SavedSearchSchema = Body(...),
|
||||
async def update_saved_search(projectId: int, search_id: int, data: schemas.SavedSearchSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": saved_search.update(user_id=context.user_id, search_id=search_id, data=data, project_id=projectId)}
|
||||
|
||||
|
||||
@app.delete('/{projectId}/saved_search/{search_id}', tags=["savedSearch"])
|
||||
def delete_saved_search(projectId: int, search_id: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_saved_search(projectId: int, search_id: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": saved_search.delete(project_id=projectId, user_id=context.user_id, search_id=search_id)}
|
||||
|
||||
|
||||
@app.get('/limits', tags=['accounts'])
|
||||
def get_limits(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_limits(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {
|
||||
'data': {
|
||||
"teamMember": -1,
|
||||
|
|
@ -856,12 +856,12 @@ def get_limits(context: schemas.CurrentContext = Depends(OR_context)):
|
|||
|
||||
|
||||
@app.get('/integrations/msteams/channels', tags=["integrations"])
|
||||
def get_msteams_channels(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_msteams_channels(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": webhook.get_by_type(tenant_id=context.tenant_id, webhook_type=schemas.WebhookType.msteams)}
|
||||
|
||||
|
||||
@app.post('/integrations/msteams', tags=['integrations'])
|
||||
def add_msteams_integration(data: schemas.AddCollaborationSchema,
|
||||
async def add_msteams_integration(data: schemas.AddCollaborationSchema,
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
n = MSTeams.add(tenant_id=context.tenant_id, data=data)
|
||||
if n is None:
|
||||
|
|
@ -873,7 +873,7 @@ def add_msteams_integration(data: schemas.AddCollaborationSchema,
|
|||
|
||||
|
||||
@app.post('/integrations/msteams/{webhookId}', tags=['integrations'])
|
||||
def edit_msteams_integration(webhookId: int, data: schemas.EditCollaborationSchema = Body(...),
|
||||
async def edit_msteams_integration(webhookId: int, data: schemas.EditCollaborationSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
if len(data.url) > 0:
|
||||
old = MSTeams.get_integration(tenant_id=context.tenant_id, integration_id=webhookId)
|
||||
|
|
@ -890,12 +890,12 @@ def edit_msteams_integration(webhookId: int, data: schemas.EditCollaborationSche
|
|||
|
||||
|
||||
@app.delete('/integrations/msteams/{webhookId}', tags=["integrations"])
|
||||
def delete_msteams_integration(webhookId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_msteams_integration(webhookId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return webhook.delete(tenant_id=context.tenant_id, webhook_id=webhookId)
|
||||
|
||||
|
||||
@public_app.get('/general_stats', tags=["private"], include_in_schema=False)
|
||||
def get_general_stats():
|
||||
async def get_general_stats():
|
||||
return {"data": {"sessions:": sessions.count_all()}}
|
||||
|
||||
|
||||
|
|
@ -903,6 +903,6 @@ def get_general_stats():
|
|||
@public_app.post('/', tags=["health"])
|
||||
@public_app.put('/', tags=["health"])
|
||||
@public_app.delete('/', tags=["health"])
|
||||
def health_check():
|
||||
async def health_check():
|
||||
return {"data": {"stage": f"live {config('version_number', default='')}",
|
||||
"internalCrons": config("LOCAL_CRONS", default=False, cast=bool)}}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public_app, app, app_apikey = get_routers()
|
|||
|
||||
|
||||
@public_app.get('/signup', tags=['signup'])
|
||||
def get_all_signup():
|
||||
async def get_all_signup():
|
||||
return {"data": {"tenants": tenants.tenants_exists(),
|
||||
"sso": None,
|
||||
"ssoProvider": None,
|
||||
|
|
@ -28,7 +28,7 @@ def get_all_signup():
|
|||
|
||||
|
||||
@app.get('/account', tags=['accounts'])
|
||||
def get_account(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_account(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
r = users.get(tenant_id=context.tenant_id, user_id=context.user_id)
|
||||
t = tenants.get_by_tenant_id(context.tenant_id)
|
||||
if t is not None:
|
||||
|
|
@ -46,14 +46,14 @@ def get_account(context: schemas.CurrentContext = Depends(OR_context)):
|
|||
|
||||
|
||||
@app.post('/account', tags=["account"])
|
||||
def edit_account(data: schemas.EditUserSchema = Body(...),
|
||||
async def edit_account(data: schemas.EditUserSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return users.edit(tenant_id=context.tenant_id, user_id_to_update=context.user_id, changes=data,
|
||||
editor_id=context.user_id)
|
||||
|
||||
|
||||
@app.get('/projects/limit', tags=['projects'])
|
||||
def get_projects_limit(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_projects_limit(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": {
|
||||
"current": projects.count_by_tenant(tenant_id=context.tenant_id),
|
||||
"remaining": -1
|
||||
|
|
@ -62,7 +62,7 @@ def get_projects_limit(context: schemas.CurrentContext = Depends(OR_context)):
|
|||
|
||||
@app.post('/integrations/slack', tags=['integrations'])
|
||||
@app.put('/integrations/slack', tags=['integrations'])
|
||||
def add_slack_integration(data: schemas.AddCollaborationSchema, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def add_slack_integration(data: schemas.AddCollaborationSchema, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
n = Slack.add(tenant_id=context.tenant_id, data=data)
|
||||
if n is None:
|
||||
return {
|
||||
|
|
@ -72,7 +72,7 @@ def add_slack_integration(data: schemas.AddCollaborationSchema, context: schemas
|
|||
|
||||
|
||||
@app.post('/integrations/slack/{integrationId}', tags=['integrations'])
|
||||
def edit_slack_integration(integrationId: int, data: schemas.EditCollaborationSchema = Body(...),
|
||||
async def edit_slack_integration(integrationId: int, data: schemas.EditCollaborationSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
if len(data.url) > 0:
|
||||
old = Slack.get_integration(tenant_id=context.tenant_id, integration_id=integrationId)
|
||||
|
|
@ -89,14 +89,14 @@ def edit_slack_integration(integrationId: int, data: schemas.EditCollaborationSc
|
|||
|
||||
|
||||
@app.post('/client/members', tags=["client"])
|
||||
def add_member(background_tasks: BackgroundTasks, data: schemas.CreateMemberSchema = Body(...),
|
||||
async def add_member(background_tasks: BackgroundTasks, data: schemas.CreateMemberSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return users.create_member(tenant_id=context.tenant_id, user_id=context.user_id, data=data.dict(),
|
||||
background_tasks=background_tasks)
|
||||
|
||||
|
||||
@public_app.get('/users/invitation', tags=['users'])
|
||||
def process_invitation_link(token: str):
|
||||
async def process_invitation_link(token: str):
|
||||
if token is None or len(token) < 64:
|
||||
return {"errors": ["please provide a valid invitation"]}
|
||||
user = users.get_by_invitation_token(token)
|
||||
|
|
@ -113,7 +113,7 @@ def process_invitation_link(token: str):
|
|||
|
||||
|
||||
@public_app.post('/password/reset', tags=["users"])
|
||||
def change_password_by_invitation(data: schemas.EditPasswordByInvitationSchema = Body(...)):
|
||||
async def change_password_by_invitation(data: schemas.EditPasswordByInvitationSchema = Body(...)):
|
||||
if data is None or len(data.invitation) < 64 or len(data.passphrase) < 8:
|
||||
return {"errors": ["please provide a valid invitation & pass"]}
|
||||
user = users.get_by_invitation_token(token=data.invitation, pass_token=data.passphrase)
|
||||
|
|
@ -126,14 +126,14 @@ def change_password_by_invitation(data: schemas.EditPasswordByInvitationSchema =
|
|||
|
||||
|
||||
@app.put('/client/members/{memberId}', tags=["client"])
|
||||
def edit_member(memberId: int, data: schemas.EditMemberSchema,
|
||||
async def edit_member(memberId: int, data: schemas.EditMemberSchema,
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return users.edit_member(tenant_id=context.tenant_id, editor_id=context.user_id, changes=data,
|
||||
user_id_to_update=memberId)
|
||||
|
||||
|
||||
@app.get('/metadata/session_search', tags=["metadata"])
|
||||
def search_sessions_by_metadata(key: str, value: str, projectId: Optional[int] = None,
|
||||
async def search_sessions_by_metadata(key: str, value: str, projectId: Optional[int] = None,
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
if key is None or value is None or len(value) == 0 and len(key) == 0:
|
||||
return {"errors": ["please provide a key&value for search"]}
|
||||
|
|
@ -147,13 +147,13 @@ def search_sessions_by_metadata(key: str, value: str, projectId: Optional[int] =
|
|||
|
||||
|
||||
@app.get('/projects', tags=['projects'])
|
||||
def get_projects(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_projects(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": projects.get_projects(tenant_id=context.tenant_id, recording_state=True, gdpr=True, recorded=True,
|
||||
stack_integrations=True)}
|
||||
|
||||
|
||||
@app.get('/{projectId}/sessions/{sessionId}', tags=["sessions"])
|
||||
def get_session(projectId: int, sessionId: Union[int, str], background_tasks: BackgroundTasks,
|
||||
async def get_session(projectId: int, sessionId: Union[int, str], background_tasks: BackgroundTasks,
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
if isinstance(sessionId, str):
|
||||
return {"errors": ["session not found"]}
|
||||
|
|
@ -170,7 +170,7 @@ def get_session(projectId: int, sessionId: Union[int, str], background_tasks: Ba
|
|||
|
||||
|
||||
@app.get('/{projectId}/sessions/{sessionId}/errors/{errorId}/sourcemaps', tags=["sessions", "sourcemaps"])
|
||||
def get_error_trace(projectId: int, sessionId: int, errorId: str,
|
||||
async def get_error_trace(projectId: int, sessionId: int, errorId: str,
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
data = errors.get_trace(project_id=projectId, error_id=errorId)
|
||||
if "errors" in data:
|
||||
|
|
@ -181,19 +181,19 @@ def get_error_trace(projectId: int, sessionId: int, errorId: str,
|
|||
|
||||
|
||||
@app.post('/{projectId}/errors/search', tags=['errors'])
|
||||
def errors_search(projectId: int, data: schemas.SearchErrorsSchema = Body(...),
|
||||
async def errors_search(projectId: int, data: schemas.SearchErrorsSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": errors.search(data, projectId, user_id=context.user_id)}
|
||||
|
||||
|
||||
@app.get('/{projectId}/errors/stats', tags=['errors'])
|
||||
def errors_stats(projectId: int, startTimestamp: int, endTimestamp: int,
|
||||
async def errors_stats(projectId: int, startTimestamp: int, endTimestamp: int,
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return errors.stats(projectId, user_id=context.user_id, startTimestamp=startTimestamp, endTimestamp=endTimestamp)
|
||||
|
||||
|
||||
@app.get('/{projectId}/errors/{errorId}', tags=['errors'])
|
||||
def errors_get_details(projectId: int, errorId: str, background_tasks: BackgroundTasks, density24: int = 24,
|
||||
async def errors_get_details(projectId: int, errorId: str, background_tasks: BackgroundTasks, density24: int = 24,
|
||||
density30: int = 30, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
data = errors.get_details(project_id=projectId, user_id=context.user_id, error_id=errorId,
|
||||
**{"density24": density24, "density30": density30})
|
||||
|
|
@ -204,7 +204,7 @@ def errors_get_details(projectId: int, errorId: str, background_tasks: Backgroun
|
|||
|
||||
|
||||
@app.get('/{projectId}/errors/{errorId}/stats', tags=['errors'])
|
||||
def errors_get_details_right_column(projectId: int, errorId: str, startDate: int = TimeUTC.now(-7),
|
||||
async def errors_get_details_right_column(projectId: int, errorId: str, startDate: int = TimeUTC.now(-7),
|
||||
endDate: int = TimeUTC.now(), density: int = 7,
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
data = errors.get_details_chart(project_id=projectId, user_id=context.user_id, error_id=errorId,
|
||||
|
|
@ -213,7 +213,7 @@ def errors_get_details_right_column(projectId: int, errorId: str, startDate: int
|
|||
|
||||
|
||||
@app.get('/{projectId}/errors/{errorId}/sourcemaps', tags=['errors'])
|
||||
def errors_get_details_sourcemaps(projectId: int, errorId: str,
|
||||
async def errors_get_details_sourcemaps(projectId: int, errorId: str,
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
data = errors.get_trace(project_id=projectId, error_id=errorId)
|
||||
if "errors" in data:
|
||||
|
|
@ -224,7 +224,7 @@ def errors_get_details_sourcemaps(projectId: int, errorId: str,
|
|||
|
||||
|
||||
@app.get('/{projectId}/errors/{errorId}/{action}', tags=["errors"])
|
||||
def add_remove_favorite_error(projectId: int, errorId: str, action: str, startDate: int = TimeUTC.now(-7),
|
||||
async def add_remove_favorite_error(projectId: int, errorId: str, action: str, startDate: int = TimeUTC.now(-7),
|
||||
endDate: int = TimeUTC.now(), context: schemas.CurrentContext = Depends(OR_context)):
|
||||
if action == "favorite":
|
||||
return errors_favorite.favorite_error(project_id=projectId, user_id=context.user_id, error_id=errorId)
|
||||
|
|
@ -241,7 +241,7 @@ def add_remove_favorite_error(projectId: int, errorId: str, action: str, startDa
|
|||
|
||||
|
||||
@app.get('/{projectId}/assist/sessions/{sessionId}', tags=["assist"])
|
||||
def get_live_session(projectId: int, sessionId: str, background_tasks: BackgroundTasks,
|
||||
async def get_live_session(projectId: int, sessionId: str, background_tasks: BackgroundTasks,
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
data = assist.get_live_session_by_id(project_id=projectId, session_id=sessionId)
|
||||
if data is None:
|
||||
|
|
@ -256,7 +256,7 @@ def get_live_session(projectId: int, sessionId: str, background_tasks: Backgroun
|
|||
|
||||
|
||||
@app.get('/{projectId}/unprocessed/{sessionId}/dom.mob', tags=["assist"])
|
||||
def get_live_session_replay_file(projectId: int, sessionId: Union[int, str],
|
||||
async def get_live_session_replay_file(projectId: int, sessionId: Union[int, str],
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
not_found = {"errors": ["Replay file not found"]}
|
||||
if isinstance(sessionId, str):
|
||||
|
|
@ -276,7 +276,7 @@ def get_live_session_replay_file(projectId: int, sessionId: Union[int, str],
|
|||
|
||||
|
||||
@app.get('/{projectId}/unprocessed/{sessionId}/devtools.mob', tags=["assist"])
|
||||
def get_live_session_devtools_file(projectId: int, sessionId: Union[int, str],
|
||||
async def get_live_session_devtools_file(projectId: int, sessionId: Union[int, str],
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
not_found = {"errors": ["Devtools file not found"]}
|
||||
if isinstance(sessionId, str):
|
||||
|
|
@ -296,20 +296,20 @@ def get_live_session_devtools_file(projectId: int, sessionId: Union[int, str],
|
|||
|
||||
|
||||
@app.post('/{projectId}/heatmaps/url', tags=["heatmaps"])
|
||||
def get_heatmaps_by_url(projectId: int, data: schemas.GetHeatmapPayloadSchema = Body(...),
|
||||
async def get_heatmaps_by_url(projectId: int, data: schemas.GetHeatmapPayloadSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": heatmaps.get_by_url(project_id=projectId, data=data)}
|
||||
|
||||
|
||||
@app.get('/{projectId}/sessions/{sessionId}/favorite', tags=["sessions"])
|
||||
def add_remove_favorite_session2(projectId: int, sessionId: int,
|
||||
async def add_remove_favorite_session2(projectId: int, sessionId: int,
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {
|
||||
"data": sessions_favorite.favorite_session(context=context, project_id=projectId, session_id=sessionId)}
|
||||
|
||||
|
||||
@app.get('/{projectId}/sessions/{sessionId}/assign', tags=["sessions"])
|
||||
def assign_session(projectId: int, sessionId, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def assign_session(projectId: int, sessionId, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
data = sessions_assignments.get_by_session(project_id=projectId, session_id=sessionId,
|
||||
tenant_id=context.tenant_id,
|
||||
user_id=context.user_id)
|
||||
|
|
@ -321,7 +321,7 @@ def assign_session(projectId: int, sessionId, context: schemas.CurrentContext =
|
|||
|
||||
|
||||
@app.get('/{projectId}/sessions/{sessionId}/assign/{issueId}', tags=["sessions", "issueTracking"])
|
||||
def assign_session(projectId: int, sessionId: int, issueId: str,
|
||||
async def assign_session(projectId: int, sessionId: int, issueId: str,
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
data = sessions_assignments.get(project_id=projectId, session_id=sessionId, assignment_id=issueId,
|
||||
tenant_id=context.tenant_id, user_id=context.user_id)
|
||||
|
|
@ -333,7 +333,7 @@ def assign_session(projectId: int, sessionId: int, issueId: str,
|
|||
|
||||
|
||||
@app.post('/{projectId}/sessions/{sessionId}/assign/{issueId}/comment', tags=["sessions", "issueTracking"])
|
||||
def comment_assignment(projectId: int, sessionId: int, issueId: str, data: schemas.CommentAssignmentSchema = Body(...),
|
||||
async def comment_assignment(projectId: int, sessionId: int, issueId: str, data: schemas.CommentAssignmentSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
data = sessions_assignments.comment(tenant_id=context.tenant_id, project_id=projectId,
|
||||
session_id=sessionId, assignment_id=issueId,
|
||||
|
|
@ -346,7 +346,7 @@ def comment_assignment(projectId: int, sessionId: int, issueId: str, data: schem
|
|||
|
||||
|
||||
@app.post('/{projectId}/sessions/{sessionId}/notes', tags=["sessions", "notes"])
|
||||
def create_note(projectId: int, sessionId: int, data: schemas.SessionNoteSchema = Body(...),
|
||||
async def create_note(projectId: int, sessionId: int, data: schemas.SessionNoteSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
if not sessions.session_exists(project_id=projectId, session_id=sessionId):
|
||||
return {"errors": ["Session not found"]}
|
||||
|
|
@ -360,7 +360,7 @@ def create_note(projectId: int, sessionId: int, data: schemas.SessionNoteSchema
|
|||
|
||||
|
||||
@app.get('/{projectId}/sessions/{sessionId}/notes', tags=["sessions", "notes"])
|
||||
def get_session_notes(projectId: int, sessionId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_session_notes(projectId: int, sessionId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
data = sessions_notes.get_session_notes(tenant_id=context.tenant_id, project_id=projectId,
|
||||
session_id=sessionId, user_id=context.user_id)
|
||||
if "errors" in data:
|
||||
|
|
@ -371,7 +371,7 @@ def get_session_notes(projectId: int, sessionId: int, context: schemas.CurrentCo
|
|||
|
||||
|
||||
@app.post('/{projectId}/notes/{noteId}', tags=["sessions", "notes"])
|
||||
def edit_note(projectId: int, noteId: int, data: schemas.SessionUpdateNoteSchema = Body(...),
|
||||
async def edit_note(projectId: int, noteId: int, data: schemas.SessionUpdateNoteSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
data = sessions_notes.edit(tenant_id=context.tenant_id, project_id=projectId, user_id=context.user_id,
|
||||
note_id=noteId, data=data)
|
||||
|
|
@ -383,28 +383,28 @@ def edit_note(projectId: int, noteId: int, data: schemas.SessionUpdateNoteSchema
|
|||
|
||||
|
||||
@app.delete('/{projectId}/notes/{noteId}', tags=["sessions", "notes"])
|
||||
def delete_note(projectId: int, noteId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_note(projectId: int, noteId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
data = sessions_notes.delete(tenant_id=context.tenant_id, project_id=projectId, user_id=context.user_id,
|
||||
note_id=noteId)
|
||||
return data
|
||||
|
||||
|
||||
@app.get('/{projectId}/notes/{noteId}/slack/{webhookId}', tags=["sessions", "notes"])
|
||||
def share_note_to_slack(projectId: int, noteId: int, webhookId: int,
|
||||
async def share_note_to_slack(projectId: int, noteId: int, webhookId: int,
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return sessions_notes.share_to_slack(tenant_id=context.tenant_id, project_id=projectId, user_id=context.user_id,
|
||||
note_id=noteId, webhook_id=webhookId)
|
||||
|
||||
|
||||
@app.get('/{projectId}/notes/{noteId}/msteams/{webhookId}', tags=["sessions", "notes"])
|
||||
def share_note_to_msteams(projectId: int, noteId: int, webhookId: int,
|
||||
async def share_note_to_msteams(projectId: int, noteId: int, webhookId: int,
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return sessions_notes.share_to_msteams(tenant_id=context.tenant_id, project_id=projectId, user_id=context.user_id,
|
||||
note_id=noteId, webhook_id=webhookId)
|
||||
|
||||
|
||||
@app.post('/{projectId}/notes', tags=["sessions", "notes"])
|
||||
def get_all_notes(projectId: int, data: schemas.SearchNoteSchema = Body(...),
|
||||
async def get_all_notes(projectId: int, data: schemas.SearchNoteSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
data = sessions_notes.get_all_notes_by_project_id(tenant_id=context.tenant_id, project_id=projectId,
|
||||
user_id=context.user_id, data=data)
|
||||
|
|
@ -414,6 +414,6 @@ def get_all_notes(projectId: int, data: schemas.SearchNoteSchema = Body(...),
|
|||
|
||||
|
||||
@app.post('/{projectId}/click_maps/search', tags=["click maps"])
|
||||
def click_map_search(projectId: int, data: schemas.FlatClickMapSessionsSearch = Body(...),
|
||||
async def click_map_search(projectId: int, data: schemas.FlatClickMapSessionsSearch = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": click_maps.search_short_session(user_id=context.user_id, data=data, project_id=projectId)}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public_app, app, app_apikey = get_routers()
|
|||
|
||||
|
||||
@public_app.get('/signup', tags=['signup'])
|
||||
def get_all_signup():
|
||||
async def get_all_signup():
|
||||
return {"data": {"tenants": tenants.tenants_exists(),
|
||||
"sso": SAML2_helper.is_saml2_available(),
|
||||
"ssoProvider": SAML2_helper.get_saml2_provider(),
|
||||
|
|
@ -32,7 +32,7 @@ def get_all_signup():
|
|||
|
||||
|
||||
@app.get('/account', tags=['accounts'])
|
||||
def get_account(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_account(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
r = users.get(tenant_id=context.tenant_id, user_id=context.user_id)
|
||||
t = tenants.get_by_tenant_id(context.tenant_id)
|
||||
if t is not None:
|
||||
|
|
@ -51,14 +51,14 @@ def get_account(context: schemas.CurrentContext = Depends(OR_context)):
|
|||
|
||||
|
||||
@app.post('/account', tags=["account"])
|
||||
def edit_account(data: schemas_ee.EditUserSchema = Body(...),
|
||||
async def edit_account(data: schemas_ee.EditUserSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return users.edit(tenant_id=context.tenant_id, user_id_to_update=context.user_id, changes=data,
|
||||
editor_id=context.user_id)
|
||||
|
||||
|
||||
@app.get('/projects/limit', tags=['projects'])
|
||||
def get_projects_limit(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_projects_limit(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": {
|
||||
"current": projects.count_by_tenant(tenant_id=context.tenant_id),
|
||||
"remaining": -1
|
||||
|
|
@ -67,7 +67,7 @@ def get_projects_limit(context: schemas.CurrentContext = Depends(OR_context)):
|
|||
|
||||
@app.post('/integrations/slack', tags=['integrations'])
|
||||
@app.put('/integrations/slack', tags=['integrations'])
|
||||
def add_slack_client(data: schemas.AddCollaborationSchema, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def add_slack_client(data: schemas.AddCollaborationSchema, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
n = Slack.add(tenant_id=context.tenant_id, data=data)
|
||||
if n is None:
|
||||
return {
|
||||
|
|
@ -77,7 +77,7 @@ def add_slack_client(data: schemas.AddCollaborationSchema, context: schemas.Curr
|
|||
|
||||
|
||||
@app.post('/integrations/slack/{integrationId}', tags=['integrations'])
|
||||
def edit_slack_integration(integrationId: int, data: schemas.EditCollaborationSchema = Body(...),
|
||||
async def edit_slack_integration(integrationId: int, data: schemas.EditCollaborationSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
if len(data.url) > 0:
|
||||
old = Slack.get_integration(tenant_id=context.tenant_id, integration_id=integrationId)
|
||||
|
|
@ -94,14 +94,14 @@ def edit_slack_integration(integrationId: int, data: schemas.EditCollaborationSc
|
|||
|
||||
|
||||
@app.post('/client/members', tags=["client"])
|
||||
def add_member(background_tasks: BackgroundTasks, data: schemas_ee.CreateMemberSchema = Body(...),
|
||||
async def add_member(background_tasks: BackgroundTasks, data: schemas_ee.CreateMemberSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return users.create_member(tenant_id=context.tenant_id, user_id=context.user_id, data=data.dict(),
|
||||
background_tasks=background_tasks)
|
||||
|
||||
|
||||
@public_app.get('/users/invitation', tags=['users'])
|
||||
def process_invitation_link(token: str, request: Request):
|
||||
async def process_invitation_link(token: str, request: Request):
|
||||
if config("enforce_SSO", cast=bool, default=False) and helper.is_saml2_available():
|
||||
return await saml.start_sso(request=request)
|
||||
if token is None or len(token) < 64:
|
||||
|
|
@ -120,7 +120,7 @@ def process_invitation_link(token: str, request: Request):
|
|||
|
||||
|
||||
@public_app.post('/password/reset', tags=["users"])
|
||||
def change_password_by_invitation(data: schemas.EditPasswordByInvitationSchema = Body(...)):
|
||||
async def change_password_by_invitation(data: schemas.EditPasswordByInvitationSchema = Body(...)):
|
||||
if data is None or len(data.invitation) < 64 or len(data.passphrase) < 8:
|
||||
return {"errors": ["please provide a valid invitation & pass"]}
|
||||
user = users.get_by_invitation_token(token=data.invitation, pass_token=data.passphrase)
|
||||
|
|
@ -133,14 +133,14 @@ def change_password_by_invitation(data: schemas.EditPasswordByInvitationSchema =
|
|||
|
||||
|
||||
@app.put('/client/members/{memberId}', tags=["client"])
|
||||
def edit_member(memberId: int, data: schemas_ee.EditMemberSchema,
|
||||
async def edit_member(memberId: int, data: schemas_ee.EditMemberSchema,
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return users.edit_member(tenant_id=context.tenant_id, editor_id=context.user_id, changes=data,
|
||||
user_id_to_update=memberId)
|
||||
|
||||
|
||||
@app.get('/metadata/session_search', tags=["metadata"])
|
||||
def search_sessions_by_metadata(key: str, value: str, projectId: Optional[int] = None,
|
||||
async def search_sessions_by_metadata(key: str, value: str, projectId: Optional[int] = None,
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
if key is None or value is None or len(value) == 0 and len(key) == 0:
|
||||
return {"errors": ["please provide a key&value for search"]}
|
||||
|
|
@ -158,13 +158,13 @@ def search_sessions_by_metadata(key: str, value: str, projectId: Optional[int] =
|
|||
|
||||
|
||||
@app.get('/projects', tags=['projects'])
|
||||
def get_projects(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_projects(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": projects.get_projects(tenant_id=context.tenant_id, recording_state=True, gdpr=True, recorded=True,
|
||||
stack_integrations=True, user_id=context.user_id)}
|
||||
|
||||
|
||||
@app.get('/{projectId}/sessions/{sessionId}', tags=["sessions"], dependencies=[OR_scope(Permissions.session_replay)])
|
||||
def get_session(projectId: int, sessionId: Union[int, str], background_tasks: BackgroundTasks,
|
||||
async def get_session(projectId: int, sessionId: Union[int, str], background_tasks: BackgroundTasks,
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
if isinstance(sessionId, str):
|
||||
return {"errors": ["session not found"]}
|
||||
|
|
@ -182,7 +182,7 @@ def get_session(projectId: int, sessionId: Union[int, str], background_tasks: Ba
|
|||
|
||||
@app.get('/{projectId}/sessions/{sessionId}/errors/{errorId}/sourcemaps', tags=["sessions", "sourcemaps"],
|
||||
dependencies=[OR_scope(Permissions.dev_tools)])
|
||||
def get_error_trace(projectId: int, sessionId: int, errorId: str,
|
||||
async def get_error_trace(projectId: int, sessionId: int, errorId: str,
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
data = errors.get_trace(project_id=projectId, error_id=errorId)
|
||||
if "errors" in data:
|
||||
|
|
@ -193,19 +193,19 @@ def get_error_trace(projectId: int, sessionId: int, errorId: str,
|
|||
|
||||
|
||||
@app.post('/{projectId}/errors/search', tags=['errors'], dependencies=[OR_scope(Permissions.dev_tools)])
|
||||
def errors_search(projectId: int, data: schemas.SearchErrorsSchema = Body(...),
|
||||
async def errors_search(projectId: int, data: schemas.SearchErrorsSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": errors.search(data, projectId, user_id=context.user_id)}
|
||||
|
||||
|
||||
@app.get('/{projectId}/errors/stats', tags=['errors'], dependencies=[OR_scope(Permissions.dev_tools)])
|
||||
def errors_stats(projectId: int, startTimestamp: int, endTimestamp: int,
|
||||
async def errors_stats(projectId: int, startTimestamp: int, endTimestamp: int,
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return errors.stats(projectId, user_id=context.user_id, startTimestamp=startTimestamp, endTimestamp=endTimestamp)
|
||||
|
||||
|
||||
@app.get('/{projectId}/errors/{errorId}', tags=['errors'], dependencies=[OR_scope(Permissions.dev_tools)])
|
||||
def errors_get_details(projectId: int, errorId: str, background_tasks: BackgroundTasks, density24: int = 24,
|
||||
async def errors_get_details(projectId: int, errorId: str, background_tasks: BackgroundTasks, density24: int = 24,
|
||||
density30: int = 30, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
data = errors.get_details(project_id=projectId, user_id=context.user_id, error_id=errorId,
|
||||
**{"density24": density24, "density30": density30})
|
||||
|
|
@ -216,7 +216,7 @@ def errors_get_details(projectId: int, errorId: str, background_tasks: Backgroun
|
|||
|
||||
|
||||
@app.get('/{projectId}/errors/{errorId}/stats', tags=['errors'], dependencies=[OR_scope(Permissions.dev_tools)])
|
||||
def errors_get_details_right_column(projectId: int, errorId: str, startDate: int = TimeUTC.now(-7),
|
||||
async def errors_get_details_right_column(projectId: int, errorId: str, startDate: int = TimeUTC.now(-7),
|
||||
endDate: int = TimeUTC.now(), density: int = 7,
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
data = errors.get_details_chart(project_id=projectId, user_id=context.user_id, error_id=errorId,
|
||||
|
|
@ -225,7 +225,7 @@ def errors_get_details_right_column(projectId: int, errorId: str, startDate: int
|
|||
|
||||
|
||||
@app.get('/{projectId}/errors/{errorId}/sourcemaps', tags=['errors'], dependencies=[OR_scope(Permissions.dev_tools)])
|
||||
def errors_get_details_sourcemaps(projectId: int, errorId: str,
|
||||
async def errors_get_details_sourcemaps(projectId: int, errorId: str,
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
data = errors.get_trace(project_id=projectId, error_id=errorId)
|
||||
if "errors" in data:
|
||||
|
|
@ -236,7 +236,7 @@ def errors_get_details_sourcemaps(projectId: int, errorId: str,
|
|||
|
||||
|
||||
@app.get('/{projectId}/errors/{errorId}/{action}', tags=["errors"], dependencies=[OR_scope(Permissions.dev_tools)])
|
||||
def add_remove_favorite_error(projectId: int, errorId: str, action: str, startDate: int = TimeUTC.now(-7),
|
||||
async def add_remove_favorite_error(projectId: int, errorId: str, action: str, startDate: int = TimeUTC.now(-7),
|
||||
endDate: int = TimeUTC.now(), context: schemas.CurrentContext = Depends(OR_context)):
|
||||
if action == "favorite":
|
||||
return errors_favorite.favorite_error(project_id=projectId, user_id=context.user_id, error_id=errorId)
|
||||
|
|
@ -253,7 +253,7 @@ def add_remove_favorite_error(projectId: int, errorId: str, action: str, startDa
|
|||
|
||||
|
||||
@app.get('/{projectId}/assist/sessions/{sessionId}', tags=["assist"], dependencies=[OR_scope(Permissions.assist_live)])
|
||||
def get_live_session(projectId: int, sessionId: str, background_tasks: BackgroundTasks,
|
||||
async def get_live_session(projectId: int, sessionId: str, background_tasks: BackgroundTasks,
|
||||
context: schemas_ee.CurrentContext = Depends(OR_context)):
|
||||
data = assist.get_live_session_by_id(project_id=projectId, session_id=sessionId)
|
||||
if data is None:
|
||||
|
|
@ -269,7 +269,7 @@ def get_live_session(projectId: int, sessionId: str, background_tasks: Backgroun
|
|||
|
||||
@app.get('/{projectId}/unprocessed/{sessionId}/dom.mob', tags=["assist"],
|
||||
dependencies=[OR_scope(Permissions.assist_live, Permissions.session_replay)])
|
||||
def get_live_session_replay_file(projectId: int, sessionId: Union[int, str],
|
||||
async def get_live_session_replay_file(projectId: int, sessionId: Union[int, str],
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
not_found = {"errors": ["Replay file not found"]}
|
||||
if isinstance(sessionId, str):
|
||||
|
|
@ -290,7 +290,7 @@ def get_live_session_replay_file(projectId: int, sessionId: Union[int, str],
|
|||
|
||||
@app.get('/{projectId}/unprocessed/{sessionId}/devtools.mob', tags=["assist"],
|
||||
dependencies=[OR_scope(Permissions.assist_live, Permissions.session_replay, Permissions.dev_tools)])
|
||||
def get_live_session_devtools_file(projectId: int, sessionId: Union[int, str],
|
||||
async def get_live_session_devtools_file(projectId: int, sessionId: Union[int, str],
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
not_found = {"errors": ["Devtools file not found"]}
|
||||
if isinstance(sessionId, str):
|
||||
|
|
@ -310,14 +310,14 @@ def get_live_session_devtools_file(projectId: int, sessionId: Union[int, str],
|
|||
|
||||
|
||||
@app.post('/{projectId}/heatmaps/url', tags=["heatmaps"], dependencies=[OR_scope(Permissions.session_replay)])
|
||||
def get_heatmaps_by_url(projectId: int, data: schemas.GetHeatmapPayloadSchema = Body(...),
|
||||
async def get_heatmaps_by_url(projectId: int, data: schemas.GetHeatmapPayloadSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": heatmaps.get_by_url(project_id=projectId, data=data)}
|
||||
|
||||
|
||||
@app.get('/{projectId}/sessions/{sessionId}/favorite', tags=["sessions"],
|
||||
dependencies=[OR_scope(Permissions.session_replay)])
|
||||
def add_remove_favorite_session2(projectId: int, sessionId: int,
|
||||
async def add_remove_favorite_session2(projectId: int, sessionId: int,
|
||||
context: schemas_ee.CurrentContext = Depends(OR_context)):
|
||||
return {
|
||||
"data": sessions_favorite.favorite_session(context=context, project_id=projectId, session_id=sessionId)}
|
||||
|
|
@ -325,7 +325,7 @@ def add_remove_favorite_session2(projectId: int, sessionId: int,
|
|||
|
||||
@app.get('/{projectId}/sessions/{sessionId}/assign', tags=["sessions"],
|
||||
dependencies=[OR_scope(Permissions.session_replay)])
|
||||
def assign_session(projectId: int, sessionId, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def assign_session(projectId: int, sessionId, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
data = sessions_assignments.get_by_session(project_id=projectId, session_id=sessionId,
|
||||
tenant_id=context.tenant_id,
|
||||
user_id=context.user_id)
|
||||
|
|
@ -338,7 +338,7 @@ def assign_session(projectId: int, sessionId, context: schemas.CurrentContext =
|
|||
|
||||
@app.get('/{projectId}/sessions/{sessionId}/assign/{issueId}', tags=["sessions", "issueTracking"],
|
||||
dependencies=[OR_scope(Permissions.session_replay)])
|
||||
def assign_session(projectId: int, sessionId: int, issueId: str,
|
||||
async def assign_session(projectId: int, sessionId: int, issueId: str,
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
data = sessions_assignments.get(project_id=projectId, session_id=sessionId, assignment_id=issueId,
|
||||
tenant_id=context.tenant_id, user_id=context.user_id)
|
||||
|
|
@ -351,7 +351,7 @@ def assign_session(projectId: int, sessionId: int, issueId: str,
|
|||
|
||||
@app.post('/{projectId}/sessions/{sessionId}/assign/{issueId}/comment', tags=["sessions", "issueTracking"],
|
||||
dependencies=[OR_scope(Permissions.session_replay)])
|
||||
def comment_assignment(projectId: int, sessionId: int, issueId: str, data: schemas.CommentAssignmentSchema = Body(...),
|
||||
async def comment_assignment(projectId: int, sessionId: int, issueId: str, data: schemas.CommentAssignmentSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
data = sessions_assignments.comment(tenant_id=context.tenant_id, project_id=projectId,
|
||||
session_id=sessionId, assignment_id=issueId,
|
||||
|
|
@ -365,7 +365,7 @@ def comment_assignment(projectId: int, sessionId: int, issueId: str, data: schem
|
|||
|
||||
@app.post('/{projectId}/sessions/{sessionId}/notes', tags=["sessions", "notes"],
|
||||
dependencies=[OR_scope(Permissions.session_replay)])
|
||||
def create_note(projectId: int, sessionId: int, data: schemas.SessionNoteSchema = Body(...),
|
||||
async def create_note(projectId: int, sessionId: int, data: schemas.SessionNoteSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
if not sessions.session_exists(project_id=projectId, session_id=sessionId):
|
||||
return {"errors": ["Session not found"]}
|
||||
|
|
@ -380,7 +380,7 @@ def create_note(projectId: int, sessionId: int, data: schemas.SessionNoteSchema
|
|||
|
||||
@app.get('/{projectId}/sessions/{sessionId}/notes', tags=["sessions", "notes"],
|
||||
dependencies=[OR_scope(Permissions.session_replay)])
|
||||
def get_session_notes(projectId: int, sessionId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def get_session_notes(projectId: int, sessionId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
data = sessions_notes.get_session_notes(tenant_id=context.tenant_id, project_id=projectId,
|
||||
session_id=sessionId, user_id=context.user_id)
|
||||
if "errors" in data:
|
||||
|
|
@ -392,7 +392,7 @@ def get_session_notes(projectId: int, sessionId: int, context: schemas.CurrentCo
|
|||
|
||||
@app.post('/{projectId}/notes/{noteId}', tags=["sessions", "notes"],
|
||||
dependencies=[OR_scope(Permissions.session_replay)])
|
||||
def edit_note(projectId: int, noteId: int, data: schemas.SessionUpdateNoteSchema = Body(...),
|
||||
async def edit_note(projectId: int, noteId: int, data: schemas.SessionUpdateNoteSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
data = sessions_notes.edit(tenant_id=context.tenant_id, project_id=projectId, user_id=context.user_id,
|
||||
note_id=noteId, data=data)
|
||||
|
|
@ -405,7 +405,7 @@ def edit_note(projectId: int, noteId: int, data: schemas.SessionUpdateNoteSchema
|
|||
|
||||
@app.delete('/{projectId}/notes/{noteId}', tags=["sessions", "notes"],
|
||||
dependencies=[OR_scope(Permissions.session_replay)])
|
||||
def delete_note(projectId: int, noteId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
async def delete_note(projectId: int, noteId: int, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
data = sessions_notes.delete(tenant_id=context.tenant_id, project_id=projectId, user_id=context.user_id,
|
||||
note_id=noteId)
|
||||
return data
|
||||
|
|
@ -413,21 +413,21 @@ def delete_note(projectId: int, noteId: int, context: schemas.CurrentContext = D
|
|||
|
||||
@app.get('/{projectId}/notes/{noteId}/slack/{webhookId}', tags=["sessions", "notes"],
|
||||
dependencies=[OR_scope(Permissions.session_replay)])
|
||||
def share_note_to_slack(projectId: int, noteId: int, webhookId: int,
|
||||
async def share_note_to_slack(projectId: int, noteId: int, webhookId: int,
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return sessions_notes.share_to_slack(tenant_id=context.tenant_id, project_id=projectId, user_id=context.user_id,
|
||||
note_id=noteId, webhook_id=webhookId)
|
||||
|
||||
|
||||
@app.get('/{projectId}/notes/{noteId}/msteams/{webhookId}', tags=["sessions", "notes"])
|
||||
def share_note_to_msteams(projectId: int, noteId: int, webhookId: int,
|
||||
async def share_note_to_msteams(projectId: int, noteId: int, webhookId: int,
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return sessions_notes.share_to_msteams(tenant_id=context.tenant_id, project_id=projectId, user_id=context.user_id,
|
||||
note_id=noteId, webhook_id=webhookId)
|
||||
|
||||
|
||||
@app.post('/{projectId}/notes', tags=["sessions", "notes"], dependencies=[OR_scope(Permissions.session_replay)])
|
||||
def get_all_notes(projectId: int, data: schemas.SearchNoteSchema = Body(...),
|
||||
async def get_all_notes(projectId: int, data: schemas.SearchNoteSchema = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
data = sessions_notes.get_all_notes_by_project_id(tenant_id=context.tenant_id, project_id=projectId,
|
||||
user_id=context.user_id, data=data)
|
||||
|
|
@ -437,6 +437,6 @@ def get_all_notes(projectId: int, data: schemas.SearchNoteSchema = Body(...),
|
|||
|
||||
|
||||
@app.post('/{projectId}/click_maps/search', tags=["click maps"], dependencies=[OR_scope(Permissions.session_replay)])
|
||||
def click_map_search(projectId: int, data: schemas.FlatClickMapSessionsSearch = Body(...),
|
||||
async def click_map_search(projectId: int, data: schemas.FlatClickMapSessionsSearch = Body(...),
|
||||
context: schemas.CurrentContext = Depends(OR_context)):
|
||||
return {"data": click_maps.search_short_session(user_id=context.user_id, data=data, project_id=projectId)}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ public_app, app, app_apikey = get_routers()
|
|||
|
||||
|
||||
@app.get('/client/roles', tags=["client", "roles"])
|
||||
def get_roles(context: schemas_ee.CurrentContext = Depends(OR_context)):
|
||||
async def get_roles(context: schemas_ee.CurrentContext = Depends(OR_context)):
|
||||
return {
|
||||
'data': roles.get_roles(tenant_id=context.tenant_id)
|
||||
}
|
||||
|
|
@ -22,7 +22,7 @@ def get_roles(context: schemas_ee.CurrentContext = Depends(OR_context)):
|
|||
|
||||
@app.post('/client/roles', tags=["client", "roles"])
|
||||
@app.put('/client/roles', tags=["client", "roles"])
|
||||
def add_role(data: schemas_ee.RolePayloadSchema = Body(...), context: schemas_ee.CurrentContext = Depends(OR_context)):
|
||||
async def add_role(data: schemas_ee.RolePayloadSchema = Body(...), context: schemas_ee.CurrentContext = Depends(OR_context)):
|
||||
data = roles.create(tenant_id=context.tenant_id, user_id=context.user_id, data=data)
|
||||
if "errors" in data:
|
||||
return data
|
||||
|
|
@ -34,7 +34,7 @@ def add_role(data: schemas_ee.RolePayloadSchema = Body(...), context: schemas_ee
|
|||
|
||||
@app.post('/client/roles/{roleId}', tags=["client", "roles"])
|
||||
@app.put('/client/roles/{roleId}', tags=["client", "roles"])
|
||||
def edit_role(roleId: int, data: schemas_ee.RolePayloadSchema = Body(...),
|
||||
async def edit_role(roleId: int, data: schemas_ee.RolePayloadSchema = Body(...),
|
||||
context: schemas_ee.CurrentContext = Depends(OR_context)):
|
||||
data = roles.update(tenant_id=context.tenant_id, user_id=context.user_id, role_id=roleId, data=data)
|
||||
if "errors" in data:
|
||||
|
|
@ -46,7 +46,7 @@ def edit_role(roleId: int, data: schemas_ee.RolePayloadSchema = Body(...),
|
|||
|
||||
|
||||
@app.delete('/client/roles/{roleId}', tags=["client", "roles"])
|
||||
def delete_role(roleId: int, context: schemas_ee.CurrentContext = Depends(OR_context)):
|
||||
async def delete_role(roleId: int, context: schemas_ee.CurrentContext = Depends(OR_context)):
|
||||
data = roles.delete(tenant_id=context.tenant_id, user_id=context.user_id, role_id=roleId)
|
||||
if "errors" in data:
|
||||
return data
|
||||
|
|
@ -56,12 +56,12 @@ def delete_role(roleId: int, context: schemas_ee.CurrentContext = Depends(OR_con
|
|||
|
||||
|
||||
@app.get('/assist/credentials', tags=["assist"])
|
||||
def get_assist_credentials():
|
||||
async def get_assist_credentials():
|
||||
return {"data": assist_helper.get_full_config()}
|
||||
|
||||
|
||||
@app.post('/trails', tags=["traces", "trails"])
|
||||
def get_trails(data: schemas_ee.TrailSearchPayloadSchema = Body(...),
|
||||
async def get_trails(data: schemas_ee.TrailSearchPayloadSchema = Body(...),
|
||||
context: schemas_ee.CurrentContext = Depends(OR_context)):
|
||||
return {
|
||||
'data': traces.get_all(tenant_id=context.tenant_id, data=data)
|
||||
|
|
@ -69,12 +69,12 @@ def get_trails(data: schemas_ee.TrailSearchPayloadSchema = Body(...),
|
|||
|
||||
|
||||
@app.post('/trails/actions', tags=["traces", "trails"])
|
||||
def get_available_trail_actions(context: schemas_ee.CurrentContext = Depends(OR_context)):
|
||||
async def get_available_trail_actions(context: schemas_ee.CurrentContext = Depends(OR_context)):
|
||||
return {'data': traces.get_available_actions(tenant_id=context.tenant_id)}
|
||||
|
||||
|
||||
@app.put('/{projectId}/assist/save', tags=["assist"])
|
||||
def sign_record_for_upload(projectId: int, data: schemas_ee.AssistRecordPayloadSchema = Body(...),
|
||||
async def sign_record_for_upload(projectId: int, data: schemas_ee.AssistRecordPayloadSchema = Body(...),
|
||||
context: schemas_ee.CurrentContext = Depends(OR_context)):
|
||||
if not sessions.session_exists(project_id=projectId, session_id=data.session_id):
|
||||
return {"errors": ["Session not found"]}
|
||||
|
|
@ -82,7 +82,7 @@ def sign_record_for_upload(projectId: int, data: schemas_ee.AssistRecordPayloadS
|
|||
|
||||
|
||||
@app.put('/{projectId}/assist/save/done', tags=["assist"])
|
||||
def save_record_after_upload(projectId: int, data: schemas_ee.AssistRecordSavePayloadSchema = Body(...),
|
||||
async def save_record_after_upload(projectId: int, data: schemas_ee.AssistRecordSavePayloadSchema = Body(...),
|
||||
context: schemas_ee.CurrentContext = Depends(OR_context)):
|
||||
if not sessions.session_exists(project_id=projectId, session_id=data.session_id):
|
||||
return {"errors": ["Session not found"]}
|
||||
|
|
@ -90,18 +90,18 @@ def save_record_after_upload(projectId: int, data: schemas_ee.AssistRecordSavePa
|
|||
|
||||
|
||||
@app.post('/{projectId}/assist/records', tags=["assist"])
|
||||
def search_records(projectId: int, data: schemas_ee.AssistRecordSearchPayloadSchema = Body(...),
|
||||
async def search_records(projectId: int, data: schemas_ee.AssistRecordSearchPayloadSchema = Body(...),
|
||||
context: schemas_ee.CurrentContext = Depends(OR_context)):
|
||||
return {"data": assist_records.search_records(project_id=projectId, data=data, context=context)}
|
||||
|
||||
|
||||
@app.get('/{projectId}/assist/records/{recordId}', tags=["assist"])
|
||||
def get_record(projectId: int, recordId: int, context: schemas_ee.CurrentContext = Depends(OR_context)):
|
||||
async def get_record(projectId: int, recordId: int, context: schemas_ee.CurrentContext = Depends(OR_context)):
|
||||
return {"data": assist_records.get_record(project_id=projectId, record_id=recordId, context=context)}
|
||||
|
||||
|
||||
@app.post('/{projectId}/assist/records/{recordId}', tags=["assist"])
|
||||
def update_record(projectId: int, recordId: int, data: schemas_ee.AssistRecordUpdatePayloadSchema = Body(...),
|
||||
async def update_record(projectId: int, recordId: int, data: schemas_ee.AssistRecordUpdatePayloadSchema = Body(...),
|
||||
context: schemas_ee.CurrentContext = Depends(OR_context)):
|
||||
result = assist_records.update_record(project_id=projectId, record_id=recordId, data=data, context=context)
|
||||
if "errors" in result:
|
||||
|
|
@ -110,7 +110,7 @@ def update_record(projectId: int, recordId: int, data: schemas_ee.AssistRecordUp
|
|||
|
||||
|
||||
@app.delete('/{projectId}/assist/records/{recordId}', tags=["assist"])
|
||||
def delete_record(projectId: int, recordId: int, context: schemas_ee.CurrentContext = Depends(OR_context)):
|
||||
async def delete_record(projectId: int, recordId: int, context: schemas_ee.CurrentContext = Depends(OR_context)):
|
||||
result = assist_records.delete_record(project_id=projectId, record_id=recordId, context=context)
|
||||
if "errors" in result:
|
||||
return result
|
||||
|
|
@ -118,7 +118,7 @@ def delete_record(projectId: int, recordId: int, context: schemas_ee.CurrentCont
|
|||
|
||||
|
||||
@app.post('/{projectId}/signals', tags=['signals'])
|
||||
def send_interactions(projectId: int, data: schemas_ee.SignalsSchema = Body(...),
|
||||
async def send_interactions(projectId: int, data: schemas_ee.SignalsSchema = Body(...),
|
||||
context: schemas_ee.CurrentContext = Depends(OR_context)):
|
||||
data = signals.handle_frontend_signals_queued(project_id=projectId, user_id=context.user_id, data=data)
|
||||
|
||||
|
|
@ -129,6 +129,6 @@ def send_interactions(projectId: int, data: schemas_ee.SignalsSchema = Body(...)
|
|||
|
||||
@app.post('/{projectId}/dashboard/insights', tags=["insights"])
|
||||
@app.post('/{projectId}/dashboard/insights', tags=["insights"])
|
||||
def sessions_search(projectId: int, data: schemas_ee.GetInsightsSchema = Body(...),
|
||||
async def sessions_search(projectId: int, data: schemas_ee.GetInsightsSchema = Body(...),
|
||||
context: schemas_ee.CurrentContext = Depends(OR_context)):
|
||||
return {'data': sessions_insights.fetch_selected(data=data, project_id=projectId)}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue