Dev (#2456)
* refactor(chalice): upgraded dependencies * refactor(chalice): upgraded dependencies feat(chalice): support heatmaps * fix(chalice): fixed Math-operators validation refactor(chalice): search for sessions that have events for heatmaps * refactor(chalice): search for sessions that have at least 1 location event for heatmaps * refactor(chalice): upgraded dependencies * refactor(chalice): upgraded dependencies feat(chalice): support heatmaps * fix(chalice): fixed Math-operators validation refactor(chalice): search for sessions that have events for heatmaps * refactor(chalice): search for sessions that have at least 1 location event for heatmaps * refactor(chalice): upgraded dependencies refactor(crons): upgraded dependencies refactor(alerts): upgraded dependencies * feat(chalice): get top 10 values for autocomplete CH * refactor(chalice): cleaned code refactor(chalice): upgraded dependencies refactor(alerts): upgraded dependencies refactor(crons): upgraded dependencies * feat(chalice): autocomplete return top 10 with stats * fix(chalice): fixed autocomplete top 10 meta-filters * fix(chalice): fixed multi-cookies set regression(chalice): removed sessionId to str wrapper
This commit is contained in:
parent
66c6051890
commit
3411fa37b2
5 changed files with 11 additions and 26 deletions
|
|
@ -41,10 +41,6 @@ class ORRoute(APIRoute):
|
|||
if isinstance(response, JSONResponse):
|
||||
response: JSONResponse = response
|
||||
body = json.loads(response.body.decode('utf8'))
|
||||
body = helper.cast_session_id_to_string(body)
|
||||
response = JSONResponse(content=body, status_code=response.status_code,
|
||||
headers={k: v for k, v in response.headers.items() if k != "content-length"},
|
||||
media_type=response.media_type, background=response.background)
|
||||
if response.status_code == 200 \
|
||||
and body is not None and isinstance(body, dict) \
|
||||
and body.get("errors") is not None:
|
||||
|
|
|
|||
|
|
@ -33,16 +33,15 @@ async def get_all_signup():
|
|||
if not tenants.tenants_exists_sync(use_pool=False):
|
||||
@public_app.post('/signup', tags=['signup'])
|
||||
@public_app.put('/signup', tags=['signup'])
|
||||
async def signup_handler(data: schemas.UserSignupSchema = Body(...)):
|
||||
async def signup_handler(response: JSONResponse, data: schemas.UserSignupSchema = Body(...)):
|
||||
content = await signup.create_tenant(data)
|
||||
if "errors" in content:
|
||||
return content
|
||||
refresh_token = content.pop("refreshToken")
|
||||
refresh_token_max_age = content.pop("refreshTokenMaxAge")
|
||||
response = JSONResponse(content=content)
|
||||
response.set_cookie(key="refreshToken", value=refresh_token, path="/api/refresh",
|
||||
max_age=refresh_token_max_age, secure=True, httponly=True)
|
||||
return response
|
||||
return content
|
||||
|
||||
|
||||
@public_app.post('/login', tags=["authentication"])
|
||||
|
|
@ -79,13 +78,12 @@ def login_user(response: JSONResponse, spot: Optional[bool] = False, data: schem
|
|||
spot_refresh_token = r.pop("spotRefreshToken")
|
||||
spot_refresh_token_max_age = r.pop("spotRefreshTokenMaxAge")
|
||||
|
||||
response = JSONResponse(content=content)
|
||||
response.set_cookie(key="refreshToken", value=refresh_token, path="/api/refresh",
|
||||
max_age=refresh_token_max_age, secure=True, httponly=True)
|
||||
if spot:
|
||||
response.set_cookie(key="spotRefreshToken", value=spot_refresh_token, path="/api/spot/refresh",
|
||||
max_age=spot_refresh_token_max_age, secure=True, httponly=True)
|
||||
return response
|
||||
return content
|
||||
|
||||
|
||||
@app.get('/logout', tags=["login"])
|
||||
|
|
@ -97,13 +95,12 @@ def logout_user(response: Response, context: schemas.CurrentContext = Depends(OR
|
|||
|
||||
|
||||
@app.get('/refresh', tags=["login"])
|
||||
def refresh_login(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
def refresh_login(response: JSONResponse, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
r = users.refresh(user_id=context.user_id)
|
||||
content = {"jwt": r.get("jwt")}
|
||||
response = JSONResponse(content=content)
|
||||
response.set_cookie(key="refreshToken", value=r.get("refreshToken"), path="/api/refresh",
|
||||
max_age=r.pop("refreshTokenMaxAge"), secure=True, httponly=True)
|
||||
return response
|
||||
return content
|
||||
|
||||
|
||||
@app.get('/account', tags=['accounts'])
|
||||
|
|
|
|||
|
|
@ -42,10 +42,9 @@ def login_spot(response: JSONResponse, data: schemas.UserLoginSchema = Body(...)
|
|||
"user": r
|
||||
}
|
||||
}
|
||||
response = JSONResponse(content=content)
|
||||
response.set_cookie(key="spotRefreshToken", value=refresh_token, path=COOKIE_PATH,
|
||||
max_age=refresh_token_max_age, secure=True, httponly=True)
|
||||
return response
|
||||
return content
|
||||
|
||||
|
||||
@app.get('/logout')
|
||||
|
|
@ -56,13 +55,12 @@ def logout_spot(response: Response, context: schemas.CurrentContext = Depends(OR
|
|||
|
||||
|
||||
@app.get('/refresh')
|
||||
def refresh_spot_login(context: schemas.CurrentContext = Depends(OR_context)):
|
||||
def refresh_spot_login(response: JSONResponse, context: schemas.CurrentContext = Depends(OR_context)):
|
||||
r = spot.refresh(user_id=context.user_id)
|
||||
content = {"jwt": r.get("jwt")}
|
||||
response = JSONResponse(content=content)
|
||||
response.set_cookie(key="spotRefreshToken", value=r.get("refreshToken"), path=COOKIE_PATH,
|
||||
max_age=r.pop("refreshTokenMaxAge"), secure=True, httponly=True)
|
||||
return response
|
||||
return content
|
||||
|
||||
|
||||
@app.get('/integrations/slack/channels', tags=["integrations"])
|
||||
|
|
|
|||
|
|
@ -43,10 +43,6 @@ class ORRoute(APIRoute):
|
|||
if isinstance(response, JSONResponse):
|
||||
response: JSONResponse = response
|
||||
body = json.loads(response.body.decode('utf8'))
|
||||
body = helper.cast_session_id_to_string(body)
|
||||
response = JSONResponse(content=body, status_code=response.status_code,
|
||||
headers={k: v for k, v in response.headers.items() if k != "content-length"},
|
||||
media_type=response.media_type, background=response.background)
|
||||
if response.status_code == 200 \
|
||||
and body is not None and isinstance(body, dict) \
|
||||
and body.get("errors") is not None:
|
||||
|
|
|
|||
|
|
@ -39,16 +39,15 @@ async def get_all_signup():
|
|||
if config("MULTI_TENANTS", cast=bool, default=False) or not tenants.tenants_exists_sync(use_pool=False):
|
||||
@public_app.post('/signup', tags=['signup'])
|
||||
@public_app.put('/signup', tags=['signup'])
|
||||
async def signup_handler(data: schemas.UserSignupSchema = Body(...)):
|
||||
async def signup_handler(response: JSONResponse, data: schemas.UserSignupSchema = Body(...)):
|
||||
content = await signup.create_tenant(data)
|
||||
if "errors" in content:
|
||||
return content
|
||||
refresh_token = content.pop("refreshToken")
|
||||
refresh_token_max_age = content.pop("refreshTokenMaxAge")
|
||||
response = JSONResponse(content=content)
|
||||
response.set_cookie(key="refreshToken", value=refresh_token, path="/api/refresh",
|
||||
max_age=refresh_token_max_age, secure=True, httponly=True)
|
||||
return response
|
||||
return content
|
||||
|
||||
|
||||
@public_app.post('/login', tags=["authentication"])
|
||||
|
|
@ -85,13 +84,12 @@ def login_user(response: JSONResponse, spot: Optional[bool] = False, data: schem
|
|||
spot_refresh_token = r.pop("spotRefreshToken")
|
||||
spot_refresh_token_max_age = r.pop("spotRefreshTokenMaxAge")
|
||||
|
||||
response = JSONResponse(content=content)
|
||||
response.set_cookie(key="refreshToken", value=refresh_token, path="/api/refresh",
|
||||
max_age=refresh_token_max_age, secure=True, httponly=True)
|
||||
if spot:
|
||||
response.set_cookie(key="spotRefreshToken", value=spot_refresh_token, path="/api/spot/refresh",
|
||||
max_age=spot_refresh_token_max_age, secure=True, httponly=True)
|
||||
return response
|
||||
return content
|
||||
|
||||
|
||||
@app.get('/logout', tags=["login"])
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue