This commit is contained in:
CREDO23 2025-08-26 11:53:27 +02:00
parent 85664f2ff8
commit ecbb1f27e0
3 changed files with 2 additions and 23 deletions

View file

@ -79,7 +79,7 @@ class GoogleCalendarConnector:
)
# Refresh the token if needed
if self._credentials.expired:
if self._credentials.expired or not self._credentials.valid:
try:
self._credentials.refresh(Request())
# Update the connector config in DB

View file

@ -78,7 +78,7 @@ class GoogleGmailConnector:
)
# Refresh the token if needed
if self._credentials.expired:
if self._credentials.expired or not self._credentials.valid:
try:
self._credentials.refresh(Request())
# Update the connector config in DB

View file

@ -60,27 +60,6 @@ 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,