Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
make fmt-rust
  • Loading branch information
oguzkocer committed Dec 9, 2025
commit 68c1a3306fe58e6e8e030aaa9ab9bbd7fffa09e9
6 changes: 4 additions & 2 deletions wp_mobile/src/service/mock_post_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@ fn stress_test_batch_update(
let _result = cache.execute(|conn| {
if let Some(full_entity) = repo.select_by_entity_id(conn, entity_id)? {
let mut post = full_entity.data.post;
post.title.rendered = format!("Updated Post {} (batch #{})", post.id.0, current_count);
post.content.rendered = format!("<p>Content updated at batch #{}</p>", current_count);
post.title.rendered =
format!("Updated Post {} (batch #{})", post.id.0, current_count);
post.content.rendered =
format!("<p>Content updated at batch #{}</p>", current_count);
repo.upsert(conn, db_site, &post)?;
}
Ok::<_, wp_mobile_cache::SqliteDbError>(())
Expand Down
16 changes: 9 additions & 7 deletions wp_mobile/src/service/posts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,10 @@ impl PostService {
entity_id: &EntityId,
) -> Result<u64, wp_mobile_cache::SqliteDbError> {
let repo = PostRepository::<EditContext>::new();
self.cache
.execute(|connection| repo.delete_by_entity_id(connection, entity_id).map(|n| n as u64))
self.cache.execute(|connection| {
repo.delete_by_entity_id(connection, entity_id)
.map(|n| n as u64)
})
}

/// Delete a post by its WordPress post ID
Expand All @@ -186,8 +188,10 @@ impl PostService {
post_id: wp_api::posts::PostId,
) -> Result<u64, wp_mobile_cache::SqliteDbError> {
let repo = PostRepository::<EditContext>::new();
self.cache
.execute(|connection| repo.delete_by_post_id(connection, &self.db_site, post_id).map(|n| n as u64))
self.cache.execute(|connection| {
repo.delete_by_post_id(connection, &self.db_site, post_id)
.map(|n| n as u64)
})
}

/// Create a filtered post collection with edit context
Expand Down Expand Up @@ -536,9 +540,7 @@ mod tests {
}

#[rstest]
fn test_delete_by_post_id_non_existent_returns_zero(
post_service_ctx: PostServiceTestContext,
) {
fn test_delete_by_post_id_non_existent_returns_zero(post_service_ctx: PostServiceTestContext) {
// Test: Delete non-existent post
let deleted = post_service_ctx
.post_service
Expand Down