Successfully make default read implementation work

pull/3707/head
dull b 2023-07-24 01:23:06 +00:00
parent cab4bc6ab3
commit f77b0d758f
13 changed files with 65 additions and 174 deletions

View File

@ -152,15 +152,12 @@ where ca.comment_id = c.id"
}
#[async_trait]
impl<'query> Crud<'query> for Comment {
impl Crud for Comment {
type InsertForm = CommentInsertForm;
type UpdateForm = CommentUpdateForm;
type IdType = CommentId;
async fn delete(pool: &mut DbPool<'_>, comment_id: CommentId) -> Result<usize, Error>
where
'query: 'async_trait,
{
async fn delete(pool: &mut DbPool<'_>, comment_id: CommentId) -> Result<usize, Error> {
let conn = &mut get_conn(pool).await?;
diesel::delete(comment.find(comment_id)).execute(conn).await
}

View File

@ -9,7 +9,7 @@ use diesel::{dsl::insert_into, result::Error, ExpressionMethods, QueryDsl};
use diesel_async::RunQueryDsl;
#[async_trait]
impl<'query> Crud<'query> for CommentReply {
impl Crud for CommentReply {
type InsertForm = CommentReplyInsertForm;
type UpdateForm = CommentReplyUpdateForm;
type IdType = CommentReplyId;
@ -17,10 +17,7 @@ impl<'query> Crud<'query> for CommentReply {
async fn create(
pool: &mut DbPool<'_>,
comment_reply_form: &Self::InsertForm,
) -> Result<Self, Error>
where
'query: 'async_trait,
{
) -> Result<Self, Error> {
let conn = &mut get_conn(pool).await?;
// since the return here isnt utilized, we dont need to do an update

View File

@ -23,25 +23,19 @@ use diesel::{dsl::insert_into, result::Error, ExpressionMethods, QueryDsl};
use diesel_async::RunQueryDsl;
#[async_trait]
impl<'query> Crud<'query> for Community {
impl Crud for Community {
type InsertForm = CommunityInsertForm;
type UpdateForm = CommunityUpdateForm;
type IdType = CommunityId;
async fn delete(pool: &mut DbPool<'_>, community_id: CommunityId) -> Result<usize, Error>
where
'query: 'async_trait,
{
async fn delete(pool: &mut DbPool<'_>, community_id: CommunityId) -> Result<usize, Error> {
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<Self, Error>
where
'query: 'async_trait,
{
async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error> {
let is_new_community = match &form.actor_id {
Some(id) => Community::read_from_apub_id(pool, id).await?.is_none(),
None => true,

View File

@ -65,24 +65,18 @@ impl LocalUser {
}
#[async_trait]
impl<'query> Crud<'query> for LocalUser {
impl Crud for LocalUser {
type InsertForm = LocalUserInsertForm;
type UpdateForm = LocalUserUpdateForm;
type IdType = LocalUserId;
async fn delete(pool: &mut DbPool<'_>, local_user_id: LocalUserId) -> Result<usize, Error>
where
'query: 'async_trait,
{
async fn delete(pool: &mut DbPool<'_>, local_user_id: LocalUserId) -> Result<usize, Error> {
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<Self, Error>
where
'query: 'async_trait,
{
async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error> {
let conn = &mut get_conn(pool).await?;
let mut form_with_encrypted_password = form.clone();
let password_hash =

View File

@ -38,15 +38,12 @@ use diesel::{dsl::insert_into, result::Error, QueryDsl};
use diesel_async::RunQueryDsl;
#[async_trait]
impl<'query> Crud<'query> for ModRemovePost {
impl Crud for ModRemovePost {
type InsertForm = ModRemovePostForm;
type UpdateForm = ModRemovePostForm;
type IdType = i32;
async fn create(pool: &mut DbPool<'_>, form: &ModRemovePostForm) -> Result<Self, Error>
where
'query: 'async_trait,
{
async fn create(pool: &mut DbPool<'_>, form: &ModRemovePostForm) -> Result<Self, Error> {
use crate::schema::mod_remove_post::dsl::mod_remove_post;
let conn = &mut get_conn(pool).await?;
insert_into(mod_remove_post)
@ -70,15 +67,12 @@ impl<'query> Crud<'query> for ModRemovePost {
}
#[async_trait]
impl<'query> Crud<'query> for ModLockPost {
impl Crud for ModLockPost {
type InsertForm = ModLockPostForm;
type UpdateForm = ModLockPostForm;
type IdType = i32;
async fn create(pool: &mut DbPool<'_>, form: &ModLockPostForm) -> Result<Self, Error>
where
'query: 'async_trait,
{
async fn create(pool: &mut DbPool<'_>, form: &ModLockPostForm) -> Result<Self, Error> {
use crate::schema::mod_lock_post::dsl::mod_lock_post;
let conn = &mut get_conn(pool).await?;
insert_into(mod_lock_post)
@ -102,15 +96,12 @@ impl<'query> Crud<'query> for ModLockPost {
}
#[async_trait]
impl<'query> Crud<'query> for ModFeaturePost {
impl Crud for ModFeaturePost {
type InsertForm = ModFeaturePostForm;
type UpdateForm = ModFeaturePostForm;
type IdType = i32;
async fn create(pool: &mut DbPool<'_>, form: &ModFeaturePostForm) -> Result<Self, Error>
where
'query: 'async_trait,
{
async fn create(pool: &mut DbPool<'_>, form: &ModFeaturePostForm) -> Result<Self, Error> {
use crate::schema::mod_feature_post::dsl::mod_feature_post;
let conn = &mut get_conn(pool).await?;
insert_into(mod_feature_post)
@ -134,15 +125,12 @@ impl<'query> Crud<'query> for ModFeaturePost {
}
#[async_trait]
impl<'query> Crud<'query> for ModRemoveComment {
impl Crud for ModRemoveComment {
type InsertForm = ModRemoveCommentForm;
type UpdateForm = ModRemoveCommentForm;
type IdType = i32;
async fn create(pool: &mut DbPool<'_>, form: &ModRemoveCommentForm) -> Result<Self, Error>
where
'query: 'async_trait,
{
async fn create(pool: &mut DbPool<'_>, form: &ModRemoveCommentForm) -> Result<Self, Error> {
use crate::schema::mod_remove_comment::dsl::mod_remove_comment;
let conn = &mut get_conn(pool).await?;
insert_into(mod_remove_comment)
@ -166,15 +154,12 @@ impl<'query> Crud<'query> for ModRemoveComment {
}
#[async_trait]
impl<'query> Crud<'query> for ModRemoveCommunity {
impl Crud for ModRemoveCommunity {
type InsertForm = ModRemoveCommunityForm;
type UpdateForm = ModRemoveCommunityForm;
type IdType = i32;
async fn create(pool: &mut DbPool<'_>, form: &ModRemoveCommunityForm) -> Result<Self, Error>
where
'query: 'async_trait,
{
async fn create(pool: &mut DbPool<'_>, form: &ModRemoveCommunityForm) -> Result<Self, Error> {
use crate::schema::mod_remove_community::dsl::mod_remove_community;
let conn = &mut get_conn(pool).await?;
insert_into(mod_remove_community)
@ -198,15 +183,12 @@ impl<'query> Crud<'query> for ModRemoveCommunity {
}
#[async_trait]
impl<'query> Crud<'query> for ModBanFromCommunity {
impl Crud for ModBanFromCommunity {
type InsertForm = ModBanFromCommunityForm;
type UpdateForm = ModBanFromCommunityForm;
type IdType = i32;
async fn create(pool: &mut DbPool<'_>, form: &ModBanFromCommunityForm) -> Result<Self, Error>
where
'query: 'async_trait,
{
async fn create(pool: &mut DbPool<'_>, form: &ModBanFromCommunityForm) -> Result<Self, Error> {
use crate::schema::mod_ban_from_community::dsl::mod_ban_from_community;
let conn = &mut get_conn(pool).await?;
insert_into(mod_ban_from_community)
@ -230,15 +212,12 @@ impl<'query> Crud<'query> for ModBanFromCommunity {
}
#[async_trait]
impl<'query> Crud<'query> for ModBan {
impl Crud for ModBan {
type InsertForm = ModBanForm;
type UpdateForm = ModBanForm;
type IdType = i32;
async fn create(pool: &mut DbPool<'_>, form: &ModBanForm) -> Result<Self, Error>
where
'query: 'async_trait,
{
async fn create(pool: &mut DbPool<'_>, form: &ModBanForm) -> Result<Self, Error> {
use crate::schema::mod_ban::dsl::mod_ban;
let conn = &mut get_conn(pool).await?;
insert_into(mod_ban)
@ -247,10 +226,7 @@ impl<'query> Crud<'query> for ModBan {
.await
}
async fn update(pool: &mut DbPool<'_>, from_id: i32, form: &ModBanForm) -> Result<Self, Error>
where
'query: 'async_trait,
{
async fn update(pool: &mut DbPool<'_>, from_id: i32, form: &ModBanForm) -> Result<Self, Error> {
use crate::schema::mod_ban::dsl::mod_ban;
let conn = &mut get_conn(pool).await?;
diesel::update(mod_ban.find(from_id))
@ -261,15 +237,12 @@ impl<'query> Crud<'query> for ModBan {
}
#[async_trait]
impl<'query> Crud<'query> for ModHideCommunity {
impl Crud for ModHideCommunity {
type InsertForm = ModHideCommunityForm;
type UpdateForm = ModHideCommunityForm;
type IdType = i32;
async fn create(pool: &mut DbPool<'_>, form: &ModHideCommunityForm) -> Result<Self, Error>
where
'query: 'async_trait,
{
async fn create(pool: &mut DbPool<'_>, form: &ModHideCommunityForm) -> Result<Self, Error> {
use crate::schema::mod_hide_community::dsl::mod_hide_community;
let conn = &mut get_conn(pool).await?;
insert_into(mod_hide_community)
@ -293,15 +266,12 @@ impl<'query> Crud<'query> for ModHideCommunity {
}
#[async_trait]
impl<'query> Crud<'query> for ModAddCommunity {
impl Crud for ModAddCommunity {
type InsertForm = ModAddCommunityForm;
type UpdateForm = ModAddCommunityForm;
type IdType = i32;
async fn create(pool: &mut DbPool<'_>, form: &ModAddCommunityForm) -> Result<Self, Error>
where
'query: 'async_trait,
{
async fn create(pool: &mut DbPool<'_>, form: &ModAddCommunityForm) -> Result<Self, Error> {
use crate::schema::mod_add_community::dsl::mod_add_community;
let conn = &mut get_conn(pool).await?;
insert_into(mod_add_community)
@ -325,15 +295,12 @@ impl<'query> Crud<'query> for ModAddCommunity {
}
#[async_trait]
impl<'query> Crud<'query> for ModTransferCommunity {
impl Crud for ModTransferCommunity {
type InsertForm = ModTransferCommunityForm;
type UpdateForm = ModTransferCommunityForm;
type IdType = i32;
async fn create(pool: &mut DbPool<'_>, form: &ModTransferCommunityForm) -> Result<Self, Error>
where
'query: 'async_trait,
{
async fn create(pool: &mut DbPool<'_>, form: &ModTransferCommunityForm) -> Result<Self, Error> {
use crate::schema::mod_transfer_community::dsl::mod_transfer_community;
let conn = &mut get_conn(pool).await?;
insert_into(mod_transfer_community)
@ -357,15 +324,12 @@ impl<'query> Crud<'query> for ModTransferCommunity {
}
#[async_trait]
impl<'query> Crud<'query> for ModAdd {
impl Crud for ModAdd {
type InsertForm = ModAddForm;
type UpdateForm = ModAddForm;
type IdType = i32;
async fn create(pool: &mut DbPool<'_>, form: &ModAddForm) -> Result<Self, Error>
where
'query: 'async_trait,
{
async fn create(pool: &mut DbPool<'_>, form: &ModAddForm) -> Result<Self, Error> {
use crate::schema::mod_add::dsl::mod_add;
let conn = &mut get_conn(pool).await?;
insert_into(mod_add)
@ -374,10 +338,7 @@ impl<'query> Crud<'query> for ModAdd {
.await
}
async fn update(pool: &mut DbPool<'_>, from_id: i32, form: &ModAddForm) -> Result<Self, Error>
where
'query: 'async_trait,
{
async fn update(pool: &mut DbPool<'_>, from_id: i32, form: &ModAddForm) -> Result<Self, Error> {
use crate::schema::mod_add::dsl::mod_add;
let conn = &mut get_conn(pool).await?;
diesel::update(mod_add.find(from_id))
@ -388,15 +349,12 @@ impl<'query> Crud<'query> for ModAdd {
}
#[async_trait]
impl<'query> Crud<'query> for AdminPurgePerson {
impl Crud for AdminPurgePerson {
type InsertForm = AdminPurgePersonForm;
type UpdateForm = AdminPurgePersonForm;
type IdType = i32;
async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error>
where
'query: 'async_trait,
{
async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error> {
use crate::schema::admin_purge_person::dsl::admin_purge_person;
let conn = &mut get_conn(pool).await?;
insert_into(admin_purge_person)
@ -420,15 +378,12 @@ impl<'query> Crud<'query> for AdminPurgePerson {
}
#[async_trait]
impl<'query> Crud<'query> for AdminPurgeCommunity {
impl Crud for AdminPurgeCommunity {
type InsertForm = AdminPurgeCommunityForm;
type UpdateForm = AdminPurgeCommunityForm;
type IdType = i32;
async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error>
where
'query: 'async_trait,
{
async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error> {
use crate::schema::admin_purge_community::dsl::admin_purge_community;
let conn = &mut get_conn(pool).await?;
insert_into(admin_purge_community)
@ -452,15 +407,12 @@ impl<'query> Crud<'query> for AdminPurgeCommunity {
}
#[async_trait]
impl<'query> Crud<'query> for AdminPurgePost {
impl Crud for AdminPurgePost {
type InsertForm = AdminPurgePostForm;
type UpdateForm = AdminPurgePostForm;
type IdType = i32;
async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error>
where
'query: 'async_trait,
{
async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error> {
use crate::schema::admin_purge_post::dsl::admin_purge_post;
let conn = &mut get_conn(pool).await?;
insert_into(admin_purge_post)
@ -484,15 +436,12 @@ impl<'query> Crud<'query> for AdminPurgePost {
}
#[async_trait]
impl<'query> Crud<'query> for AdminPurgeComment {
impl Crud for AdminPurgeComment {
type InsertForm = AdminPurgeCommentForm;
type UpdateForm = AdminPurgeCommentForm;
type IdType = i32;
async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error>
where
'query: 'async_trait,
{
async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error> {
use crate::schema::admin_purge_comment::dsl::admin_purge_comment;
let conn = &mut get_conn(pool).await?;
insert_into(admin_purge_comment)

View File

@ -20,15 +20,12 @@ use diesel_async::RunQueryDsl;
use sha2::{Digest, Sha256};
#[async_trait]
impl<'query> Crud<'query> for PasswordResetRequest {
impl Crud for PasswordResetRequest {
type InsertForm = PasswordResetRequestForm;
type UpdateForm = PasswordResetRequestForm;
type IdType = i32;
async fn create(pool: &mut DbPool<'_>, form: &PasswordResetRequestForm) -> Result<Self, Error>
where
'query: 'async_trait,
{
async fn create(pool: &mut DbPool<'_>, form: &PasswordResetRequestForm) -> Result<Self, Error> {
let conn = &mut get_conn(pool).await?;
insert_into(password_reset_request)
.values(form)

View File

@ -15,24 +15,18 @@ use diesel::{dsl::insert_into, result::Error, ExpressionMethods, JoinOnDsl, Quer
use diesel_async::RunQueryDsl;
#[async_trait]
impl<'query> Crud<'query> for Person {
impl Crud for Person {
type InsertForm = PersonInsertForm;
type UpdateForm = PersonUpdateForm;
type IdType = PersonId;
async fn delete(pool: &mut DbPool<'_>, person_id: PersonId) -> Result<usize, Error>
where
'query: 'async_trait,
{
async fn delete(pool: &mut DbPool<'_>, person_id: PersonId) -> Result<usize, Error> {
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<Self, Error>
where
'query: 'async_trait,
{
async fn create(pool: &mut DbPool<'_>, form: &PersonInsertForm) -> Result<Self, Error> {
let conn = &mut get_conn(pool).await?;
insert_into(person::table)
.values(form)

View File

@ -9,7 +9,7 @@ use diesel::{dsl::insert_into, result::Error, ExpressionMethods, QueryDsl};
use diesel_async::RunQueryDsl;
#[async_trait]
impl<'query> Crud<'query> for PersonMention {
impl Crud for PersonMention {
type InsertForm = PersonMentionInsertForm;
type UpdateForm = PersonMentionUpdateForm;
type IdType = PersonMentionId;

View File

@ -34,23 +34,17 @@ use diesel::{dsl::insert_into, result::Error, ExpressionMethods, QueryDsl, TextE
use diesel_async::RunQueryDsl;
#[async_trait]
impl<'query> Crud<'query> for Post {
impl Crud for Post {
type InsertForm = PostInsertForm;
type UpdateForm = PostUpdateForm;
type IdType = PostId;
async fn delete(pool: &mut DbPool<'_>, post_id: PostId) -> Result<usize, Error>
where
'query: 'async_trait,
{
async fn delete(pool: &mut DbPool<'_>, post_id: PostId) -> Result<usize, Error> {
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<Self, Error>
where
'query: 'async_trait,
{
async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error> {
let conn = &mut get_conn(pool).await?;
insert_into(post)
.values(form)

View File

@ -11,15 +11,12 @@ use lemmy_utils::error::LemmyError;
use url::Url;
#[async_trait]
impl<'query> Crud<'query> for PrivateMessage {
impl Crud for PrivateMessage {
type InsertForm = PrivateMessageInsertForm;
type UpdateForm = PrivateMessageUpdateForm;
type IdType = PrivateMessageId;
async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error>
where
'query: 'async_trait,
{
async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error> {
let conn = &mut get_conn(pool).await?;
insert_into(private_message)
.values(form)
@ -41,10 +38,7 @@ impl<'query> Crud<'query> for PrivateMessage {
.get_result::<Self>(conn)
.await
}
async fn delete(pool: &mut DbPool<'_>, pm_id: Self::IdType) -> Result<usize, Error>
where
'query: 'async_trait,
{
async fn delete(pool: &mut DbPool<'_>, pm_id: Self::IdType) -> Result<usize, Error> {
let conn = &mut get_conn(pool).await?;
diesel::delete(private_message.find(pm_id))
.execute(conn)

View File

@ -13,15 +13,12 @@ use diesel::{insert_into, result::Error, ExpressionMethods, QueryDsl};
use diesel_async::RunQueryDsl;
#[async_trait]
impl<'query> Crud<'query> for RegistrationApplication {
impl Crud for RegistrationApplication {
type InsertForm = RegistrationApplicationInsertForm;
type UpdateForm = RegistrationApplicationUpdateForm;
type IdType = i32;
async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error>
where
'query: 'async_trait,
{
async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error> {
let conn = &mut get_conn(pool).await?;
insert_into(registration_application)
.values(form)
@ -41,10 +38,7 @@ impl<'query> Crud<'query> for RegistrationApplication {
.await
}
async fn delete(pool: &mut DbPool<'_>, id_: Self::IdType) -> Result<usize, Error>
where
'query: 'async_trait,
{
async fn delete(pool: &mut DbPool<'_>, id_: Self::IdType) -> Result<usize, Error> {
let conn = &mut get_conn(pool).await?;
diesel::delete(registration_application.find(id_))
.execute(conn)

View File

@ -13,7 +13,7 @@ use diesel_async::RunQueryDsl;
use url::Url;
#[async_trait]
impl<'query> Crud<'query> for Site {
impl Crud for Site {
type InsertForm = SiteInsertForm;
type UpdateForm = SiteUpdateForm;
type IdType = SiteId;
@ -37,10 +37,7 @@ impl<'query> Crud<'query> for Site {
unimplemented!()
}*/
async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error>
where
'query: 'async_trait,
{
async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error> {
let is_new_site = match &form.actor_id {
Some(id_) => Site::read_from_apub_id(pool, id_).await?.is_none(),
None => true,
@ -76,10 +73,7 @@ impl<'query> Crud<'query> for Site {
.await
}
async fn delete(pool: &mut DbPool<'_>, site_id: SiteId) -> Result<usize, Error>
where
'query: 'async_trait,
{
async fn delete(pool: &mut DbPool<'_>, site_id: SiteId) -> Result<usize, Error> {
let conn = &mut get_conn(pool).await?;
diesel::delete(site.find(site_id)).execute(conn).await
}

View File

@ -1,6 +1,6 @@
use crate::{
newtypes::{CommunityId, DbUrl, PersonId},
utils::{get_conn, DbConn, DbPool},
utils::{get_conn, DbPool},
};
use diesel::{
associations::HasTable,
@ -26,7 +26,7 @@ LimitDsl + Send + Sized + 'static,
<<Self::Table as Table>::PrimaryKey as Expression>::SqlType: SqlType,
<Self::Table as Table>::PrimaryKey: ExpressionMethods + Send + Sized + 'static,*/
#[async_trait]
pub trait Crud<'query>
pub trait Crud
where
Self: HasTable + Sized,
Self::Table: FilterDsl<dsl::Eq<<Self::Table as Table>::PrimaryKey, Self::IdType>>,
@ -45,9 +45,7 @@ where
+ Sized
+ Send
+ AsExpression<<<Self::Table as Table>::PrimaryKey as Expression>::SqlType>;
async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error>
where
'query: 'async_trait;
async fn create(pool: &mut DbPool<'_>, form: &Self::InsertForm) -> Result<Self, Error>;
/*{
let conn = &mut get_conn(pool).await?;
insert_into(Self::table())
@ -69,9 +67,7 @@ where
pool: &mut DbPool<'_>,
id: Self::IdType,
form: &Self::UpdateForm,
) -> Result<Self, Error>
where
'query: 'async_trait;
) -> Result<Self, Error>;
/*{
let conn = &mut get_conn(pool).await?;
diesel::update(Self::table().find(id))
@ -79,10 +75,7 @@ where
.get_result::<Self>(conn)
.await
}*/
async fn delete(_pool: &mut DbPool<'_>, _id: Self::IdType) -> Result<usize, Error>
where
'query: 'async_trait,
{
async fn delete(_pool: &mut DbPool<'_>, _id: Self::IdType) -> Result<usize, Error> {
Err(Error::NotFound)
/*let conn = &mut get_conn(pool).await?;
diesel::delete(Self::table().find(id)).execute(conn).await*/