allow selection of selected files
This commit is contained in:
parent
d8ec7584da
commit
18f41523c1
1 changed files with 16 additions and 6 deletions
|
|
@ -22,6 +22,7 @@ async def connector_sync(request: Request, connector_service, session_manager):
|
|||
connector_type = request.path_params.get("connector_type", "google_drive")
|
||||
data = await request.json()
|
||||
max_files = data.get("max_files")
|
||||
selected_files = data.get("selected_files")
|
||||
|
||||
try:
|
||||
user = request.state.user
|
||||
|
|
@ -33,6 +34,7 @@ async def connector_sync(request: Request, connector_service, session_manager):
|
|||
)
|
||||
|
||||
active_connections = [conn for conn in connections if conn.is_active]
|
||||
active_connections = active_connections[:1] # TODO: Temporary workaround for duplicate connections
|
||||
if not active_connections:
|
||||
return JSONResponse(
|
||||
{"error": f"No active {connector_type} connections found"},
|
||||
|
|
@ -42,12 +44,20 @@ async def connector_sync(request: Request, connector_service, session_manager):
|
|||
# Start sync tasks for all active connections
|
||||
task_ids = []
|
||||
for connection in active_connections:
|
||||
task_id = await connector_service.sync_connector_files(
|
||||
connection.connection_id,
|
||||
user.user_id,
|
||||
max_files,
|
||||
jwt_token=jwt_token,
|
||||
)
|
||||
if selected_files:
|
||||
task_id = await connector_service.sync_specific_files(
|
||||
connection.connection_id,
|
||||
user.user_id,
|
||||
selected_files,
|
||||
jwt_token=jwt_token,
|
||||
)
|
||||
else:
|
||||
task_id = await connector_service.sync_connector_files(
|
||||
connection.connection_id,
|
||||
user.user_id,
|
||||
max_files,
|
||||
jwt_token=jwt_token,
|
||||
)
|
||||
task_ids.append(task_id)
|
||||
|
||||
return JSONResponse(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue