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::{
|
2024-03-04 16:42:25 +00:00
|
|
|
newtypes::{CommentId, CommunityId, PersonId, PostId},
|
2022-08-16 11:52:04 +00:00
|
|
|
source::{
|
|
|
|
comment::Comment,
|
2023-03-01 17:19:46 +00:00
|
|
|
community::Community,
|
2024-11-28 23:21:43 +00:00
|
|
|
instance::Instance,
|
|
|
|
mod_log::{
|
|
|
|
admin::{
|
|
|
|
AdminAllowInstance,
|
|
|
|
AdminBlockInstance,
|
|
|
|
AdminPurgeComment,
|
|
|
|
AdminPurgeCommunity,
|
|
|
|
AdminPurgePerson,
|
|
|
|
AdminPurgePost,
|
|
|
|
},
|
|
|
|
moderator::{
|
|
|
|
ModAdd,
|
|
|
|
ModAddCommunity,
|
|
|
|
ModBan,
|
|
|
|
ModBanFromCommunity,
|
|
|
|
ModFeaturePost,
|
|
|
|
ModHideCommunity,
|
|
|
|
ModLockPost,
|
|
|
|
ModRemoveComment,
|
|
|
|
ModRemoveCommunity,
|
|
|
|
ModRemovePost,
|
|
|
|
ModTransferCommunity,
|
|
|
|
},
|
2022-08-16 11:52:04 +00:00
|
|
|
},
|
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,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
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,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
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,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
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,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
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,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
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,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
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,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
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,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
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,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
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,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
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,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
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,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
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,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
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,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
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,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
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
|
|
|
|
2024-11-28 23:21:43 +00:00
|
|
|
#[skip_serializing_none]
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
|
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
|
|
|
#[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 AdminBlockInstanceView {
|
|
|
|
pub admin_block_instance: AdminBlockInstance,
|
|
|
|
pub instance: Instance,
|
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
|
|
|
pub admin: Option<Person>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[skip_serializing_none]
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
|
|
#[cfg_attr(feature = "full", derive(TS, Queryable))]
|
|
|
|
#[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 AdminAllowInstanceView {
|
|
|
|
pub admin_block_instance: AdminAllowInstance,
|
|
|
|
pub instance: Instance,
|
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
|
|
|
pub admin: Option<Person>,
|
|
|
|
}
|
|
|
|
|
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 {
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2022-08-16 11:52:04 +00:00
|
|
|
pub community_id: Option<CommunityId>,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2022-08-16 11:52:04 +00:00
|
|
|
pub mod_person_id: Option<PersonId>,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2022-08-16 11:52:04 +00:00
|
|
|
pub other_person_id: Option<PersonId>,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2024-03-04 16:42:25 +00:00
|
|
|
pub post_id: Option<PostId>,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2024-03-04 16:42:25 +00:00
|
|
|
pub comment_id: Option<CommentId>,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2022-08-16 11:52:04 +00:00
|
|
|
pub page: Option<i64>,
|
2024-11-06 14:50:13 +00:00
|
|
|
#[cfg_attr(feature = "full", ts(optional))]
|
2024-12-09 13:15:19 +00:00
|
|
|
// TODO page_after, page_back
|
2022-08-16 11:52:04 +00:00
|
|
|
pub limit: Option<i64>,
|
|
|
|
pub hide_modlog_names: bool,
|
|
|
|
}
|
2024-12-09 13:15:19 +00:00
|
|
|
|
|
|
|
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
|
|
|
#[cfg_attr(feature = "full", derive(Queryable))]
|
|
|
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
|
|
|
/// A combined modlog view
|
|
|
|
pub struct ModlogCombinedViewInternal {
|
|
|
|
// Post-specific
|
|
|
|
// Shared
|
|
|
|
pub report_creator: Person,
|
|
|
|
pub item_creator: Person,
|
|
|
|
pub community: Option<Community>,
|
|
|
|
pub subscribed: SubscribedType,
|
|
|
|
pub resolver: Option<Person>,
|
|
|
|
pub item_creator_is_admin: bool,
|
|
|
|
pub item_creator_banned_from_community: bool,
|
|
|
|
pub item_creator_is_moderator: bool,
|
|
|
|
pub item_creator_blocked: bool,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
|
|
|
#[cfg_attr(feature = "full", derive(TS))]
|
|
|
|
#[cfg_attr(feature = "full", ts(export))]
|
|
|
|
// Use serde's internal tagging, to work easier with javascript libraries
|
|
|
|
#[serde(tag = "type_")]
|
|
|
|
pub enum ModlogCombinedView {
|
|
|
|
AdminAllowInstance(AdminAllowInstanceView),
|
|
|
|
AdminBlockInstance(AdminBlockInstanceView),
|
|
|
|
AdminPurgeComment(AdminPurgeCommentView),
|
|
|
|
AdminPurgeCommunity(AdminPurgeCommunityView),
|
|
|
|
AdminPurgePerson(AdminPurgePersonView),
|
|
|
|
AdminPurgePost(AdminPurgePostView),
|
|
|
|
ModAdd(ModAddView),
|
|
|
|
ModAddCommunity(ModAddCommunityView),
|
|
|
|
ModBan(ModBanView),
|
|
|
|
ModBanFromCommunity(ModBanFromCommunityView),
|
|
|
|
ModFeaturePost(ModFeaturePostView),
|
|
|
|
ModHideCommunity(ModHideCommunityView),
|
|
|
|
ModLockPost(ModLockPostView),
|
|
|
|
ModRemoveComment(ModRemoveCommentView),
|
|
|
|
ModRemoveCommunity(ModRemoveCommunityView),
|
|
|
|
ModRemovePost(ModRemovePostView),
|
|
|
|
ModTransferCommunity(ModTransferCommunityView),
|
|
|
|
}
|