2023-08-31 13:26:10 +00:00
|
|
|
#[cfg(feature = "full")]
|
|
|
|
use diesel::Queryable;
|
2022-08-16 11:52:04 +00:00
|
|
|
use lemmy_db_schema::{
|
|
|
|
newtypes::{CommunityId, PersonId},
|
|
|
|
source::{
|
|
|
|
comment::Comment,
|
2023-03-01 17:19:46 +00:00
|
|
|
community::Community,
|
2022-08-16 11:52:04 +00:00
|
|
|
moderator::{
|
|
|
|
AdminPurgeComment,
|
|
|
|
AdminPurgeCommunity,
|
|
|
|
AdminPurgePerson,
|
|
|
|
AdminPurgePost,
|
|
|
|
ModAdd,
|
|
|
|
ModAddCommunity,
|
|
|
|
ModBan,
|
|
|
|
ModBanFromCommunity,
|
2022-12-12 11:17:10 +00:00
|
|
|
ModFeaturePost,
|
2022-08-16 11:52:04 +00:00
|
|
|
ModHideCommunity,
|
|
|
|
ModLockPost,
|
|
|
|
ModRemoveComment,
|
|
|
|
ModRemoveCommunity,
|
|
|
|
ModRemovePost,
|
|
|
|
ModTransferCommunity,
|
|
|
|
},
|
2023-03-01 17:19:46 +00:00
|
|
|
person::Person,
|
2022-08-16 11:52:04 +00:00
|
|
|
post::Post,
|
2022-05-03 17:44:13 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
use serde::{Deserialize, Serialize};
|
2023-04-26 04:26:10 +00:00
|
|
|
use serde_with::skip_serializing_none;
|
|
|
|
#[cfg(feature = "full")]
|
|
|
|
use ts_rs::TS;
|
2022-05-03 17:44:13 +00:00
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2022-05-03 17:44:13 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2023-08-31 13:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
2023-11-21 13:42:28 +00:00
|
|
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// When someone is added as a community moderator.
|
2022-05-03 17:44:13 +00:00
|
|
|
pub struct ModAddCommunityView {
|
|
|
|
pub mod_add_community: ModAddCommunity,
|
2023-03-01 17:19:46 +00:00
|
|
|
pub moderator: Option<Person>,
|
|
|
|
pub community: Community,
|
|
|
|
pub modded_person: Person,
|
2022-05-03 17:44:13 +00:00
|
|
|
}
|
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2022-05-03 17:44:13 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2023-08-31 13:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
2023-11-21 13:42:28 +00:00
|
|
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// When someone is added as a site moderator.
|
2022-05-03 17:44:13 +00:00
|
|
|
pub struct ModAddView {
|
|
|
|
pub mod_add: ModAdd,
|
2023-03-01 17:19:46 +00:00
|
|
|
pub moderator: Option<Person>,
|
|
|
|
pub modded_person: Person,
|
2022-05-03 17:44:13 +00:00
|
|
|
}
|
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2022-05-03 17:44:13 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2023-08-31 13:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
2023-11-21 13:42:28 +00:00
|
|
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// When someone is banned from a community.
|
2022-05-03 17:44:13 +00:00
|
|
|
pub struct ModBanFromCommunityView {
|
|
|
|
pub mod_ban_from_community: ModBanFromCommunity,
|
2023-03-01 17:19:46 +00:00
|
|
|
pub moderator: Option<Person>,
|
|
|
|
pub community: Community,
|
|
|
|
pub banned_person: Person,
|
2022-05-03 17:44:13 +00:00
|
|
|
}
|
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2022-05-03 17:44:13 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2023-08-31 13:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
2023-11-21 13:42:28 +00:00
|
|
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// When someone is banned from the site.
|
2022-05-03 17:44:13 +00:00
|
|
|
pub struct ModBanView {
|
|
|
|
pub mod_ban: ModBan,
|
2023-03-01 17:19:46 +00:00
|
|
|
pub moderator: Option<Person>,
|
|
|
|
pub banned_person: Person,
|
2022-05-03 17:44:13 +00:00
|
|
|
}
|
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2022-05-03 17:44:13 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2023-08-31 13:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
2023-11-21 13:42:28 +00:00
|
|
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// When a community is hidden from public view.
|
2022-05-03 17:44:13 +00:00
|
|
|
pub struct ModHideCommunityView {
|
|
|
|
pub mod_hide_community: ModHideCommunity,
|
2023-03-01 17:19:46 +00:00
|
|
|
pub admin: Option<Person>,
|
|
|
|
pub community: Community,
|
2022-05-03 17:44:13 +00:00
|
|
|
}
|
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2022-05-03 17:44:13 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2023-08-31 13:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
2023-11-21 13:42:28 +00:00
|
|
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// When a moderator locks a post (prevents new comments being made).
|
2022-05-03 17:44:13 +00:00
|
|
|
pub struct ModLockPostView {
|
|
|
|
pub mod_lock_post: ModLockPost,
|
2023-03-01 17:19:46 +00:00
|
|
|
pub moderator: Option<Person>,
|
2022-05-03 17:44:13 +00:00
|
|
|
pub post: Post,
|
2023-03-01 17:19:46 +00:00
|
|
|
pub community: Community,
|
2022-05-03 17:44:13 +00:00
|
|
|
}
|
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2022-05-03 17:44:13 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2023-08-31 13:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
2023-11-21 13:42:28 +00:00
|
|
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// When a moderator removes a comment.
|
2022-05-03 17:44:13 +00:00
|
|
|
pub struct ModRemoveCommentView {
|
|
|
|
pub mod_remove_comment: ModRemoveComment,
|
2023-03-01 17:19:46 +00:00
|
|
|
pub moderator: Option<Person>,
|
2022-05-03 17:44:13 +00:00
|
|
|
pub comment: Comment,
|
2023-03-01 17:19:46 +00:00
|
|
|
pub commenter: Person,
|
2022-05-03 17:44:13 +00:00
|
|
|
pub post: Post,
|
2023-03-01 17:19:46 +00:00
|
|
|
pub community: Community,
|
2022-05-03 17:44:13 +00:00
|
|
|
}
|
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2022-05-03 17:44:13 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2023-08-31 13:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
2023-11-21 13:42:28 +00:00
|
|
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// When a moderator removes a community.
|
2022-05-03 17:44:13 +00:00
|
|
|
pub struct ModRemoveCommunityView {
|
|
|
|
pub mod_remove_community: ModRemoveCommunity,
|
2023-03-01 17:19:46 +00:00
|
|
|
pub moderator: Option<Person>,
|
|
|
|
pub community: Community,
|
2022-05-03 17:44:13 +00:00
|
|
|
}
|
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2022-05-03 17:44:13 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2023-08-31 13:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
2023-11-21 13:42:28 +00:00
|
|
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// When a moderator removes a post.
|
2022-05-03 17:44:13 +00:00
|
|
|
pub struct ModRemovePostView {
|
|
|
|
pub mod_remove_post: ModRemovePost,
|
2023-03-01 17:19:46 +00:00
|
|
|
pub moderator: Option<Person>,
|
2022-05-03 17:44:13 +00:00
|
|
|
pub post: Post,
|
2023-03-01 17:19:46 +00:00
|
|
|
pub community: Community,
|
2022-05-03 17:44:13 +00:00
|
|
|
}
|
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2022-05-03 17:44:13 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2023-08-31 13:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
2023-11-21 13:42:28 +00:00
|
|
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// When a moderator features a post on a community (pins it to the top).
|
2022-12-12 11:17:10 +00:00
|
|
|
pub struct ModFeaturePostView {
|
|
|
|
pub mod_feature_post: ModFeaturePost,
|
2023-03-01 17:19:46 +00:00
|
|
|
pub moderator: Option<Person>,
|
2022-05-03 17:44:13 +00:00
|
|
|
pub post: Post,
|
2023-03-01 17:19:46 +00:00
|
|
|
pub community: Community,
|
2022-05-03 17:44:13 +00:00
|
|
|
}
|
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2022-05-03 17:44:13 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2023-08-31 13:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
2023-11-21 13:42:28 +00:00
|
|
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// When a moderator transfers a community to a new owner.
|
2022-05-03 17:44:13 +00:00
|
|
|
pub struct ModTransferCommunityView {
|
|
|
|
pub mod_transfer_community: ModTransferCommunity,
|
2023-03-01 17:19:46 +00:00
|
|
|
pub moderator: Option<Person>,
|
|
|
|
pub community: Community,
|
|
|
|
pub modded_person: Person,
|
2022-05-03 17:44:13 +00:00
|
|
|
}
|
2022-06-13 19:15:04 +00:00
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2022-06-13 19:15:04 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2023-08-31 13:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
2023-11-21 13:42:28 +00:00
|
|
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// When an admin purges a comment.
|
2022-06-13 19:15:04 +00:00
|
|
|
pub struct AdminPurgeCommentView {
|
|
|
|
pub admin_purge_comment: AdminPurgeComment,
|
2023-03-01 17:19:46 +00:00
|
|
|
pub admin: Option<Person>,
|
2022-06-13 19:15:04 +00:00
|
|
|
pub post: Post,
|
|
|
|
}
|
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2022-06-13 19:15:04 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2023-08-31 13:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
2023-11-21 13:42:28 +00:00
|
|
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// When an admin purges a community.
|
2022-06-13 19:15:04 +00:00
|
|
|
pub struct AdminPurgeCommunityView {
|
|
|
|
pub admin_purge_community: AdminPurgeCommunity,
|
2023-03-01 17:19:46 +00:00
|
|
|
pub admin: Option<Person>,
|
2022-06-13 19:15:04 +00:00
|
|
|
}
|
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2022-06-13 19:15:04 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2023-08-31 13:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
2023-11-21 13:42:28 +00:00
|
|
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// When an admin purges a person.
|
2022-06-13 19:15:04 +00:00
|
|
|
pub struct AdminPurgePersonView {
|
|
|
|
pub admin_purge_person: AdminPurgePerson,
|
2023-03-01 17:19:46 +00:00
|
|
|
pub admin: Option<Person>,
|
2022-06-13 19:15:04 +00:00
|
|
|
}
|
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2022-06-13 19:15:04 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
2023-08-31 13:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
2023-11-21 13:42:28 +00:00
|
|
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// When an admin purges a post.
|
2022-06-13 19:15:04 +00:00
|
|
|
pub struct AdminPurgePostView {
|
|
|
|
pub admin_purge_post: AdminPurgePost,
|
2023-03-01 17:19:46 +00:00
|
|
|
pub admin: Option<Person>,
|
|
|
|
pub community: Community,
|
2022-06-13 19:15:04 +00:00
|
|
|
}
|
2022-08-16 11:52:04 +00:00
|
|
|
|
2023-04-26 04:26:10 +00:00
|
|
|
#[skip_serializing_none]
|
2022-08-16 11:52:04 +00:00
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy)]
|
2023-08-31 13:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
2023-11-21 13:42:28 +00:00
|
|
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
2023-04-26 04:26:10 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
2023-05-10 19:20:39 +00:00
|
|
|
/// Querying / filtering the modlog.
|
2022-08-16 11:52:04 +00:00
|
|
|
pub struct ModlogListParams {
|
|
|
|
pub community_id: Option<CommunityId>,
|
|
|
|
pub mod_person_id: Option<PersonId>,
|
|
|
|
pub other_person_id: Option<PersonId>,
|
|
|
|
pub page: Option<i64>,
|
|
|
|
pub limit: Option<i64>,
|
|
|
|
pub hide_modlog_names: bool,
|
|
|
|
}
|