fmt
This commit is contained in:
@@ -11,9 +11,9 @@ use axum::{
|
||||
extract::FromRequestParts,
|
||||
http::{request::Parts, StatusCode},
|
||||
};
|
||||
use diesel::{pg::PgConnection, prelude::*};
|
||||
use axum_extra::headers::{authorization::Bearer, Authorization};
|
||||
use axum_extra::TypedHeader;
|
||||
use diesel::{pg::PgConnection, prelude::*};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use utoipa::ToSchema;
|
||||
|
||||
@@ -138,7 +138,8 @@ impl FromRequestParts<AppState> for TenantScopedConn {
|
||||
async move {
|
||||
let user = AuthenticatedUser::from_request_parts(parts, &state).await?;
|
||||
let tenant_id = user.tenant_id;
|
||||
let mut conn = if let Some(holder) = parts.extensions.remove::<TenantConnectionHolder>() {
|
||||
let mut conn = if let Some(holder) = parts.extensions.remove::<TenantConnectionHolder>()
|
||||
{
|
||||
holder
|
||||
.into_conn()
|
||||
.ok_or_else(|| AppError::internal("tenant connection unavailable"))?
|
||||
|
||||
@@ -1427,14 +1427,9 @@ impl<'a> DocumentsService<'a> {
|
||||
});
|
||||
|
||||
if let Some(deleted_at) = document.deleted_at {
|
||||
message.push_str(
|
||||
". Note: the existing document is currently in the trash.",
|
||||
);
|
||||
message.push_str(". Note: the existing document is currently in the trash.");
|
||||
if let Some(obj) = details.as_object_mut() {
|
||||
obj.insert(
|
||||
"conflict_document_in_trash".to_string(),
|
||||
Value::Bool(true),
|
||||
);
|
||||
obj.insert("conflict_document_in_trash".to_string(), Value::Bool(true));
|
||||
obj.insert(
|
||||
"conflict_document_deleted_at".to_string(),
|
||||
Value::String(to_iso(deleted_at)),
|
||||
@@ -1442,11 +1437,9 @@ impl<'a> DocumentsService<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
return Err(
|
||||
AppError::conflict(message)
|
||||
.with_code("duplicate_document")
|
||||
.with_details(details),
|
||||
);
|
||||
return Err(AppError::conflict(message)
|
||||
.with_code("duplicate_document")
|
||||
.with_details(details));
|
||||
}
|
||||
|
||||
if let Some(issued_at) = issued_at_override {
|
||||
|
||||
@@ -98,11 +98,8 @@ impl Worker {
|
||||
None => {
|
||||
warn!(job_id = %job.id, job_type = %job.job_type, "job detached from tenant; marking failed");
|
||||
if let Ok(mut conn) = self.state.db_unscoped() {
|
||||
let _ = mark_job_failed(
|
||||
&mut conn,
|
||||
job.id,
|
||||
"job detached from tenant context",
|
||||
);
|
||||
let _ =
|
||||
mark_job_failed(&mut conn, job.id, "job detached from tenant context");
|
||||
}
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user