mirror of
https://github.com/MODSetter/SurfSense.git
synced 2025-09-01 10:09:08 +00:00
clean up
This commit is contained in:
parent
85664f2ff8
commit
ecbb1f27e0
3 changed files with 2 additions and 23 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Reference in a new issue