From 9f47fcbe8794a3483c33c0ce91b6690ec73fb85f Mon Sep 17 00:00:00 2001 From: dull b Date: Mon, 24 Jul 2023 04:43:02 +0000 Subject: [PATCH] Remove Crud::delete definitions that match default --- crates/db_schema/src/impls/comment.rs | 5 ----- crates/db_schema/src/impls/community.rs | 7 ------- crates/db_schema/src/impls/local_user.rs | 6 ------ crates/db_schema/src/impls/person.rs | 6 ------ crates/db_schema/src/impls/post.rs | 5 ----- crates/db_schema/src/impls/private_message.rs | 6 ------ crates/db_schema/src/impls/registration_application.rs | 7 ------- crates/db_schema/src/impls/site.rs | 5 ----- 8 files changed, 47 deletions(-) diff --git a/crates/db_schema/src/impls/comment.rs b/crates/db_schema/src/impls/comment.rs index d6d2ab949..88757cd02 100644 --- a/crates/db_schema/src/impls/comment.rs +++ b/crates/db_schema/src/impls/comment.rs @@ -157,11 +157,6 @@ impl Crud for Comment { type UpdateForm = CommentUpdateForm; type IdType = CommentId; - async fn delete(pool: &mut DbPool<'_>, comment_id: CommentId) -> Result { - let conn = &mut get_conn(pool).await?; - diesel::delete(comment.find(comment_id)).execute(conn).await - } - /// This is unimplemented, use [[Comment::create]] async fn create(_pool: &mut DbPool<'_>, _comment_form: &Self::InsertForm) -> Result { unimplemented!(); diff --git a/crates/db_schema/src/impls/community.rs b/crates/db_schema/src/impls/community.rs index d76770203..2d0fcfe57 100644 --- a/crates/db_schema/src/impls/community.rs +++ b/crates/db_schema/src/impls/community.rs @@ -28,13 +28,6 @@ impl Crud for Community { type UpdateForm = CommunityUpdateForm; type IdType = CommunityId; - async fn delete(pool: &mut DbPool<'_>, community_id: CommunityId) -> Result { - let conn = &mut get_conn(pool).await?; - diesel::delete(community::table.find(community_id)) - .execute(conn) - .await - } - async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result { let is_new_community = match &form.actor_id { Some(id) => Community::read_from_apub_id(pool, id).await?.is_none(), diff --git a/crates/db_schema/src/impls/local_user.rs b/crates/db_schema/src/impls/local_user.rs index ba882297c..6ef3421d3 100644 --- a/crates/db_schema/src/impls/local_user.rs +++ b/crates/db_schema/src/impls/local_user.rs @@ -70,12 +70,6 @@ impl Crud for LocalUser { type UpdateForm = LocalUserUpdateForm; type IdType = LocalUserId; - async fn delete(pool: &mut DbPool<'_>, local_user_id: LocalUserId) -> Result { - let conn = &mut get_conn(pool).await?; - diesel::delete(local_user.find(local_user_id)) - .execute(conn) - .await - } async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result { let conn = &mut get_conn(pool).await?; let mut form_with_encrypted_password = form.clone(); diff --git a/crates/db_schema/src/impls/person.rs b/crates/db_schema/src/impls/person.rs index c06c1c728..53f4a4df0 100644 --- a/crates/db_schema/src/impls/person.rs +++ b/crates/db_schema/src/impls/person.rs @@ -28,12 +28,6 @@ impl Crud for Person { .await } - async fn delete(pool: &mut DbPool<'_>, person_id: PersonId) -> Result { - let conn = &mut get_conn(pool).await?; - diesel::delete(person::table.find(person_id)) - .execute(conn) - .await - } async fn create(pool: &mut DbPool<'_>, form: &PersonInsertForm) -> Result { let conn = &mut get_conn(pool).await?; insert_into(person::table) diff --git a/crates/db_schema/src/impls/post.rs b/crates/db_schema/src/impls/post.rs index 9e05786b2..60b8af2ce 100644 --- a/crates/db_schema/src/impls/post.rs +++ b/crates/db_schema/src/impls/post.rs @@ -39,11 +39,6 @@ impl Crud for Post { type UpdateForm = PostUpdateForm; type IdType = PostId; - async fn delete(pool: &mut DbPool<'_>, post_id: PostId) -> Result { - let conn = &mut get_conn(pool).await?; - diesel::delete(post.find(post_id)).execute(conn).await - } - async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result { let conn = &mut get_conn(pool).await?; insert_into(post) diff --git a/crates/db_schema/src/impls/private_message.rs b/crates/db_schema/src/impls/private_message.rs index 7c6ec4673..d422f0d23 100644 --- a/crates/db_schema/src/impls/private_message.rs +++ b/crates/db_schema/src/impls/private_message.rs @@ -38,12 +38,6 @@ impl Crud for PrivateMessage { .get_result::(conn) .await } - async fn delete(pool: &mut DbPool<'_>, pm_id: Self::IdType) -> Result { - let conn = &mut get_conn(pool).await?; - diesel::delete(private_message.find(pm_id)) - .execute(conn) - .await - } } impl PrivateMessage { diff --git a/crates/db_schema/src/impls/registration_application.rs b/crates/db_schema/src/impls/registration_application.rs index 5dd6b8e1e..c4df7ba69 100644 --- a/crates/db_schema/src/impls/registration_application.rs +++ b/crates/db_schema/src/impls/registration_application.rs @@ -37,13 +37,6 @@ impl Crud for RegistrationApplication { .get_result::(conn) .await } - - async fn delete(pool: &mut DbPool<'_>, id_: Self::IdType) -> Result { - let conn = &mut get_conn(pool).await?; - diesel::delete(registration_application.find(id_)) - .execute(conn) - .await - } } impl RegistrationApplication { diff --git a/crates/db_schema/src/impls/site.rs b/crates/db_schema/src/impls/site.rs index 6e2cca2a7..976ca06ed 100644 --- a/crates/db_schema/src/impls/site.rs +++ b/crates/db_schema/src/impls/site.rs @@ -72,11 +72,6 @@ impl Crud for Site { .get_result::(conn) .await } - - async fn delete(pool: &mut DbPool<'_>, site_id: SiteId) -> Result { - let conn = &mut get_conn(pool).await?; - diesel::delete(site.find(site_id)).execute(conn).await - } } impl Site {