feat(chalice): changed delte jira integration
feat(chalice): changed delete github integration
This commit is contained in:
parent
a5b428de24
commit
feb999380f
2 changed files with 6 additions and 4 deletions
|
|
@ -27,7 +27,7 @@ def __get_default_integration(user_id):
|
|||
current_integrations["jira"] else None
|
||||
|
||||
|
||||
def get_integration(tenant_id, user_id, tool=None):
|
||||
def get_integration(tenant_id, user_id, tool=None, for_delete=False):
|
||||
if tool is None:
|
||||
tool = __get_default_integration(user_id=user_id)
|
||||
if tool is None:
|
||||
|
|
@ -37,7 +37,7 @@ def get_integration(tenant_id, user_id, tool=None):
|
|||
return {"errors": [f"issue tracking tool not supported yet, available: {SUPPORTED_TOOLS}"]}, None
|
||||
if tool == integration_jira_cloud.PROVIDER:
|
||||
integration = integration_jira_cloud.JIRAIntegration(tenant_id=tenant_id, user_id=user_id)
|
||||
if integration.integration is not None and not integration.integration.get("valid", True):
|
||||
if not for_delete and integration.integration is not None and not integration.integration.get("valid", True):
|
||||
return {"errors": ["JIRA: connexion issue/unauthorized"]}, integration
|
||||
return None, integration
|
||||
elif tool == integration_github.PROVIDER:
|
||||
|
|
|
|||
|
|
@ -491,7 +491,8 @@ def delete_default_issue_tracking_tool(context: schemas.CurrentContext = Depends
|
|||
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)
|
||||
user_id=context.user_id,
|
||||
for_delete=True)
|
||||
if error is not None:
|
||||
return error
|
||||
return {"data": integration.delete()}
|
||||
|
|
@ -501,7 +502,8 @@ def delete_jira_cloud(context: schemas.CurrentContext = Depends(OR_context)):
|
|||
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)
|
||||
user_id=context.user_id,
|
||||
for_delete=True)
|
||||
if error is not None:
|
||||
return error
|
||||
return {"data": integration.delete()}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue