System
DeleteTempFileRequest
Bases: BaseModel
Request model for deleting a temporary file.
Attributes:
-
path(str) –The path of the temporary file to delete.
Source code in app/api/v1/endpoints/system.py
133 134 135 136 137 138 139 140 141 | |
FilePathResponse
Bases: BaseModel
File path response.
Source code in app/api/v1/endpoints/system.py
26 27 28 29 | |
MessageResponse
Bases: BaseModel
Generic message response.
Source code in app/api/v1/endpoints/system.py
19 20 21 22 23 | |
OpenFileRequest
Bases: BaseModel
Request model for opening a file.
Attributes:
-
document_id(str) –The ID of the document to open.
Source code in app/api/v1/endpoints/system.py
32 33 34 35 36 37 38 39 40 | |
delete_temp_file(request, service, current_admin)
async
Delete a temporary uploaded file.
Admin only. Used when user cancels connector creation after uploading.
Parameters:
-
request(DeleteTempFileRequest) –The request body containing the file path.
-
service(Annotated[DocumentService, Depends(get_document_service)]) –The document service instance.
-
current_admin(Annotated[User, Depends(get_current_admin)]) –The currently authenticated admin user.
Returns:
-
MessageResponse–A dictionary containing a success message.
Raises:
-
Exception–If there's an error during file deletion.
Source code in app/api/v1/endpoints/system.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | |
download_file(document_id, service, current_user)
async
Download a file based on document ID. Safety checks are performed by SystemService.
Source code in app/api/v1/endpoints/system.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
open_file_external(request, service, current_user)
async
Open a file using the system's default application based on document ID.
Reconstructs the full path using connector configuration. Basic auth required.
Parameters:
-
request(OpenFileRequest) –The request body containing document_id.
-
service(Annotated[SystemService, Depends(get_system_service)]) –The system service instance.
-
current_user(Annotated[User, Depends(get_current_user)]) –The currently authenticated user.
Returns:
-
MessageResponse–A dictionary containing the status of the operation.
Raises:
-
Exception–If there's an error opening the file.
Source code in app/api/v1/endpoints/system.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | |
upload_file(service, current_admin, file=File(...))
async
Upload a file to the temporary area.
Admin only.
Parameters:
-
service(Annotated[DocumentService, Depends(get_document_service)]) –The document service instance.
-
current_admin(Annotated[User, Depends(get_current_admin)]) –The currently authenticated admin user.
-
file(UploadFile, default:File(...)) –The file to be uploaded.
Returns:
-
FilePathResponse–A dictionary containing the path of the uploaded file.
Raises:
-
Exception–If there's an error during file upload.
Source code in app/api/v1/endpoints/system.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | |