2021-03-18 20:25:21 +00:00
|
|
|
use crate::{
|
|
|
|
schema::{
|
|
|
|
mod_add,
|
|
|
|
mod_add_community,
|
|
|
|
mod_ban,
|
|
|
|
mod_ban_from_community,
|
|
|
|
mod_lock_post,
|
|
|
|
mod_remove_comment,
|
|
|
|
mod_remove_community,
|
|
|
|
mod_remove_post,
|
|
|
|
mod_sticky_post,
|
|
|
|
},
|
|
|
|
CommentId,
|
|
|
|
CommunityId,
|
|
|
|
PersonId,
|
|
|
|
PostId,
|
2020-12-21 13:38:34 +00:00
|
|
|
};
|
|
|
|
use serde::Serialize;
|
|
|
|
|
|
|
|
#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
|
|
|
|
#[table_name = "mod_remove_post"]
|
|
|
|
pub struct ModRemovePost {
|
|
|
|
pub id: i32,
|
2021-03-18 20:25:21 +00:00
|
|
|
pub mod_person_id: PersonId,
|
|
|
|
pub post_id: PostId,
|
2020-12-21 13:38:34 +00:00
|
|
|
pub reason: Option<String>,
|
|
|
|
pub removed: Option<bool>,
|
|
|
|
pub when_: chrono::NaiveDateTime,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Insertable, AsChangeset)]
|
|
|
|
#[table_name = "mod_remove_post"]
|
|
|
|
pub struct ModRemovePostForm {
|
2021-03-18 20:25:21 +00:00
|
|
|
pub mod_person_id: PersonId,
|
|
|
|
pub post_id: PostId,
|
2020-12-21 13:38:34 +00:00
|
|
|
pub reason: Option<String>,
|
|
|
|
pub removed: Option<bool>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
|
|
|
|
#[table_name = "mod_lock_post"]
|
|
|
|
pub struct ModLockPost {
|
|
|
|
pub id: i32,
|
2021-03-18 20:25:21 +00:00
|
|
|
pub mod_person_id: PersonId,
|
|
|
|
pub post_id: PostId,
|
2020-12-21 13:38:34 +00:00
|
|
|
pub locked: Option<bool>,
|
|
|
|
pub when_: chrono::NaiveDateTime,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Insertable, AsChangeset)]
|
|
|
|
#[table_name = "mod_lock_post"]
|
|
|
|
pub struct ModLockPostForm {
|
2021-03-18 20:25:21 +00:00
|
|
|
pub mod_person_id: PersonId,
|
|
|
|
pub post_id: PostId,
|
2020-12-21 13:38:34 +00:00
|
|
|
pub locked: Option<bool>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
|
|
|
|
#[table_name = "mod_sticky_post"]
|
|
|
|
pub struct ModStickyPost {
|
|
|
|
pub id: i32,
|
2021-03-18 20:25:21 +00:00
|
|
|
pub mod_person_id: PersonId,
|
|
|
|
pub post_id: PostId,
|
2020-12-21 13:38:34 +00:00
|
|
|
pub stickied: Option<bool>,
|
|
|
|
pub when_: chrono::NaiveDateTime,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Insertable, AsChangeset)]
|
|
|
|
#[table_name = "mod_sticky_post"]
|
|
|
|
pub struct ModStickyPostForm {
|
2021-03-18 20:25:21 +00:00
|
|
|
pub mod_person_id: PersonId,
|
|
|
|
pub post_id: PostId,
|
2020-12-21 13:38:34 +00:00
|
|
|
pub stickied: Option<bool>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
|
|
|
|
#[table_name = "mod_remove_comment"]
|
|
|
|
pub struct ModRemoveComment {
|
|
|
|
pub id: i32,
|
2021-03-18 20:25:21 +00:00
|
|
|
pub mod_person_id: PersonId,
|
|
|
|
pub comment_id: CommentId,
|
2020-12-21 13:38:34 +00:00
|
|
|
pub reason: Option<String>,
|
|
|
|
pub removed: Option<bool>,
|
|
|
|
pub when_: chrono::NaiveDateTime,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Insertable, AsChangeset)]
|
|
|
|
#[table_name = "mod_remove_comment"]
|
|
|
|
pub struct ModRemoveCommentForm {
|
2021-03-18 20:25:21 +00:00
|
|
|
pub mod_person_id: PersonId,
|
|
|
|
pub comment_id: CommentId,
|
2020-12-21 13:38:34 +00:00
|
|
|
pub reason: Option<String>,
|
|
|
|
pub removed: Option<bool>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
|
|
|
|
#[table_name = "mod_remove_community"]
|
|
|
|
pub struct ModRemoveCommunity {
|
|
|
|
pub id: i32,
|
2021-03-18 20:25:21 +00:00
|
|
|
pub mod_person_id: PersonId,
|
|
|
|
pub community_id: CommunityId,
|
2020-12-21 13:38:34 +00:00
|
|
|
pub reason: Option<String>,
|
|
|
|
pub removed: Option<bool>,
|
|
|
|
pub expires: Option<chrono::NaiveDateTime>,
|
|
|
|
pub when_: chrono::NaiveDateTime,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Insertable, AsChangeset)]
|
|
|
|
#[table_name = "mod_remove_community"]
|
|
|
|
pub struct ModRemoveCommunityForm {
|
2021-03-18 20:25:21 +00:00
|
|
|
pub mod_person_id: PersonId,
|
|
|
|
pub community_id: CommunityId,
|
2020-12-21 13:38:34 +00:00
|
|
|
pub reason: Option<String>,
|
|
|
|
pub removed: Option<bool>,
|
|
|
|
pub expires: Option<chrono::NaiveDateTime>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
|
|
|
|
#[table_name = "mod_ban_from_community"]
|
|
|
|
pub struct ModBanFromCommunity {
|
|
|
|
pub id: i32,
|
2021-03-18 20:25:21 +00:00
|
|
|
pub mod_person_id: PersonId,
|
|
|
|
pub other_person_id: PersonId,
|
|
|
|
pub community_id: CommunityId,
|
2020-12-21 13:38:34 +00:00
|
|
|
pub reason: Option<String>,
|
|
|
|
pub banned: Option<bool>,
|
|
|
|
pub expires: Option<chrono::NaiveDateTime>,
|
|
|
|
pub when_: chrono::NaiveDateTime,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Insertable, AsChangeset)]
|
|
|
|
#[table_name = "mod_ban_from_community"]
|
|
|
|
pub struct ModBanFromCommunityForm {
|
2021-03-18 20:25:21 +00:00
|
|
|
pub mod_person_id: PersonId,
|
|
|
|
pub other_person_id: PersonId,
|
|
|
|
pub community_id: CommunityId,
|
2020-12-21 13:38:34 +00:00
|
|
|
pub reason: Option<String>,
|
|
|
|
pub banned: Option<bool>,
|
|
|
|
pub expires: Option<chrono::NaiveDateTime>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
|
|
|
|
#[table_name = "mod_ban"]
|
|
|
|
pub struct ModBan {
|
|
|
|
pub id: i32,
|
2021-03-18 20:25:21 +00:00
|
|
|
pub mod_person_id: PersonId,
|
|
|
|
pub other_person_id: PersonId,
|
2020-12-21 13:38:34 +00:00
|
|
|
pub reason: Option<String>,
|
|
|
|
pub banned: Option<bool>,
|
|
|
|
pub expires: Option<chrono::NaiveDateTime>,
|
|
|
|
pub when_: chrono::NaiveDateTime,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Insertable, AsChangeset)]
|
|
|
|
#[table_name = "mod_ban"]
|
|
|
|
pub struct ModBanForm {
|
2021-03-18 20:25:21 +00:00
|
|
|
pub mod_person_id: PersonId,
|
|
|
|
pub other_person_id: PersonId,
|
2020-12-21 13:38:34 +00:00
|
|
|
pub reason: Option<String>,
|
|
|
|
pub banned: Option<bool>,
|
|
|
|
pub expires: Option<chrono::NaiveDateTime>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
|
|
|
|
#[table_name = "mod_add_community"]
|
|
|
|
pub struct ModAddCommunity {
|
|
|
|
pub id: i32,
|
2021-03-18 20:25:21 +00:00
|
|
|
pub mod_person_id: PersonId,
|
|
|
|
pub other_person_id: PersonId,
|
|
|
|
pub community_id: CommunityId,
|
2020-12-21 13:38:34 +00:00
|
|
|
pub removed: Option<bool>,
|
|
|
|
pub when_: chrono::NaiveDateTime,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Insertable, AsChangeset)]
|
|
|
|
#[table_name = "mod_add_community"]
|
|
|
|
pub struct ModAddCommunityForm {
|
2021-03-18 20:25:21 +00:00
|
|
|
pub mod_person_id: PersonId,
|
|
|
|
pub other_person_id: PersonId,
|
|
|
|
pub community_id: CommunityId,
|
2020-12-21 13:38:34 +00:00
|
|
|
pub removed: Option<bool>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
|
|
|
|
#[table_name = "mod_add"]
|
|
|
|
pub struct ModAdd {
|
|
|
|
pub id: i32,
|
2021-03-18 20:25:21 +00:00
|
|
|
pub mod_person_id: PersonId,
|
|
|
|
pub other_person_id: PersonId,
|
2020-12-21 13:38:34 +00:00
|
|
|
pub removed: Option<bool>,
|
|
|
|
pub when_: chrono::NaiveDateTime,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Insertable, AsChangeset)]
|
|
|
|
#[table_name = "mod_add"]
|
|
|
|
pub struct ModAddForm {
|
2021-03-18 20:25:21 +00:00
|
|
|
pub mod_person_id: PersonId,
|
|
|
|
pub other_person_id: PersonId,
|
2020-12-21 13:38:34 +00:00
|
|
|
pub removed: Option<bool>,
|
|
|
|
}
|