mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-10 20:35:17 +02:00
feat: update OAuth routes to use async connector naming
This commit is contained in:
parent
42397f1364
commit
0ba64fe6c4
5 changed files with 55 additions and 20 deletions
|
|
@ -26,7 +26,10 @@ from app.db import (
|
|||
from app.schemas.atlassian_auth_credentials import AtlassianAuthCredentialsBase
|
||||
from app.users import current_active_user
|
||||
from app.utils.oauth_security import OAuthStateManager, TokenEncryption
|
||||
from app.utils.connector_naming import generate_unique_connector_name, extract_identifier_from_credentials
|
||||
from app.utils.connector_naming import (
|
||||
extract_identifier_from_credentials,
|
||||
generate_unique_connector_name,
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
@ -293,9 +296,13 @@ async def confluence_callback(
|
|||
connector_identifier = extract_identifier_from_credentials(
|
||||
SearchSourceConnectorType.CONFLUENCE_CONNECTOR, connector_config
|
||||
)
|
||||
# Generate a unique, user-friendly connector name from credentials/account info
|
||||
connector_name = generate_unique_connector_name(
|
||||
SearchSourceConnectorType.CONFLUENCE_CONNECTOR, connector_identifier
|
||||
# Generate a unique, user-friendly connector name
|
||||
connector_name = await generate_unique_connector_name(
|
||||
session,
|
||||
SearchSourceConnectorType.CONFLUENCE_CONNECTOR,
|
||||
space_id,
|
||||
user_id,
|
||||
connector_identifier,
|
||||
)
|
||||
# Create new connector
|
||||
new_connector = SearchSourceConnector(
|
||||
|
|
|
|||
|
|
@ -26,7 +26,10 @@ from app.db import (
|
|||
from app.schemas.discord_auth_credentials import DiscordAuthCredentialsBase
|
||||
from app.users import current_active_user
|
||||
from app.utils.oauth_security import OAuthStateManager, TokenEncryption
|
||||
from app.utils.connector_naming import generate_unique_connector_name, extract_identifier_from_credentials
|
||||
from app.utils.connector_naming import (
|
||||
extract_identifier_from_credentials,
|
||||
generate_unique_connector_name,
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
@ -289,9 +292,13 @@ async def discord_callback(
|
|||
connector_identifier = extract_identifier_from_credentials(
|
||||
SearchSourceConnectorType.DISCORD_CONNECTOR, connector_config
|
||||
)
|
||||
# Generate a unique, user-friendly connector name from credentials/account info
|
||||
connector_name = generate_unique_connector_name(
|
||||
SearchSourceConnectorType.DISCORD_CONNECTOR, connector_identifier
|
||||
# Generate a unique, user-friendly connector name
|
||||
connector_name = await generate_unique_connector_name(
|
||||
session,
|
||||
SearchSourceConnectorType.DISCORD_CONNECTOR,
|
||||
space_id,
|
||||
user_id,
|
||||
connector_identifier,
|
||||
)
|
||||
# Create new connector
|
||||
new_connector = SearchSourceConnector(
|
||||
|
|
|
|||
|
|
@ -27,7 +27,10 @@ from app.db import (
|
|||
from app.schemas.atlassian_auth_credentials import AtlassianAuthCredentialsBase
|
||||
from app.users import current_active_user
|
||||
from app.utils.oauth_security import OAuthStateManager, TokenEncryption
|
||||
from app.utils.connector_naming import generate_unique_connector_name, extract_identifier_from_credentials
|
||||
from app.utils.connector_naming import (
|
||||
extract_identifier_from_credentials,
|
||||
generate_unique_connector_name,
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
@ -311,9 +314,13 @@ async def jira_callback(
|
|||
connector_identifier = extract_identifier_from_credentials(
|
||||
SearchSourceConnectorType.JIRA_CONNECTOR, connector_config
|
||||
)
|
||||
# Generate a unique, user-friendly connector name from credentials/account info
|
||||
connector_name = generate_unique_connector_name(
|
||||
SearchSourceConnectorType.JIRA_CONNECTOR, connector_identifier
|
||||
# Generate a unique, user-friendly connector name
|
||||
connector_name = await generate_unique_connector_name(
|
||||
session,
|
||||
SearchSourceConnectorType.JIRA_CONNECTOR,
|
||||
space_id,
|
||||
user_id,
|
||||
connector_identifier,
|
||||
)
|
||||
# Create new connector
|
||||
new_connector = SearchSourceConnector(
|
||||
|
|
|
|||
|
|
@ -26,7 +26,10 @@ from app.db import (
|
|||
from app.schemas.notion_auth_credentials import NotionAuthCredentialsBase
|
||||
from app.users import current_active_user
|
||||
from app.utils.oauth_security import OAuthStateManager, TokenEncryption
|
||||
from app.utils.connector_naming import generate_unique_connector_name, extract_identifier_from_credentials
|
||||
from app.utils.connector_naming import (
|
||||
extract_identifier_from_credentials,
|
||||
generate_unique_connector_name,
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
@ -267,9 +270,13 @@ async def notion_callback(
|
|||
connector_identifier = extract_identifier_from_credentials(
|
||||
SearchSourceConnectorType.NOTION_CONNECTOR, connector_config
|
||||
)
|
||||
# Generate a unique, user-friendly connector name from credentials/account info
|
||||
connector_name = generate_unique_connector_name(
|
||||
SearchSourceConnectorType.NOTION_CONNECTOR, connector_identifier
|
||||
# Generate a unique, user-friendly connector name
|
||||
connector_name = await generate_unique_connector_name(
|
||||
session,
|
||||
SearchSourceConnectorType.NOTION_CONNECTOR,
|
||||
space_id,
|
||||
user_id,
|
||||
connector_identifier,
|
||||
)
|
||||
# Create new connector
|
||||
new_connector = SearchSourceConnector(
|
||||
|
|
|
|||
|
|
@ -25,8 +25,11 @@ from app.db import (
|
|||
)
|
||||
from app.schemas.slack_auth_credentials import SlackAuthCredentialsBase
|
||||
from app.users import current_active_user
|
||||
from app.utils.connector_naming import (
|
||||
extract_identifier_from_credentials,
|
||||
generate_unique_connector_name,
|
||||
)
|
||||
from app.utils.oauth_security import OAuthStateManager, TokenEncryption
|
||||
from app.utils.connector_naming import generate_unique_connector_name, extract_identifier_from_credentials
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
@ -277,9 +280,13 @@ async def slack_callback(
|
|||
connector_identifier = extract_identifier_from_credentials(
|
||||
SearchSourceConnectorType.SLACK_CONNECTOR, connector_config
|
||||
)
|
||||
# Generate a unique, user-friendly connector name from credentials/account info
|
||||
connector_name = generate_unique_connector_name(
|
||||
SearchSourceConnectorType.SLACK_CONNECTOR, connector_identifier
|
||||
# Generate a unique, user-friendly connector name
|
||||
connector_name = await generate_unique_connector_name(
|
||||
session,
|
||||
SearchSourceConnectorType.SLACK_CONNECTOR,
|
||||
space_id,
|
||||
user_id,
|
||||
connector_identifier,
|
||||
)
|
||||
|
||||
# Create new connector
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue