mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-29 15:51:20 +00:00
move files
This commit is contained in:
parent
0670552adb
commit
aa4007f61a
35 changed files with 291 additions and 288 deletions
|
@ -10,7 +10,7 @@ use lemmy_db_schema::{
|
|||
source::{
|
||||
community::{Community, CommunityModerator, CommunityModeratorForm},
|
||||
local_user::LocalUser,
|
||||
moderator::{ModAddCommunity, ModAddCommunityForm},
|
||||
mod_log::moderator::{ModAddCommunity, ModAddCommunityForm},
|
||||
},
|
||||
traits::{Crud, Joinable},
|
||||
};
|
||||
|
|
|
@ -20,7 +20,7 @@ use lemmy_db_schema::{
|
|||
CommunityPersonBanForm,
|
||||
},
|
||||
local_user::LocalUser,
|
||||
moderator::{ModBanFromCommunity, ModBanFromCommunityForm},
|
||||
mod_log::moderator::{ModBanFromCommunity, ModBanFromCommunityForm},
|
||||
},
|
||||
traits::{Bannable, Crud, Followable},
|
||||
};
|
||||
|
|
|
@ -10,7 +10,7 @@ use lemmy_api_common::{
|
|||
use lemmy_db_schema::{
|
||||
source::{
|
||||
community::{Community, CommunityUpdateForm},
|
||||
moderator::{ModHideCommunity, ModHideCommunityForm},
|
||||
mod_log::moderator::{ModHideCommunity, ModHideCommunityForm},
|
||||
},
|
||||
traits::Crud,
|
||||
};
|
||||
|
|
|
@ -8,7 +8,7 @@ use lemmy_api_common::{
|
|||
use lemmy_db_schema::{
|
||||
source::{
|
||||
community::{Community, CommunityModerator, CommunityModeratorForm},
|
||||
moderator::{ModTransferCommunity, ModTransferCommunityForm},
|
||||
mod_log::moderator::{ModTransferCommunity, ModTransferCommunityForm},
|
||||
},
|
||||
traits::{Crud, Joinable},
|
||||
};
|
||||
|
|
|
@ -19,7 +19,7 @@ use lemmy_db_schema::{
|
|||
CommunityPersonBanForm,
|
||||
},
|
||||
local_site::LocalSite,
|
||||
moderator::{ModBanFromCommunity, ModBanFromCommunityForm},
|
||||
mod_log::moderator::{ModBanFromCommunity, ModBanFromCommunityForm},
|
||||
person::Person,
|
||||
},
|
||||
traits::{Bannable, Crud, Followable},
|
||||
|
|
|
@ -7,7 +7,7 @@ use lemmy_api_common::{
|
|||
use lemmy_db_schema::{
|
||||
source::{
|
||||
local_user::{LocalUser, LocalUserUpdateForm},
|
||||
moderator::{ModAdd, ModAddForm},
|
||||
mod_log::moderator::{ModAdd, ModAddForm},
|
||||
},
|
||||
traits::Crud,
|
||||
};
|
||||
|
|
|
@ -11,7 +11,7 @@ use lemmy_db_schema::{
|
|||
source::{
|
||||
local_user::LocalUser,
|
||||
login_token::LoginToken,
|
||||
moderator::{ModBan, ModBanForm},
|
||||
mod_log::moderator::{ModBan, ModBanForm},
|
||||
person::{Person, PersonUpdateForm},
|
||||
},
|
||||
traits::Crud,
|
||||
|
|
|
@ -10,7 +10,7 @@ use lemmy_api_common::{
|
|||
use lemmy_db_schema::{
|
||||
source::{
|
||||
community::Community,
|
||||
moderator::{ModFeaturePost, ModFeaturePostForm},
|
||||
mod_log::moderator::{ModFeaturePost, ModFeaturePostForm},
|
||||
post::{Post, PostUpdateForm},
|
||||
},
|
||||
traits::Crud,
|
||||
|
|
|
@ -9,7 +9,7 @@ use lemmy_api_common::{
|
|||
};
|
||||
use lemmy_db_schema::{
|
||||
source::{
|
||||
moderator::{ModLockPost, ModLockPostForm},
|
||||
mod_log::moderator::{ModLockPost, ModLockPostForm},
|
||||
post::{Post, PostUpdateForm},
|
||||
},
|
||||
traits::Crud,
|
||||
|
|
|
@ -6,7 +6,7 @@ use lemmy_db_schema::{
|
|||
language::Language,
|
||||
local_site_url_blocklist::LocalSiteUrlBlocklist,
|
||||
local_user::{LocalUser, LocalUserUpdateForm},
|
||||
moderator::{ModAdd, ModAddForm},
|
||||
mod_log::moderator::{ModAdd, ModAddForm},
|
||||
oauth_provider::OAuthProvider,
|
||||
tagline::Tagline,
|
||||
},
|
||||
|
|
|
@ -11,7 +11,7 @@ use lemmy_db_schema::{
|
|||
source::{
|
||||
comment::Comment,
|
||||
local_user::LocalUser,
|
||||
moderator::{AdminPurgeComment, AdminPurgeCommentForm},
|
||||
mod_log::admin::{AdminPurgeComment, AdminPurgeCommentForm},
|
||||
},
|
||||
traits::Crud,
|
||||
};
|
||||
|
|
|
@ -13,7 +13,7 @@ use lemmy_db_schema::{
|
|||
source::{
|
||||
community::Community,
|
||||
local_user::LocalUser,
|
||||
moderator::{AdminPurgeCommunity, AdminPurgeCommunityForm},
|
||||
mod_log::admin::{AdminPurgeCommunity, AdminPurgeCommunityForm},
|
||||
},
|
||||
traits::Crud,
|
||||
};
|
||||
|
|
|
@ -11,7 +11,7 @@ use lemmy_api_common::{
|
|||
use lemmy_db_schema::{
|
||||
source::{
|
||||
local_user::LocalUser,
|
||||
moderator::{AdminPurgePerson, AdminPurgePersonForm},
|
||||
mod_log::admin::{AdminPurgePerson, AdminPurgePersonForm},
|
||||
person::{Person, PersonUpdateForm},
|
||||
},
|
||||
traits::Crud,
|
||||
|
|
|
@ -11,7 +11,7 @@ use lemmy_api_common::{
|
|||
use lemmy_db_schema::{
|
||||
source::{
|
||||
local_user::LocalUser,
|
||||
moderator::{AdminPurgePost, AdminPurgePostForm},
|
||||
mod_log::admin::{AdminPurgePost, AdminPurgePostForm},
|
||||
post::Post,
|
||||
},
|
||||
traits::Crud,
|
||||
|
|
|
@ -23,7 +23,12 @@ use lemmy_db_schema::{
|
|||
local_site::LocalSite,
|
||||
local_site_rate_limit::LocalSiteRateLimit,
|
||||
local_site_url_blocklist::LocalSiteUrlBlocklist,
|
||||
moderator::{ModRemoveComment, ModRemoveCommentForm, ModRemovePost, ModRemovePostForm},
|
||||
mod_log::moderator::{
|
||||
ModRemoveComment,
|
||||
ModRemoveCommentForm,
|
||||
ModRemovePost,
|
||||
ModRemovePostForm,
|
||||
},
|
||||
oauth_account::OAuthAccount,
|
||||
password_reset_request::PasswordResetRequest,
|
||||
person::{Person, PersonUpdateForm},
|
||||
|
|
|
@ -12,7 +12,7 @@ use lemmy_db_schema::{
|
|||
comment::{Comment, CommentUpdateForm},
|
||||
comment_report::CommentReport,
|
||||
local_user::LocalUser,
|
||||
moderator::{ModRemoveComment, ModRemoveCommentForm},
|
||||
mod_log::moderator::{ModRemoveComment, ModRemoveCommentForm},
|
||||
},
|
||||
traits::{Crud, Reportable},
|
||||
};
|
||||
|
|
|
@ -10,7 +10,7 @@ use lemmy_api_common::{
|
|||
use lemmy_db_schema::{
|
||||
source::{
|
||||
community::{Community, CommunityUpdateForm},
|
||||
moderator::{ModRemoveCommunity, ModRemoveCommunityForm},
|
||||
mod_log::moderator::{ModRemoveCommunity, ModRemoveCommunityForm},
|
||||
},
|
||||
traits::Crud,
|
||||
};
|
||||
|
|
|
@ -11,7 +11,7 @@ use lemmy_db_schema::{
|
|||
source::{
|
||||
community::Community,
|
||||
local_user::LocalUser,
|
||||
moderator::{ModRemovePost, ModRemovePostForm},
|
||||
mod_log::moderator::{ModRemovePost, ModRemovePostForm},
|
||||
post::{Post, PostUpdateForm},
|
||||
post_report::PostReport,
|
||||
},
|
||||
|
|
|
@ -36,7 +36,7 @@ use lemmy_db_schema::{
|
|||
CommunityPersonBan,
|
||||
CommunityPersonBanForm,
|
||||
},
|
||||
moderator::{ModBan, ModBanForm, ModBanFromCommunity, ModBanFromCommunityForm},
|
||||
mod_log::moderator::{ModBan, ModBanForm, ModBanFromCommunity, ModBanFromCommunityForm},
|
||||
person::{Person, PersonUpdateForm},
|
||||
},
|
||||
traits::{Bannable, Crud, Followable},
|
||||
|
|
|
@ -27,7 +27,7 @@ use lemmy_db_schema::{
|
|||
source::{
|
||||
activity::ActivitySendTargets,
|
||||
community::{CommunityPersonBan, CommunityPersonBanForm},
|
||||
moderator::{ModBan, ModBanForm, ModBanFromCommunity, ModBanFromCommunityForm},
|
||||
mod_log::moderator::{ModBan, ModBanForm, ModBanFromCommunity, ModBanFromCommunityForm},
|
||||
person::{Person, PersonUpdateForm},
|
||||
},
|
||||
traits::{Bannable, Crud},
|
||||
|
|
|
@ -31,7 +31,7 @@ use lemmy_db_schema::{
|
|||
source::{
|
||||
activity::ActivitySendTargets,
|
||||
community::{Community, CommunityModerator, CommunityModeratorForm},
|
||||
moderator::{ModAddCommunity, ModAddCommunityForm},
|
||||
mod_log::moderator::{ModAddCommunity, ModAddCommunityForm},
|
||||
person::Person,
|
||||
post::{Post, PostUpdateForm},
|
||||
},
|
||||
|
|
|
@ -27,7 +27,7 @@ use lemmy_db_schema::{
|
|||
source::{
|
||||
activity::ActivitySendTargets,
|
||||
community::{Community, CommunityModerator, CommunityModeratorForm},
|
||||
moderator::{ModAddCommunity, ModAddCommunityForm},
|
||||
mod_log::moderator::{ModAddCommunity, ModAddCommunityForm},
|
||||
post::{Post, PostUpdateForm},
|
||||
},
|
||||
traits::{Crud, Joinable},
|
||||
|
|
|
@ -27,7 +27,7 @@ use lemmy_db_schema::{
|
|||
source::{
|
||||
activity::ActivitySendTargets,
|
||||
community::Community,
|
||||
moderator::{ModLockPost, ModLockPostForm},
|
||||
mod_log::moderator::{ModLockPost, ModLockPostForm},
|
||||
person::Person,
|
||||
post::{Post, PostUpdateForm},
|
||||
},
|
||||
|
|
|
@ -14,7 +14,7 @@ use lemmy_db_schema::{
|
|||
comment::{Comment, CommentUpdateForm},
|
||||
comment_report::CommentReport,
|
||||
community::{Community, CommunityUpdateForm},
|
||||
moderator::{
|
||||
mod_log::moderator::{
|
||||
ModRemoveComment,
|
||||
ModRemoveCommentForm,
|
||||
ModRemoveCommunity,
|
||||
|
|
|
@ -13,7 +13,7 @@ use lemmy_db_schema::{
|
|||
source::{
|
||||
comment::{Comment, CommentUpdateForm},
|
||||
community::{Community, CommunityUpdateForm},
|
||||
moderator::{
|
||||
mod_log::moderator::{
|
||||
ModRemoveComment,
|
||||
ModRemoveCommentForm,
|
||||
ModRemoveCommunity,
|
||||
|
|
|
@ -21,7 +21,7 @@ pub mod local_site_url_blocklist;
|
|||
pub mod local_user;
|
||||
pub mod local_user_vote_display_mode;
|
||||
pub mod login_token;
|
||||
pub mod moderator;
|
||||
pub mod mod_log;
|
||||
pub mod oauth_account;
|
||||
pub mod oauth_provider;
|
||||
pub mod password_reset_request;
|
||||
|
|
132
crates/db_schema/src/impls/mod_log/admin.rs
Normal file
132
crates/db_schema/src/impls/mod_log/admin.rs
Normal file
|
@ -0,0 +1,132 @@
|
|||
use crate::{
|
||||
source::mod_log::admin::{
|
||||
AdminPurgeComment,
|
||||
AdminPurgeCommentForm,
|
||||
AdminPurgeCommunity,
|
||||
AdminPurgeCommunityForm,
|
||||
AdminPurgePerson,
|
||||
AdminPurgePersonForm,
|
||||
AdminPurgePost,
|
||||
AdminPurgePostForm,
|
||||
},
|
||||
traits::Crud,
|
||||
utils::{get_conn, DbPool},
|
||||
};
|
||||
use diesel::{dsl::insert_into, result::Error, QueryDsl};
|
||||
use diesel_async::RunQueryDsl;
|
||||
|
||||
#[async_trait]
|
||||
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> {
|
||||
use crate::schema::admin_purge_person::dsl::admin_purge_person;
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
insert_into(admin_purge_person)
|
||||
.values(form)
|
||||
.get_result::<Self>(conn)
|
||||
.await
|
||||
}
|
||||
|
||||
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))
|
||||
.set(form)
|
||||
.get_result::<Self>(conn)
|
||||
.await
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
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> {
|
||||
use crate::schema::admin_purge_community::dsl::admin_purge_community;
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
insert_into(admin_purge_community)
|
||||
.values(form)
|
||||
.get_result::<Self>(conn)
|
||||
.await
|
||||
}
|
||||
|
||||
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))
|
||||
.set(form)
|
||||
.get_result::<Self>(conn)
|
||||
.await
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
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> {
|
||||
use crate::schema::admin_purge_post::dsl::admin_purge_post;
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
insert_into(admin_purge_post)
|
||||
.values(form)
|
||||
.get_result::<Self>(conn)
|
||||
.await
|
||||
}
|
||||
|
||||
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))
|
||||
.set(form)
|
||||
.get_result::<Self>(conn)
|
||||
.await
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
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> {
|
||||
use crate::schema::admin_purge_comment::dsl::admin_purge_comment;
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
insert_into(admin_purge_comment)
|
||||
.values(form)
|
||||
.get_result::<Self>(conn)
|
||||
.await
|
||||
}
|
||||
|
||||
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))
|
||||
.set(form)
|
||||
.get_result::<Self>(conn)
|
||||
.await
|
||||
}
|
||||
}
|
2
crates/db_schema/src/impls/mod_log/mod.rs
Normal file
2
crates/db_schema/src/impls/mod_log/mod.rs
Normal file
|
@ -0,0 +1,2 @@
|
|||
pub mod admin;
|
||||
pub mod moderator;
|
|
@ -1,13 +1,5 @@
|
|||
use crate::{
|
||||
source::moderator::{
|
||||
AdminPurgeComment,
|
||||
AdminPurgeCommentForm,
|
||||
AdminPurgeCommunity,
|
||||
AdminPurgeCommunityForm,
|
||||
AdminPurgePerson,
|
||||
AdminPurgePersonForm,
|
||||
AdminPurgePost,
|
||||
AdminPurgePostForm,
|
||||
source::mod_log::moderator::{
|
||||
ModAdd,
|
||||
ModAddCommunity,
|
||||
ModAddCommunityForm,
|
||||
|
@ -376,157 +368,20 @@ impl Crud for ModAdd {
|
|||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
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> {
|
||||
use crate::schema::admin_purge_person::dsl::admin_purge_person;
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
insert_into(admin_purge_person)
|
||||
.values(form)
|
||||
.get_result::<Self>(conn)
|
||||
.await
|
||||
}
|
||||
|
||||
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))
|
||||
.set(form)
|
||||
.get_result::<Self>(conn)
|
||||
.await
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
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> {
|
||||
use crate::schema::admin_purge_community::dsl::admin_purge_community;
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
insert_into(admin_purge_community)
|
||||
.values(form)
|
||||
.get_result::<Self>(conn)
|
||||
.await
|
||||
}
|
||||
|
||||
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))
|
||||
.set(form)
|
||||
.get_result::<Self>(conn)
|
||||
.await
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
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> {
|
||||
use crate::schema::admin_purge_post::dsl::admin_purge_post;
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
insert_into(admin_purge_post)
|
||||
.values(form)
|
||||
.get_result::<Self>(conn)
|
||||
.await
|
||||
}
|
||||
|
||||
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))
|
||||
.set(form)
|
||||
.get_result::<Self>(conn)
|
||||
.await
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
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> {
|
||||
use crate::schema::admin_purge_comment::dsl::admin_purge_comment;
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
insert_into(admin_purge_comment)
|
||||
.values(form)
|
||||
.get_result::<Self>(conn)
|
||||
.await
|
||||
}
|
||||
|
||||
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))
|
||||
.set(form)
|
||||
.get_result::<Self>(conn)
|
||||
.await
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
use super::*;
|
||||
use crate::{
|
||||
source::{
|
||||
comment::{Comment, CommentInsertForm},
|
||||
community::{Community, CommunityInsertForm},
|
||||
instance::Instance,
|
||||
moderator::{
|
||||
ModAdd,
|
||||
ModAddCommunity,
|
||||
ModAddCommunityForm,
|
||||
ModAddForm,
|
||||
ModBan,
|
||||
ModBanForm,
|
||||
ModBanFromCommunity,
|
||||
ModBanFromCommunityForm,
|
||||
ModFeaturePost,
|
||||
ModFeaturePostForm,
|
||||
ModLockPost,
|
||||
ModLockPostForm,
|
||||
ModRemoveComment,
|
||||
ModRemoveCommentForm,
|
||||
ModRemoveCommunity,
|
||||
ModRemoveCommunityForm,
|
||||
ModRemovePost,
|
||||
ModRemovePostForm,
|
||||
},
|
||||
person::{Person, PersonInsertForm},
|
||||
post::{Post, PostInsertForm},
|
||||
},
|
||||
traits::Crud,
|
||||
utils::build_db_pool_for_tests,
|
||||
};
|
||||
use diesel::result::Error;
|
||||
use pretty_assertions::assert_eq;
|
||||
use serial_test::serial;
|
||||
|
|
@ -26,7 +26,7 @@ pub mod local_site_url_blocklist;
|
|||
pub mod local_user;
|
||||
pub mod local_user_vote_display_mode;
|
||||
pub mod login_token;
|
||||
pub mod moderator;
|
||||
pub mod mod_log;
|
||||
pub mod oauth_account;
|
||||
pub mod oauth_provider;
|
||||
pub mod password_reset_request;
|
||||
|
|
105
crates/db_schema/src/source/mod_log/admin.rs
Normal file
105
crates/db_schema/src/source/mod_log/admin.rs
Normal file
|
@ -0,0 +1,105 @@
|
|||
use crate::newtypes::{CommunityId, PersonId, PostId};
|
||||
#[cfg(feature = "full")]
|
||||
use crate::schema::{
|
||||
admin_purge_comment,
|
||||
admin_purge_community,
|
||||
admin_purge_person,
|
||||
admin_purge_post,
|
||||
};
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = admin_purge_person))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
/// When an admin purges a person.
|
||||
pub struct AdminPurgePerson {
|
||||
pub id: i32,
|
||||
pub admin_person_id: PersonId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
pub when_: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = admin_purge_person))]
|
||||
pub struct AdminPurgePersonForm {
|
||||
pub admin_person_id: PersonId,
|
||||
pub reason: Option<String>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = admin_purge_community))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
/// When an admin purges a community.
|
||||
pub struct AdminPurgeCommunity {
|
||||
pub id: i32,
|
||||
pub admin_person_id: PersonId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
pub when_: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = admin_purge_community))]
|
||||
pub struct AdminPurgeCommunityForm {
|
||||
pub admin_person_id: PersonId,
|
||||
pub reason: Option<String>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = admin_purge_post))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
/// When an admin purges a post.
|
||||
pub struct AdminPurgePost {
|
||||
pub id: i32,
|
||||
pub admin_person_id: PersonId,
|
||||
pub community_id: CommunityId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
pub when_: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = admin_purge_post))]
|
||||
pub struct AdminPurgePostForm {
|
||||
pub admin_person_id: PersonId,
|
||||
pub community_id: CommunityId,
|
||||
pub reason: Option<String>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = admin_purge_comment))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
/// When an admin purges a comment.
|
||||
pub struct AdminPurgeComment {
|
||||
pub id: i32,
|
||||
pub admin_person_id: PersonId,
|
||||
pub post_id: PostId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
pub when_: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = admin_purge_comment))]
|
||||
pub struct AdminPurgeCommentForm {
|
||||
pub admin_person_id: PersonId,
|
||||
pub post_id: PostId,
|
||||
pub reason: Option<String>,
|
||||
}
|
2
crates/db_schema/src/source/mod_log/mod.rs
Normal file
2
crates/db_schema/src/source/mod_log/mod.rs
Normal file
|
@ -0,0 +1,2 @@
|
|||
pub mod admin;
|
||||
pub mod moderator;
|
|
@ -1,10 +1,6 @@
|
|||
use crate::newtypes::{CommentId, CommunityId, PersonId, PostId};
|
||||
#[cfg(feature = "full")]
|
||||
use crate::schema::{
|
||||
admin_purge_comment,
|
||||
admin_purge_community,
|
||||
admin_purge_person,
|
||||
admin_purge_post,
|
||||
mod_add,
|
||||
mod_add_community,
|
||||
mod_ban,
|
||||
|
@ -300,95 +296,3 @@ pub struct ModAddForm {
|
|||
pub other_person_id: PersonId,
|
||||
pub removed: Option<bool>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = admin_purge_person))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
/// When an admin purges a person.
|
||||
pub struct AdminPurgePerson {
|
||||
pub id: i32,
|
||||
pub admin_person_id: PersonId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
pub when_: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = admin_purge_person))]
|
||||
pub struct AdminPurgePersonForm {
|
||||
pub admin_person_id: PersonId,
|
||||
pub reason: Option<String>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = admin_purge_community))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
/// When an admin purges a community.
|
||||
pub struct AdminPurgeCommunity {
|
||||
pub id: i32,
|
||||
pub admin_person_id: PersonId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
pub when_: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = admin_purge_community))]
|
||||
pub struct AdminPurgeCommunityForm {
|
||||
pub admin_person_id: PersonId,
|
||||
pub reason: Option<String>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = admin_purge_post))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
/// When an admin purges a post.
|
||||
pub struct AdminPurgePost {
|
||||
pub id: i32,
|
||||
pub admin_person_id: PersonId,
|
||||
pub community_id: CommunityId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
pub when_: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = admin_purge_post))]
|
||||
pub struct AdminPurgePostForm {
|
||||
pub admin_person_id: PersonId,
|
||||
pub community_id: CommunityId,
|
||||
pub reason: Option<String>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = admin_purge_comment))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
/// When an admin purges a comment.
|
||||
pub struct AdminPurgeComment {
|
||||
pub id: i32,
|
||||
pub admin_person_id: PersonId,
|
||||
pub post_id: PostId,
|
||||
#[cfg_attr(feature = "full", ts(optional))]
|
||||
pub reason: Option<String>,
|
||||
pub when_: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = admin_purge_comment))]
|
||||
pub struct AdminPurgeCommentForm {
|
||||
pub admin_person_id: PersonId,
|
||||
pub post_id: PostId,
|
||||
pub reason: Option<String>,
|
||||
}
|
|
@ -8,22 +8,21 @@ use lemmy_db_schema::{
|
|||
federation_allowlist::AdminAllowInstance,
|
||||
federation_blocklist::AdminBlockInstance,
|
||||
instance::Instance,
|
||||
moderator::{
|
||||
AdminPurgeComment,
|
||||
AdminPurgeCommunity,
|
||||
AdminPurgePerson,
|
||||
AdminPurgePost,
|
||||
ModAdd,
|
||||
ModAddCommunity,
|
||||
ModBan,
|
||||
ModBanFromCommunity,
|
||||
ModFeaturePost,
|
||||
ModHideCommunity,
|
||||
ModLockPost,
|
||||
ModRemoveComment,
|
||||
ModRemoveCommunity,
|
||||
ModRemovePost,
|
||||
ModTransferCommunity,
|
||||
mod_log::{
|
||||
admin::{AdminPurgeComment, AdminPurgeCommunity, AdminPurgePerson, AdminPurgePost},
|
||||
moderator::{
|
||||
ModAdd,
|
||||
ModAddCommunity,
|
||||
ModBan,
|
||||
ModBanFromCommunity,
|
||||
ModFeaturePost,
|
||||
ModHideCommunity,
|
||||
ModLockPost,
|
||||
ModRemoveComment,
|
||||
ModRemoveCommunity,
|
||||
ModRemovePost,
|
||||
ModTransferCommunity,
|
||||
},
|
||||
},
|
||||
person::Person,
|
||||
post::Post,
|
||||
|
|
|
@ -442,8 +442,7 @@ async fn update_banned_when_expired(pool: &mut DbPool<'_>) {
|
|||
.ok();
|
||||
|
||||
diesel::delete(
|
||||
federation_blocklist::table
|
||||
.filter(federation_blocklist::expires.lt(now().nullable())),
|
||||
federation_blocklist::table.filter(federation_blocklist::expires.lt(now().nullable())),
|
||||
)
|
||||
.execute(&mut conn)
|
||||
.await
|
||||
|
|
Loading…
Reference in a new issue