style: apply rustfmt formatting to fix CI
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -325,9 +325,7 @@ impl FileReadPort for FileBlobReadRepository {
|
||||
.fetch_all(self.pool.as_ref())
|
||||
.await
|
||||
}
|
||||
.map_err(|e| {
|
||||
DomainError::internal_error("FileBlobRead", format!("list_for_owner: {e}"))
|
||||
})?;
|
||||
.map_err(|e| DomainError::internal_error("FileBlobRead", format!("list_for_owner: {e}")))?;
|
||||
|
||||
rows.into_iter()
|
||||
.map(|(id, name, fid, fpath, size, mime, ca, ma, uid)| {
|
||||
|
||||
@@ -868,7 +868,9 @@ impl FolderRepository for FolderDbRepository {
|
||||
user_id: &str,
|
||||
) -> Result<Vec<Folder>, DomainError> {
|
||||
let (where_extra, name_pattern) = match name_contains {
|
||||
Some(name) if name.len() >= 3 => (" AND fo.name ILIKE $3", Some(super::like_escape(name))),
|
||||
Some(name) if name.len() >= 3 => {
|
||||
(" AND fo.name ILIKE $3", Some(super::like_escape(name)))
|
||||
}
|
||||
_ => ("", None),
|
||||
};
|
||||
|
||||
|
||||
@@ -50,6 +50,9 @@ pub use user_pg_repository::UserPgRepository;
|
||||
/// `%` is a wildcard in LIKE patterns.
|
||||
#[inline]
|
||||
pub fn like_escape(raw: &str) -> String {
|
||||
let escaped = raw.replace('\\', "\\\\").replace('%', "\\%").replace('_', "\\_");
|
||||
let escaped = raw
|
||||
.replace('\\', "\\\\")
|
||||
.replace('%', "\\%")
|
||||
.replace('_', "\\_");
|
||||
format!("%{escaped}%")
|
||||
}
|
||||
|
||||
@@ -102,10 +102,7 @@ impl SettingsRepository for SettingsPgRepository {
|
||||
///
|
||||
/// Only the first caller that inserts the row gets `rows_affected == 1`;
|
||||
/// concurrent callers see 0 rows affected and receive `false`.
|
||||
async fn try_claim_initialization(
|
||||
&self,
|
||||
admin_user_id: &str,
|
||||
) -> Result<bool, DomainError> {
|
||||
async fn try_claim_initialization(&self, admin_user_id: &str) -> Result<bool, DomainError> {
|
||||
let result = sqlx::query(
|
||||
"INSERT INTO auth.admin_settings (key, value, category, is_secret, updated_by, updated_at)
|
||||
VALUES ('system_initialized', 'true', 'system', false, $1, NOW())
|
||||
|
||||
@@ -202,10 +202,7 @@ impl ShareStoragePort for SharePgRepository {
|
||||
.await
|
||||
.map_err(|e| {
|
||||
tracing::error!("Database error deleting share for user: {}", e);
|
||||
DomainError::internal_error(
|
||||
"Share",
|
||||
format!("Failed to delete share: {e}"),
|
||||
)
|
||||
DomainError::internal_error("Share", format!("Failed to delete share: {e}"))
|
||||
})?;
|
||||
|
||||
if result.rows_affected() == 0 {
|
||||
@@ -242,10 +239,7 @@ impl ShareStoragePort for SharePgRepository {
|
||||
.await
|
||||
.map_err(|e| {
|
||||
tracing::error!("Database error finding shares by item for user: {}", e);
|
||||
DomainError::internal_error(
|
||||
"Share",
|
||||
format!("Failed to find shares by item: {e}"),
|
||||
)
|
||||
DomainError::internal_error("Share", format!("Failed to find shares by item: {e}"))
|
||||
})?;
|
||||
|
||||
rows.iter().map(Self::row_to_entity).collect()
|
||||
|
||||
Reference in New Issue
Block a user