type InsertForm = ModRemovePostForm;
type UpdateForm = ModRemovePostForm;
type IdType = i32;
- async fn read(pool: &DbPool, from_id: i32) -> Result<Self, Error> {
+ async fn read(pool: &mut DbPool<'_>, from_id: i32) -> Result<Self, Error> {
use crate::schema::mod_remove_post::dsl::mod_remove_post;
let conn = &mut get_conn(pool).await?;
mod_remove_post.find(from_id).first::<Self>(conn).await
}
- async fn create(pool: &DbPool, form: &ModRemovePostForm) -> Result<Self, Error> {
+ 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)
.await
}
- async fn update(pool: &DbPool, from_id: i32, form: &ModRemovePostForm) -> Result<Self, Error> {
+ async fn update(
+ pool: &mut DbPool<'_>,
+ from_id: i32,
+ form: &ModRemovePostForm,
+ ) -> Result<Self, Error> {
use crate::schema::mod_remove_post::dsl::mod_remove_post;
let conn = &mut get_conn(pool).await?;
diesel::update(mod_remove_post.find(from_id))
type InsertForm = ModLockPostForm;
type UpdateForm = ModLockPostForm;
type IdType = i32;
- async fn read(pool: &DbPool, from_id: i32) -> Result<Self, Error> {
+ async fn read(pool: &mut DbPool<'_>, from_id: i32) -> Result<Self, Error> {
use crate::schema::mod_lock_post::dsl::mod_lock_post;
let conn = &mut get_conn(pool).await?;
mod_lock_post.find(from_id).first::<Self>(conn).await
}
- async fn create(pool: &DbPool, form: &ModLockPostForm) -> Result<Self, Error> {
+ 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)
.await
}
- async fn update(pool: &DbPool, from_id: i32, form: &ModLockPostForm) -> Result<Self, Error> {
+ async fn update(
+ pool: &mut DbPool<'_>,
+ from_id: i32,
+ form: &ModLockPostForm,
+ ) -> Result<Self, Error> {
use crate::schema::mod_lock_post::dsl::mod_lock_post;
let conn = &mut get_conn(pool).await?;
diesel::update(mod_lock_post.find(from_id))
type InsertForm = ModFeaturePostForm;
type UpdateForm = ModFeaturePostForm;
type IdType = i32;
- async fn read(pool: &DbPool, from_id: i32) -> Result<Self, Error> {
+ async fn read(pool: &mut DbPool<'_>, from_id: i32) -> Result<Self, Error> {
use crate::schema::mod_feature_post::dsl::mod_feature_post;
let conn = &mut get_conn(pool).await?;
mod_feature_post.find(from_id).first::<Self>(conn).await
}
- async fn create(pool: &DbPool, form: &ModFeaturePostForm) -> Result<Self, Error> {
+ 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)
.await
}
- async fn update(pool: &DbPool, from_id: i32, form: &ModFeaturePostForm) -> Result<Self, Error> {
+ async fn update(
+ pool: &mut DbPool<'_>,
+ from_id: i32,
+ form: &ModFeaturePostForm,
+ ) -> Result<Self, Error> {
use crate::schema::mod_feature_post::dsl::mod_feature_post;
let conn = &mut get_conn(pool).await?;
diesel::update(mod_feature_post.find(from_id))
type InsertForm = ModRemoveCommentForm;
type UpdateForm = ModRemoveCommentForm;
type IdType = i32;
- async fn read(pool: &DbPool, from_id: i32) -> Result<Self, Error> {
+ async fn read(pool: &mut DbPool<'_>, from_id: i32) -> Result<Self, Error> {
use crate::schema::mod_remove_comment::dsl::mod_remove_comment;
let conn = &mut get_conn(pool).await?;
mod_remove_comment.find(from_id).first::<Self>(conn).await
}
- async fn create(pool: &DbPool, form: &ModRemoveCommentForm) -> Result<Self, Error> {
+ 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)
.await
}
- async fn update(pool: &DbPool, from_id: i32, form: &ModRemoveCommentForm) -> Result<Self, Error> {
+ async fn update(
+ pool: &mut DbPool<'_>,
+ from_id: i32,
+ form: &ModRemoveCommentForm,
+ ) -> Result<Self, Error> {
use crate::schema::mod_remove_comment::dsl::mod_remove_comment;
let conn = &mut get_conn(pool).await?;
diesel::update(mod_remove_comment.find(from_id))
type InsertForm = ModRemoveCommunityForm;
type UpdateForm = ModRemoveCommunityForm;
type IdType = i32;
- async fn read(pool: &DbPool, from_id: i32) -> Result<Self, Error> {
+ async fn read(pool: &mut DbPool<'_>, from_id: i32) -> Result<Self, Error> {
use crate::schema::mod_remove_community::dsl::mod_remove_community;
let conn = &mut get_conn(pool).await?;
mod_remove_community.find(from_id).first::<Self>(conn).await
}
- async fn create(pool: &DbPool, form: &ModRemoveCommunityForm) -> Result<Self, Error> {
+ 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)
}
async fn update(
- pool: &DbPool,
+ pool: &mut DbPool<'_>,
from_id: i32,
form: &ModRemoveCommunityForm,
) -> Result<Self, Error> {
type InsertForm = ModBanFromCommunityForm;
type UpdateForm = ModBanFromCommunityForm;
type IdType = i32;
- async fn read(pool: &DbPool, from_id: i32) -> Result<Self, Error> {
+ async fn read(pool: &mut DbPool<'_>, from_id: i32) -> Result<Self, Error> {
use crate::schema::mod_ban_from_community::dsl::mod_ban_from_community;
let conn = &mut get_conn(pool).await?;
mod_ban_from_community
.await
}
- async fn create(pool: &DbPool, form: &ModBanFromCommunityForm) -> Result<Self, Error> {
+ 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)
}
async fn update(
- pool: &DbPool,
+ pool: &mut DbPool<'_>,
from_id: i32,
form: &ModBanFromCommunityForm,
) -> Result<Self, Error> {
type InsertForm = ModBanForm;
type UpdateForm = ModBanForm;
type IdType = i32;
- async fn read(pool: &DbPool, from_id: i32) -> Result<Self, Error> {
+ async fn read(pool: &mut DbPool<'_>, from_id: i32) -> Result<Self, Error> {
use crate::schema::mod_ban::dsl::mod_ban;
let conn = &mut get_conn(pool).await?;
mod_ban.find(from_id).first::<Self>(conn).await
}
- async fn create(pool: &DbPool, form: &ModBanForm) -> Result<Self, Error> {
+ 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)
.await
}
- async fn update(pool: &DbPool, from_id: i32, form: &ModBanForm) -> Result<Self, Error> {
+ 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))
type UpdateForm = ModHideCommunityForm;
type IdType = i32;
- async fn read(pool: &DbPool, from_id: i32) -> Result<Self, Error> {
+ async fn read(pool: &mut DbPool<'_>, from_id: i32) -> Result<Self, Error> {
use crate::schema::mod_hide_community::dsl::mod_hide_community;
let conn = &mut get_conn(pool).await?;
mod_hide_community.find(from_id).first::<Self>(conn).await
}
- async fn create(pool: &DbPool, form: &ModHideCommunityForm) -> Result<Self, Error> {
+ 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)
.await
}
- async fn update(pool: &DbPool, from_id: i32, form: &ModHideCommunityForm) -> Result<Self, Error> {
+ async fn update(
+ pool: &mut DbPool<'_>,
+ from_id: i32,
+ form: &ModHideCommunityForm,
+ ) -> Result<Self, Error> {
use crate::schema::mod_hide_community::dsl::mod_hide_community;
let conn = &mut get_conn(pool).await?;
diesel::update(mod_hide_community.find(from_id))
type InsertForm = ModAddCommunityForm;
type UpdateForm = ModAddCommunityForm;
type IdType = i32;
- async fn read(pool: &DbPool, from_id: i32) -> Result<Self, Error> {
+ async fn read(pool: &mut DbPool<'_>, from_id: i32) -> Result<Self, Error> {
use crate::schema::mod_add_community::dsl::mod_add_community;
let conn = &mut get_conn(pool).await?;
mod_add_community.find(from_id).first::<Self>(conn).await
}
- async fn create(pool: &DbPool, form: &ModAddCommunityForm) -> Result<Self, Error> {
+ 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)
.await
}
- async fn update(pool: &DbPool, from_id: i32, form: &ModAddCommunityForm) -> Result<Self, Error> {
+ async fn update(
+ pool: &mut DbPool<'_>,
+ from_id: i32,
+ form: &ModAddCommunityForm,
+ ) -> Result<Self, Error> {
use crate::schema::mod_add_community::dsl::mod_add_community;
let conn = &mut get_conn(pool).await?;
diesel::update(mod_add_community.find(from_id))
type InsertForm = ModTransferCommunityForm;
type UpdateForm = ModTransferCommunityForm;
type IdType = i32;
- async fn read(pool: &DbPool, from_id: i32) -> Result<Self, Error> {
+ async fn read(pool: &mut DbPool<'_>, from_id: i32) -> Result<Self, Error> {
use crate::schema::mod_transfer_community::dsl::mod_transfer_community;
let conn = &mut get_conn(pool).await?;
mod_transfer_community
.await
}
- async fn create(pool: &DbPool, form: &ModTransferCommunityForm) -> Result<Self, Error> {
+ 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)
}
async fn update(
- pool: &DbPool,
+ pool: &mut DbPool<'_>,
from_id: i32,
form: &ModTransferCommunityForm,
) -> Result<Self, Error> {
type InsertForm = ModAddForm;
type UpdateForm = ModAddForm;
type IdType = i32;
- async fn read(pool: &DbPool, from_id: i32) -> Result<Self, Error> {
+ async fn read(pool: &mut DbPool<'_>, from_id: i32) -> Result<Self, Error> {
use crate::schema::mod_add::dsl::mod_add;
let conn = &mut get_conn(pool).await?;
mod_add.find(from_id).first::<Self>(conn).await
}
- async fn create(pool: &DbPool, form: &ModAddForm) -> Result<Self, Error> {
+ 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)
.await
}
- async fn update(pool: &DbPool, from_id: i32, form: &ModAddForm) -> Result<Self, Error> {
+ 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))
type InsertForm = AdminPurgePersonForm;
type UpdateForm = AdminPurgePersonForm;
type IdType = i32;
- async fn read(pool: &DbPool, from_id: i32) -> Result<Self, Error> {
+ async fn read(pool: &mut DbPool<'_>, from_id: i32) -> Result<Self, Error> {
use crate::schema::admin_purge_person::dsl::admin_purge_person;
let conn = &mut get_conn(pool).await?;
admin_purge_person.find(from_id).first::<Self>(conn).await
}
- async fn create(pool: &DbPool, form: &Self::InsertForm) -> Result<Self, Error> {
+ 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)
.await
}
- async fn update(pool: &DbPool, from_id: i32, form: &Self::InsertForm) -> Result<Self, Error> {
+ async fn update(
+ pool: &mut DbPool<'_>,
+ from_id: i32,
+ form: &Self::InsertForm,
+ ) -> Result<Self, Error> {
use crate::schema::admin_purge_person::dsl::admin_purge_person;
let conn = &mut get_conn(pool).await?;
diesel::update(admin_purge_person.find(from_id))
type InsertForm = AdminPurgeCommunityForm;
type UpdateForm = AdminPurgeCommunityForm;
type IdType = i32;
- async fn read(pool: &DbPool, from_id: i32) -> Result<Self, Error> {
+ async fn read(pool: &mut DbPool<'_>, from_id: i32) -> Result<Self, Error> {
use crate::schema::admin_purge_community::dsl::admin_purge_community;
let conn = &mut get_conn(pool).await?;
admin_purge_community
.await
}
- async fn create(pool: &DbPool, form: &Self::InsertForm) -> Result<Self, Error> {
+ 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)
.await
}
- async fn update(pool: &DbPool, from_id: i32, form: &Self::InsertForm) -> Result<Self, Error> {
+ async fn update(
+ pool: &mut DbPool<'_>,
+ from_id: i32,
+ form: &Self::InsertForm,
+ ) -> Result<Self, Error> {
use crate::schema::admin_purge_community::dsl::admin_purge_community;
let conn = &mut get_conn(pool).await?;
diesel::update(admin_purge_community.find(from_id))
type InsertForm = AdminPurgePostForm;
type UpdateForm = AdminPurgePostForm;
type IdType = i32;
- async fn read(pool: &DbPool, from_id: i32) -> Result<Self, Error> {
+ async fn read(pool: &mut DbPool<'_>, from_id: i32) -> Result<Self, Error> {
use crate::schema::admin_purge_post::dsl::admin_purge_post;
let conn = &mut get_conn(pool).await?;
admin_purge_post.find(from_id).first::<Self>(conn).await
}
- async fn create(pool: &DbPool, form: &Self::InsertForm) -> Result<Self, Error> {
+ 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)
.await
}
- async fn update(pool: &DbPool, from_id: i32, form: &Self::InsertForm) -> Result<Self, Error> {
+ async fn update(
+ pool: &mut DbPool<'_>,
+ from_id: i32,
+ form: &Self::InsertForm,
+ ) -> Result<Self, Error> {
use crate::schema::admin_purge_post::dsl::admin_purge_post;
let conn = &mut get_conn(pool).await?;
diesel::update(admin_purge_post.find(from_id))
type InsertForm = AdminPurgeCommentForm;
type UpdateForm = AdminPurgeCommentForm;
type IdType = i32;
- async fn read(pool: &DbPool, from_id: i32) -> Result<Self, Error> {
+ async fn read(pool: &mut DbPool<'_>, from_id: i32) -> Result<Self, Error> {
use crate::schema::admin_purge_comment::dsl::admin_purge_comment;
let conn = &mut get_conn(pool).await?;
admin_purge_comment.find(from_id).first::<Self>(conn).await
}
- async fn create(pool: &DbPool, form: &Self::InsertForm) -> Result<Self, Error> {
+ 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)
.await
}
- async fn update(pool: &DbPool, from_id: i32, form: &Self::InsertForm) -> Result<Self, Error> {
+ async fn update(
+ pool: &mut DbPool<'_>,
+ from_id: i32,
+ form: &Self::InsertForm,
+ ) -> Result<Self, Error> {
use crate::schema::admin_purge_comment::dsl::admin_purge_comment;
let conn = &mut get_conn(pool).await?;
diesel::update(admin_purge_comment.find(from_id))
#[serial]
async fn test_crud() {
let pool = &build_db_pool_for_tests().await;
+ let pool = &mut pool.into();
let inserted_instance = Instance::read_or_create(pool, "my_domain.tld".to_string())
.await
post_id: inserted_post.id,
mod_person_id: inserted_mod.id,
reason: None,
- removed: Some(true),
+ removed: true,
when_: inserted_mod_remove_post.when_,
};
id: inserted_mod_lock_post.id,
post_id: inserted_post.id,
mod_person_id: inserted_mod.id,
- locked: Some(true),
+ locked: true,
when_: inserted_mod_lock_post.when_,
};
comment_id: inserted_comment.id,
mod_person_id: inserted_mod.id,
reason: None,
- removed: Some(true),
+ removed: true,
when_: inserted_mod_remove_comment.when_,
};
community_id: inserted_community.id,
mod_person_id: inserted_mod.id,
reason: None,
- removed: Some(true),
+ removed: true,
expires: None,
when_: inserted_mod_remove_community.when_,
};
mod_person_id: inserted_mod.id,
other_person_id: inserted_person.id,
reason: None,
- banned: Some(true),
+ banned: true,
expires: None,
when_: inserted_mod_ban_from_community.when_,
};
mod_person_id: inserted_mod.id,
other_person_id: inserted_person.id,
reason: None,
- banned: Some(true),
+ banned: true,
expires: None,
when_: inserted_mod_ban.when_,
};
community_id: inserted_community.id,
mod_person_id: inserted_mod.id,
other_person_id: inserted_person.id,
- removed: Some(false),
+ removed: false,
when_: inserted_mod_add_community.when_,
};
id: inserted_mod_add.id,
mod_person_id: inserted_mod.id,
other_person_id: inserted_person.id,
- removed: Some(false),
+ removed: false,
when_: inserted_mod_add.when_,
};