fix
This commit is contained in:
@@ -186,12 +186,16 @@ pub async fn get_document(
|
||||
)]
|
||||
pub async fn upload_document(
|
||||
State(state): State<AppState>,
|
||||
scoped_conn: TenantScopedConn,
|
||||
TenantScopedConn {
|
||||
mut conn,
|
||||
tenant_id,
|
||||
user_id,
|
||||
..
|
||||
}: TenantScopedConn,
|
||||
mut multipart: Multipart,
|
||||
) -> AppResult<JsonResponse<DocumentDetailResponse>> {
|
||||
let tenant_id = scoped_conn.tenant_id;
|
||||
let user_id = scoped_conn.user_id;
|
||||
drop(scoped_conn);
|
||||
let tenant_id = tenant_id;
|
||||
let user_id = user_id;
|
||||
let mut file_bytes: Option<Vec<u8>> = None;
|
||||
let mut original_name: Option<String> = None;
|
||||
let mut content_type: Option<String> = None;
|
||||
@@ -353,7 +357,10 @@ pub async fn upload_document(
|
||||
};
|
||||
|
||||
let service = DocumentsService::new(&state);
|
||||
let outcome = match service.upload_document(tenant_id, user_id, request).await {
|
||||
let outcome = match service
|
||||
.upload_document(&mut conn, tenant_id, user_id, request)
|
||||
.await
|
||||
{
|
||||
Ok(outcome) => outcome,
|
||||
Err(err) => {
|
||||
error!(error = ?err, original_name = %original_name_for_log, "document upload failed");
|
||||
@@ -470,7 +477,7 @@ pub async fn get_document_asset(
|
||||
Path(asset_id): Path<Uuid>,
|
||||
Query(query): Query<AssetObjectsQuery>,
|
||||
TenantScopedConn {
|
||||
mut conn,
|
||||
conn,
|
||||
tenant_id,
|
||||
..
|
||||
}: TenantScopedConn,
|
||||
@@ -485,7 +492,7 @@ pub async fn get_document_asset(
|
||||
}
|
||||
let service = DocumentsService::new(&state);
|
||||
let detail = service
|
||||
.get_document_asset(&mut conn, tenant_id, asset_id, start, limit)
|
||||
.get_document_asset(conn, tenant_id, asset_id, start, limit)
|
||||
.await?;
|
||||
ok_json(detail)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user