MCPcopy Index your code
hub / github.com/vastsa/FileCodeBox / batch_update_files

Function batch_update_files

apps/admin/views.py:212–240  ·  view source on GitHub ↗
(
    data: BatchUpdateFileData,
    file_service: FileService,
)

Source from the content-addressed store, hash-verified

210
211
212async def batch_update_files(
213 data: BatchUpdateFileData,
214 file_service: FileService,
215):
216 if not data.ids:
217 raise HTTPException(status_code=400, detail="请选择要更新的文件")
218
219 update_data = {}
220 fields_set = data.model_fields_set
221 should_clear_expired_at = bool(data.clearExpiredAt or data.clear_expired_at)
222
223 if should_clear_expired_at:
224 update_data["expired_at"] = None
225 update_data["expired_count"] = -1
226 elif "expired_at" in fields_set and data.expired_at != "":
227 update_data["expired_at"] = data.expired_at
228
229 if (
230 not should_clear_expired_at
231 and "expired_count" in fields_set
232 and data.expired_count is not None
233 ):
234 update_data["expired_count"] = data.expired_count
235
236 if not update_data:
237 raise HTTPException(status_code=400, detail="请选择要更新的字段")
238
239 result = await file_service.update_files(data.ids, update_data)
240 return APIResponse(detail=result)
241
242
243@admin_api.patch("/file/batch-update")

Callers 2

file_batch_updateFunction · 0.85
file_batch_update_postFunction · 0.85

Calls 2

APIResponseClass · 0.90
update_filesMethod · 0.80

Tested by

no test coverage detected