mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-03 12:52:39 +02:00
updated the connector config after refreshing the token
This commit is contained in:
parent
3d93fe8186
commit
b0b6df0971
3 changed files with 72 additions and 13 deletions
|
|
@ -60,6 +60,27 @@ async def get_connector_by_id(
|
|||
return result.scalars().first()
|
||||
|
||||
|
||||
async def get_connector_by_type(
|
||||
session: AsyncSession, connector_type: SearchSourceConnectorType
|
||||
) -> SearchSourceConnector | None:
|
||||
"""
|
||||
Get a connector by type from the database.
|
||||
|
||||
Args:
|
||||
session: Database session
|
||||
connector_type: Type of the connector
|
||||
|
||||
Returns:
|
||||
Connector object if found, None otherwise
|
||||
"""
|
||||
result = await session.execute(
|
||||
select(SearchSourceConnector).filter(
|
||||
SearchSourceConnector.connector_type == connector_type,
|
||||
)
|
||||
)
|
||||
return result.scalars().first()
|
||||
|
||||
|
||||
def calculate_date_range(
|
||||
connector: SearchSourceConnector,
|
||||
start_date: str | None = None,
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ async def index_google_gmail_messages(
|
|||
|
||||
# Fetch recent Google gmail messages
|
||||
logger.info(f"Fetching recent emails for connector {connector_id}")
|
||||
messages, error = gmail_connector.get_recent_messages(
|
||||
messages, error = await gmail_connector.get_recent_messages(
|
||||
max_results=max_messages, days_back=days_back
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue