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")
|
connector_type = request.path_params.get("connector_type", "google_drive")
|
||||||
data = await request.json()
|
data = await request.json()
|
||||||
max_files = data.get("max_files")
|
max_files = data.get("max_files")
|
||||||
|
selected_files = data.get("selected_files")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
user = request.state.user
|
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 = [conn for conn in connections if conn.is_active]
|
||||||
|
active_connections = active_connections[:1] # TODO: Temporary workaround for duplicate connections
|
||||||
if not active_connections:
|
if not active_connections:
|
||||||
return JSONResponse(
|
return JSONResponse(
|
||||||
{"error": f"No active {connector_type} connections found"},
|
{"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
|
# Start sync tasks for all active connections
|
||||||
task_ids = []
|
task_ids = []
|
||||||
for connection in active_connections:
|
for connection in active_connections:
|
||||||
task_id = await connector_service.sync_connector_files(
|
if selected_files:
|
||||||
connection.connection_id,
|
task_id = await connector_service.sync_specific_files(
|
||||||
user.user_id,
|
connection.connection_id,
|
||||||
max_files,
|
user.user_id,
|
||||||
jwt_token=jwt_token,
|
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)
|
task_ids.append(task_id)
|
||||||
|
|
||||||
return JSONResponse(
|
return JSONResponse(
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue