use lemmy_db_views::{comment_report_view::CommentReportView, comment_view::CommentView};
use serde::{Deserialize, Serialize};
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct CreateComment {
pub content: String,
pub post_id: PostId,
pub auth: String,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct EditComment {
pub content: String,
pub comment_id: CommentId,
pub auth: String,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct DeleteComment {
pub comment_id: CommentId,
pub deleted: bool,
pub auth: String,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct RemoveComment {
pub comment_id: CommentId,
pub removed: bool,
pub auth: String,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct MarkCommentAsRead {
pub comment_id: CommentId,
pub read: bool,
pub auth: String,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct SaveComment {
pub comment_id: CommentId,
pub save: bool,
pub auth: String,
}
-#[derive(Serialize, Clone)]
+#[derive(Serialize, Deserialize, Clone)]
pub struct CommentResponse {
pub comment_view: CommentView,
pub recipient_ids: Vec<LocalUserId>,
pub form_id: Option<String>, // An optional front end ID, to tell which is coming back
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct CreateCommentLike {
pub comment_id: CommentId,
pub score: i16,
pub auth: String,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct GetComments {
pub type_: Option<String>,
pub sort: Option<String>,
pub auth: Option<String>,
}
-#[derive(Serialize)]
+#[derive(Serialize, Deserialize)]
pub struct GetCommentsResponse {
pub comments: Vec<CommentView>,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct CreateCommentReport {
pub comment_id: CommentId,
pub reason: String,
pub auth: String,
}
-#[derive(Serialize, Clone)]
+#[derive(Serialize, Deserialize, Clone)]
pub struct CommentReportResponse {
pub comment_report_view: CommentReportView,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct ResolveCommentReport {
pub report_id: CommentReportId,
pub resolved: bool,
pub auth: String,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct ListCommentReports {
pub page: Option<i64>,
pub limit: Option<i64>,
pub auth: String,
}
-#[derive(Serialize)]
+#[derive(Serialize, Deserialize)]
pub struct ListCommentReportsResponse {
pub comment_reports: Vec<CommentReportView>,
}
};
use serde::{Deserialize, Serialize};
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct GetCommunity {
pub id: Option<CommunityId>,
/// Example: star_trek , or star_trek@xyz.tld
pub auth: Option<String>,
}
-#[derive(Serialize)]
+#[derive(Serialize, Deserialize)]
pub struct GetCommunityResponse {
pub community_view: CommunityView,
pub moderators: Vec<CommunityModeratorView>,
pub online: usize,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct CreateCommunity {
pub name: String,
pub title: String,
pub auth: String,
}
-#[derive(Serialize, Clone)]
+#[derive(Serialize, Deserialize, Clone)]
pub struct CommunityResponse {
pub community_view: CommunityView,
}
-#[derive(Deserialize, Debug)]
+#[derive(Serialize, Deserialize, Debug)]
pub struct ListCommunities {
pub type_: Option<String>,
pub sort: Option<String>,
pub auth: Option<String>,
}
-#[derive(Serialize, Debug)]
+#[derive(Serialize, Deserialize, Debug)]
pub struct ListCommunitiesResponse {
pub communities: Vec<CommunityView>,
}
-#[derive(Deserialize, Clone)]
+#[derive(Serialize, Deserialize, Clone)]
pub struct BanFromCommunity {
pub community_id: CommunityId,
pub person_id: PersonId,
pub auth: String,
}
-#[derive(Serialize, Clone)]
+#[derive(Serialize, Deserialize, Clone)]
pub struct BanFromCommunityResponse {
pub person_view: PersonViewSafe,
pub banned: bool,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct AddModToCommunity {
pub community_id: CommunityId,
pub person_id: PersonId,
pub auth: String,
}
-#[derive(Serialize, Clone)]
+#[derive(Serialize, Deserialize, Clone)]
pub struct AddModToCommunityResponse {
pub moderators: Vec<CommunityModeratorView>,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct EditCommunity {
pub community_id: CommunityId,
pub title: Option<String>,
pub auth: String,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct DeleteCommunity {
pub community_id: CommunityId,
pub deleted: bool,
pub auth: String,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct RemoveCommunity {
pub community_id: CommunityId,
pub removed: bool,
pub auth: String,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct FollowCommunity {
pub community_id: CommunityId,
pub follow: bool,
pub auth: String,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct BlockCommunity {
pub community_id: CommunityId,
pub block: bool,
pub auth: String,
}
-#[derive(Serialize, Clone)]
+#[derive(Serialize, Deserialize, Clone)]
pub struct BlockCommunityResponse {
pub community_view: CommunityView,
pub blocked: bool,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct TransferCommunity {
pub community_id: CommunityId,
pub person_id: PersonId,
};
use serde::{Deserialize, Serialize};
-#[derive(Deserialize, Debug)]
+#[derive(Serialize, Deserialize, Debug)]
pub struct Login {
pub username_or_email: String,
pub password: String,
}
use lemmy_db_schema::{CommunityId, PersonId, PersonMentionId, PrivateMessageId};
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct Register {
pub username: String,
pub password: String,
pub honeypot: Option<String>,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct GetCaptcha {}
-#[derive(Serialize)]
+#[derive(Serialize, Deserialize)]
pub struct GetCaptchaResponse {
pub ok: Option<CaptchaResponse>, // Will be None if captchas are disabled
}
-#[derive(Serialize)]
+#[derive(Serialize, Deserialize)]
pub struct CaptchaResponse {
pub png: String, // A Base64 encoded png
pub wav: String, // A Base64 encoded wav audio
pub uuid: String,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct SaveUserSettings {
pub show_nsfw: Option<bool>,
pub show_scores: Option<bool>,
pub auth: String,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct ChangePassword {
pub new_password: String,
pub new_password_verify: String,
pub auth: String,
}
-#[derive(Serialize)]
+#[derive(Serialize, Deserialize)]
pub struct LoginResponse {
pub jwt: String,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct GetPersonDetails {
pub person_id: Option<PersonId>, // One of these two are required
/// Example: dessalines , or dessalines@xyz.tld
pub auth: Option<String>,
}
-#[derive(Serialize)]
+#[derive(Serialize, Deserialize)]
pub struct GetPersonDetailsResponse {
pub person_view: PersonViewSafe,
pub comments: Vec<CommentView>,
pub moderates: Vec<CommunityModeratorView>,
}
-#[derive(Serialize)]
+#[derive(Serialize, Deserialize)]
pub struct GetRepliesResponse {
pub replies: Vec<CommentView>,
}
-#[derive(Serialize)]
+#[derive(Serialize, Deserialize)]
pub struct GetPersonMentionsResponse {
pub mentions: Vec<PersonMentionView>,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct MarkAllAsRead {
pub auth: String,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct AddAdmin {
pub person_id: PersonId,
pub added: bool,
pub auth: String,
}
-#[derive(Serialize, Clone)]
+#[derive(Serialize, Deserialize, Clone)]
pub struct AddAdminResponse {
pub admins: Vec<PersonViewSafe>,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct BanPerson {
pub person_id: PersonId,
pub ban: bool,
pub auth: String,
}
-#[derive(Serialize, Clone)]
+#[derive(Serialize, Deserialize, Clone)]
pub struct BanPersonResponse {
pub person_view: PersonViewSafe,
pub banned: bool,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct BlockPerson {
pub person_id: PersonId,
pub block: bool,
pub auth: String,
}
-#[derive(Serialize, Clone)]
+#[derive(Serialize, Deserialize, Clone)]
pub struct BlockPersonResponse {
pub person_view: PersonViewSafe,
pub blocked: bool,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct GetReplies {
pub sort: Option<String>,
pub page: Option<i64>,
pub auth: String,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct GetPersonMentions {
pub sort: Option<String>,
pub page: Option<i64>,
pub auth: String,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct MarkPersonMentionAsRead {
pub person_mention_id: PersonMentionId,
pub read: bool,
pub auth: String,
}
-#[derive(Serialize, Clone)]
+#[derive(Serialize, Deserialize, Clone)]
pub struct PersonMentionResponse {
pub person_mention_view: PersonMentionView,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct DeleteAccount {
pub password: String,
pub auth: String,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct PasswordReset {
pub email: String,
}
-#[derive(Serialize, Clone)]
+#[derive(Serialize, Deserialize, Clone)]
pub struct PasswordResetResponse {}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct PasswordChange {
pub token: String,
pub password: String,
pub password_verify: String,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct CreatePrivateMessage {
pub content: String,
pub recipient_id: PersonId,
pub auth: String,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct EditPrivateMessage {
pub private_message_id: PrivateMessageId,
pub content: String,
pub auth: String,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct DeletePrivateMessage {
pub private_message_id: PrivateMessageId,
pub deleted: bool,
pub auth: String,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct MarkPrivateMessageAsRead {
pub private_message_id: PrivateMessageId,
pub read: bool,
pub auth: String,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct GetPrivateMessages {
pub unread_only: Option<bool>,
pub page: Option<i64>,
pub auth: String,
}
-#[derive(Serialize, Clone)]
+#[derive(Serialize, Deserialize, Clone)]
pub struct PrivateMessagesResponse {
pub private_messages: Vec<PrivateMessageView>,
}
-#[derive(Serialize, Clone)]
+#[derive(Serialize, Deserialize, Clone)]
pub struct PrivateMessageResponse {
pub private_message_view: PrivateMessageView,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct GetReportCount {
pub community_id: Option<CommunityId>,
pub auth: String,
}
-#[derive(Serialize, Clone)]
+#[derive(Serialize, Deserialize, Clone)]
pub struct GetReportCountResponse {
pub community_id: Option<CommunityId>,
pub comment_reports: i64,
pub post_reports: i64,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct GetUnreadCount {
pub auth: String,
}
-#[derive(Serialize, Clone)]
+#[derive(Serialize, Deserialize, Clone)]
pub struct GetUnreadCountResponse {
pub replies: i64,
pub mentions: i64,
use serde::{Deserialize, Serialize};
use url::Url;
-#[derive(Deserialize, Debug)]
+#[derive(Serialize, Deserialize, Debug)]
pub struct CreatePost {
pub name: String,
pub community_id: CommunityId,
pub auth: String,
}
-#[derive(Serialize, Clone)]
+#[derive(Serialize, Deserialize, Clone)]
pub struct PostResponse {
pub post_view: PostView,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct GetPost {
pub id: PostId,
pub auth: Option<String>,
}
-#[derive(Serialize)]
+#[derive(Serialize, Deserialize)]
pub struct GetPostResponse {
pub post_view: PostView,
pub community_view: CommunityView,
pub online: usize,
}
-#[derive(Deserialize, Debug)]
+#[derive(Serialize, Deserialize, Debug)]
pub struct GetPosts {
pub type_: Option<String>,
pub sort: Option<String>,
pub auth: Option<String>,
}
-#[derive(Serialize, Debug)]
+#[derive(Serialize, Deserialize, Debug)]
pub struct GetPostsResponse {
pub posts: Vec<PostView>,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct CreatePostLike {
pub post_id: PostId,
pub score: i16,
pub auth: String,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct EditPost {
pub post_id: PostId,
pub name: Option<String>,
pub auth: String,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct DeletePost {
pub post_id: PostId,
pub deleted: bool,
pub auth: String,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct RemovePost {
pub post_id: PostId,
pub removed: bool,
pub auth: String,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct LockPost {
pub post_id: PostId,
pub locked: bool,
pub auth: String,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct StickyPost {
pub post_id: PostId,
pub stickied: bool,
pub auth: String,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct SavePost {
pub post_id: PostId,
pub save: bool,
pub auth: String,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct CreatePostReport {
pub post_id: PostId,
pub reason: String,
pub auth: String,
}
-#[derive(Serialize, Clone)]
+#[derive(Serialize, Deserialize, Clone)]
pub struct PostReportResponse {
pub post_report_view: PostReportView,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct ResolvePostReport {
pub report_id: PostReportId,
pub resolved: bool,
pub auth: String,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct ListPostReports {
pub page: Option<i64>,
pub limit: Option<i64>,
pub auth: String,
}
-#[derive(Serialize)]
+#[derive(Serialize, Deserialize)]
pub struct ListPostReportsResponse {
pub post_reports: Vec<PostReportView>,
}
-#[derive(Deserialize, Debug)]
+#[derive(Serialize, Deserialize, Debug)]
pub struct GetSiteMetadata {
pub url: Url,
}
-#[derive(Serialize, Clone, Debug)]
+#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct GetSiteMetadataResponse {
pub metadata: SiteMetadata,
}
};
use serde::{Deserialize, Serialize};
-#[derive(Deserialize, Debug)]
+#[derive(Serialize, Deserialize, Debug)]
pub struct Search {
pub q: String,
pub community_id: Option<CommunityId>,
pub auth: Option<String>,
}
-#[derive(Serialize, Debug)]
+#[derive(Serialize, Deserialize, Debug)]
pub struct SearchResponse {
pub type_: String,
pub comments: Vec<CommentView>,
pub users: Vec<PersonViewSafe>,
}
-#[derive(Deserialize, Debug)]
+#[derive(Serialize, Deserialize, Debug)]
pub struct ResolveObject {
pub q: String,
pub auth: Option<String>,
}
-#[derive(Serialize, Default)]
+#[derive(Serialize, Deserialize, Default)]
pub struct ResolveObjectResponse {
pub comment: Option<CommentView>,
pub post: Option<PostView>,
pub person: Option<PersonViewSafe>,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct GetModlog {
pub mod_person_id: Option<PersonId>,
pub community_id: Option<CommunityId>,
pub limit: Option<i64>,
}
-#[derive(Serialize)]
+#[derive(Serialize, Deserialize)]
pub struct GetModlogResponse {
pub removed_posts: Vec<ModRemovePostView>,
pub locked_posts: Vec<ModLockPostView>,
pub added: Vec<ModAddView>,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct CreateSite {
pub name: String,
pub sidebar: Option<String>,
pub auth: String,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct EditSite {
pub name: Option<String>,
pub sidebar: Option<String>,
pub auth: String,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct GetSite {
pub auth: Option<String>,
}
-#[derive(Serialize, Clone)]
+#[derive(Serialize, Deserialize, Clone)]
pub struct SiteResponse {
pub site_view: SiteView,
}
-#[derive(Serialize)]
+#[derive(Serialize, Deserialize)]
pub struct GetSiteResponse {
pub site_view: Option<SiteView>, // Because the site might not be set up yet
pub admins: Vec<PersonViewSafe>,
pub federated_instances: Option<FederatedInstances>, // Federation may be disabled
}
-#[derive(Serialize)]
+#[derive(Serialize, Deserialize)]
pub struct MyUserInfo {
pub local_user_view: LocalUserSettingsView,
pub follows: Vec<CommunityFollowerView>,
pub person_blocks: Vec<PersonBlockView>,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct TransferSite {
pub person_id: PersonId,
pub auth: String,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct GetSiteConfig {
pub auth: String,
}
-#[derive(Serialize)]
+#[derive(Serialize, Deserialize)]
pub struct GetSiteConfigResponse {
pub config_hjson: String,
}
-#[derive(Deserialize)]
+#[derive(Serialize, Deserialize)]
pub struct SaveSiteConfig {
pub config_hjson: String,
pub auth: String,
}
-#[derive(Serialize)]
+#[derive(Serialize, Deserialize)]
pub struct FederatedInstances {
pub linked: Vec<String>,
pub allowed: Option<Vec<String>>,
use lemmy_db_schema::{CommunityId, PostId};
use serde::{Deserialize, Serialize};
-#[derive(Deserialize, Debug)]
+#[derive(Serialize, Deserialize, Debug)]
pub struct UserJoin {
pub auth: String,
}
-#[derive(Serialize, Clone)]
+#[derive(Serialize, Deserialize, Clone)]
pub struct UserJoinResponse {
pub joined: bool,
}
-#[derive(Deserialize, Debug)]
+#[derive(Serialize, Deserialize, Debug)]
pub struct CommunityJoin {
pub community_id: CommunityId,
}
-#[derive(Serialize, Clone)]
+#[derive(Serialize, Deserialize, Clone)]
pub struct CommunityJoinResponse {
pub joined: bool,
}
-#[derive(Deserialize, Debug)]
+#[derive(Serialize, Deserialize, Debug)]
pub struct ModJoin {
pub community_id: CommunityId,
}
-#[derive(Serialize, Clone)]
+#[derive(Serialize, Deserialize, Clone)]
pub struct ModJoinResponse {
pub joined: bool,
}
-#[derive(Deserialize, Debug)]
+#[derive(Serialize, Deserialize, Debug)]
pub struct PostJoin {
pub post_id: PostId,
}
-#[derive(Serialize, Clone)]
+#[derive(Serialize, Deserialize, Clone)]
pub struct PostJoinResponse {
pub joined: bool,
}
use diesel::{result::Error, *};
use lemmy_db_schema::{schema::comment_aggregates, CommentId};
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
-#[derive(Queryable, Associations, Identifiable, PartialEq, Debug, Serialize, Clone)]
+#[derive(
+ Queryable, Associations, Identifiable, PartialEq, Debug, Serialize, Deserialize, Clone,
+)]
#[table_name = "comment_aggregates"]
pub struct CommentAggregates {
pub id: i32,
use diesel::{result::Error, *};
use lemmy_db_schema::{schema::community_aggregates, CommunityId};
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
-#[derive(Queryable, Associations, Identifiable, PartialEq, Debug, Serialize, Clone)]
+#[derive(
+ Queryable, Associations, Identifiable, PartialEq, Debug, Serialize, Deserialize, Clone,
+)]
#[table_name = "community_aggregates"]
pub struct CommunityAggregates {
pub id: i32,
use diesel::{result::Error, *};
use lemmy_db_schema::{schema::person_aggregates, PersonId};
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
-#[derive(Queryable, Associations, Identifiable, PartialEq, Debug, Serialize, Clone)]
+#[derive(
+ Queryable, Associations, Identifiable, PartialEq, Debug, Serialize, Deserialize, Clone,
+)]
#[table_name = "person_aggregates"]
pub struct PersonAggregates {
pub id: i32,
use diesel::{result::Error, *};
use lemmy_db_schema::{schema::post_aggregates, PostId};
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
-#[derive(Queryable, Associations, Identifiable, PartialEq, Debug, Serialize, Clone)]
+#[derive(
+ Queryable, Associations, Identifiable, PartialEq, Debug, Serialize, Deserialize, Clone,
+)]
#[table_name = "post_aggregates"]
pub struct PostAggregates {
pub id: i32,
use diesel::{result::Error, *};
use lemmy_db_schema::schema::site_aggregates;
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
-#[derive(Queryable, Associations, Identifiable, PartialEq, Debug, Serialize, Clone)]
+#[derive(
+ Queryable, Associations, Identifiable, PartialEq, Debug, Serialize, Deserialize, Clone,
+)]
#[table_name = "site_aggregates"]
pub struct SiteAggregates {
pub id: i32,
use diesel::{ExpressionMethods, PgConnection, QueryDsl, RunQueryDsl};
use lemmy_apub_lib::traits::ApubObject;
use lemmy_utils::LemmyError;
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
use url::Url;
// WITH RECURSIVE MyTree AS (
// )
// SELECT * FROM MyTree;
-#[derive(Clone, Queryable, Associations, Identifiable, PartialEq, Debug, Serialize)]
+#[derive(
+ Clone, Queryable, Associations, Identifiable, PartialEq, Debug, Serialize, Deserialize,
+)]
#[belongs_to(Post)]
#[table_name = "comment"]
pub struct Comment {
pub local: bool,
}
-#[derive(Clone, Queryable, Associations, Identifiable, PartialEq, Debug, Serialize)]
+#[derive(
+ Clone, Queryable, Associations, Identifiable, PartialEq, Debug, Serialize, Deserialize,
+)]
#[belongs_to(Post)]
#[table_name = "comment_alias_1"]
pub struct CommentAlias1 {
use diesel::{ExpressionMethods, PgConnection, QueryDsl, RunQueryDsl};
use lemmy_apub_lib::traits::{ActorType, ApubObject};
use lemmy_utils::LemmyError;
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
use url::Url;
-#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
+#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
#[table_name = "community"]
pub struct Community {
pub id: CommunityId,
}
/// A safe representation of community, without the sensitive info
-#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
+#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
#[table_name = "community"]
pub struct CommunitySafe {
pub id: CommunityId,
CommunityId,
PersonId,
};
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
-#[derive(Clone, Queryable, Associations, Identifiable, PartialEq, Debug, Serialize)]
+#[derive(
+ Clone, Queryable, Associations, Identifiable, PartialEq, Debug, Serialize, Deserialize,
+)]
#[table_name = "community_block"]
#[belongs_to(Community)]
pub struct CommunityBlock {
use crate::{schema::local_user, LocalUserId, PersonId};
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
-#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
+#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
#[table_name = "local_user"]
pub struct LocalUser {
pub id: LocalUserId,
}
/// A local user view that removes password encrypted
-#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
+#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
#[table_name = "local_user"]
pub struct LocalUserSettings {
pub id: LocalUserId,
PersonId,
PostId,
};
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
-#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
+#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
#[table_name = "mod_remove_post"]
pub struct ModRemovePost {
pub id: i32,
pub removed: Option<bool>,
}
-#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
+#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
#[table_name = "mod_lock_post"]
pub struct ModLockPost {
pub id: i32,
pub locked: Option<bool>,
}
-#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
+#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
#[table_name = "mod_sticky_post"]
pub struct ModStickyPost {
pub id: i32,
pub stickied: Option<bool>,
}
-#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
+#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
#[table_name = "mod_remove_comment"]
pub struct ModRemoveComment {
pub id: i32,
pub removed: Option<bool>,
}
-#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
+#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
#[table_name = "mod_remove_community"]
pub struct ModRemoveCommunity {
pub id: i32,
pub expires: Option<chrono::NaiveDateTime>,
}
-#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
+#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
#[table_name = "mod_ban_from_community"]
pub struct ModBanFromCommunity {
pub id: i32,
pub expires: Option<chrono::NaiveDateTime>,
}
-#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
+#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
#[table_name = "mod_ban"]
pub struct ModBan {
pub id: i32,
pub expires: Option<chrono::NaiveDateTime>,
}
-#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
+#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
#[table_name = "mod_add_community"]
pub struct ModAddCommunity {
pub id: i32,
pub removed: Option<bool>,
}
-#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
+#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
#[table_name = "mod_transfer_community"]
pub struct ModTransferCommunity {
pub id: i32,
pub removed: Option<bool>,
}
-#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
+#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
#[table_name = "mod_add"]
pub struct ModAdd {
pub id: i32,
use diesel::{ExpressionMethods, PgConnection, QueryDsl, RunQueryDsl};
use lemmy_apub_lib::traits::{ActorType, ApubObject};
use lemmy_utils::LemmyError;
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
use url::Url;
-#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
+#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
#[table_name = "person"]
pub struct Person {
pub id: PersonId,
}
/// A safe representation of person, without the sensitive info
-#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
+#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
#[table_name = "person"]
pub struct PersonSafe {
pub id: PersonId,
pub bot_account: bool,
}
-#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
+#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
#[table_name = "person_alias_1"]
pub struct PersonAlias1 {
pub id: PersonId,
pub bot_account: bool,
}
-#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
+#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
#[table_name = "person_alias_1"]
pub struct PersonSafeAlias1 {
pub id: PersonId,
pub bot_account: bool,
}
-#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
+#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
#[table_name = "person_alias_2"]
pub struct PersonAlias2 {
pub id: PersonId,
pub bot_account: bool,
}
-#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
+#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
#[table_name = "person_alias_1"]
pub struct PersonSafeAlias2 {
pub id: PersonId,
use crate::{schema::person_block, PersonBlockId, PersonId};
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
-#[derive(Clone, Queryable, Associations, Identifiable, PartialEq, Debug, Serialize)]
+#[derive(
+ Clone, Queryable, Associations, Identifiable, PartialEq, Debug, Serialize, Deserialize,
+)]
#[table_name = "person_block"]
pub struct PersonBlock {
pub id: PersonBlockId,
PersonId,
PersonMentionId,
};
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
-#[derive(Clone, Queryable, Associations, Identifiable, PartialEq, Debug, Serialize)]
+#[derive(
+ Clone, Queryable, Associations, Identifiable, PartialEq, Debug, Serialize, Deserialize,
+)]
#[belongs_to(Comment)]
#[table_name = "person_mention"]
pub struct PersonMention {
use diesel::{ExpressionMethods, PgConnection, QueryDsl, RunQueryDsl};
use lemmy_apub_lib::traits::ApubObject;
use lemmy_utils::LemmyError;
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
use url::Url;
-#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
+#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
#[table_name = "post"]
pub struct Post {
pub id: PostId,
use diesel::{ExpressionMethods, PgConnection, QueryDsl, RunQueryDsl};
use lemmy_apub_lib::traits::ApubObject;
use lemmy_utils::LemmyError;
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
use url::Url;
-#[derive(Clone, Queryable, Associations, Identifiable, PartialEq, Debug, Serialize)]
+#[derive(
+ Clone, Queryable, Associations, Identifiable, PartialEq, Debug, Serialize, Deserialize,
+)]
#[table_name = "private_message"]
pub struct PrivateMessage {
pub id: PrivateMessageId,
use crate::{schema::site, DbUrl, PersonId};
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
-#[derive(Queryable, Identifiable, PartialEq, Debug, Clone, Serialize)]
+#[derive(Queryable, Identifiable, PartialEq, Debug, Clone, Serialize, Deserialize)]
#[table_name = "site"]
pub struct Site {
pub id: i32,
CommunityId,
PersonId,
};
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
-#[derive(Debug, PartialEq, Serialize, Clone)]
+#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
pub struct CommentReportView {
pub comment_report: CommentReport,
pub comment: Comment,
PersonId,
PostId,
};
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
-#[derive(Debug, PartialEq, Serialize, Clone)]
+#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
pub struct CommentView {
pub comment: Comment,
pub creator: PersonSafe,
LocalUserId,
PersonId,
};
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
-#[derive(Debug, Serialize, Clone)]
+#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct LocalUserView {
pub local_user: LocalUser,
pub person: Person,
}
}
-#[derive(Debug, Serialize, Clone)]
+#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct LocalUserSettingsView {
pub local_user: LocalUserSettings,
pub person: PersonSafe,
PersonId,
PostReportId,
};
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
-#[derive(Debug, PartialEq, Serialize, Clone)]
+#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
pub struct PostReportView {
pub post_report: PostReport,
pub post: Post,
PostId,
};
use log::debug;
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
-#[derive(Debug, PartialEq, Serialize, Clone)]
+#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
pub struct PostView {
pub post: Post,
pub creator: PersonSafe,
PrivateMessageId,
};
use log::debug;
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
-#[derive(Debug, PartialEq, Serialize, Clone)]
+#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
pub struct PrivateMessageView {
pub private_message: PrivateMessage,
pub creator: PersonSafe,
site::Site,
},
};
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
-#[derive(Debug, Serialize, Clone)]
+#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct SiteView {
pub site: Site,
pub creator: PersonSafe,
},
PersonId,
};
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
-#[derive(Debug, Serialize, Clone)]
+#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct CommunityBlockView {
pub person: PersonSafe,
pub community: CommunitySafe,
CommunityId,
PersonId,
};
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
-#[derive(Debug, Serialize, Clone)]
+#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct CommunityFollowerView {
pub community: CommunitySafe,
pub follower: PersonSafe,
CommunityId,
PersonId,
};
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
-#[derive(Debug, Serialize, Clone)]
+#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct CommunityModeratorView {
pub community: CommunitySafe,
pub moderator: PersonSafe,
CommunityId,
PersonId,
};
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
-#[derive(Debug, Serialize, Clone)]
+#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct CommunityPersonBanView {
pub community: CommunitySafe,
pub person: PersonSafe,
CommunityId,
PersonId,
};
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
-#[derive(Debug, Serialize, Clone)]
+#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct CommunityView {
pub community: CommunitySafe,
pub subscribed: bool,
source::person::{Person, PersonAlias1, PersonSafe, PersonSafeAlias1},
PersonId,
};
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
-#[derive(Debug, Serialize, Clone)]
+#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct PersonBlockView {
pub person: PersonSafe,
pub target: PersonSafeAlias1,
PersonId,
PersonMentionId,
};
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
-#[derive(Debug, PartialEq, Serialize, Clone)]
+#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
pub struct PersonMentionView {
pub person_mention: PersonMention,
pub comment: Comment,
source::person::{Person, PersonSafe},
PersonId,
};
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
-#[derive(Debug, Serialize, Clone)]
+#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct PersonViewSafe {
pub person: PersonSafe,
pub counts: PersonAggregates,
CommunityId,
PersonId,
};
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
-#[derive(Debug, Serialize, Clone)]
+#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct ModAddCommunityView {
pub mod_add_community: ModAddCommunity,
pub moderator: PersonSafe,
},
PersonId,
};
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
-#[derive(Debug, Serialize, Clone)]
+#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct ModAddView {
pub mod_add: ModAdd,
pub moderator: PersonSafe,
CommunityId,
PersonId,
};
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
-#[derive(Debug, Serialize, Clone)]
+#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct ModBanFromCommunityView {
pub mod_ban_from_community: ModBanFromCommunity,
pub moderator: PersonSafe,
},
PersonId,
};
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
-#[derive(Debug, Serialize, Clone)]
+#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct ModBanView {
pub mod_ban: ModBan,
pub moderator: PersonSafe,
CommunityId,
PersonId,
};
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
-#[derive(Debug, Serialize, Clone)]
+#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct ModLockPostView {
pub mod_lock_post: ModLockPost,
pub moderator: PersonSafe,
CommunityId,
PersonId,
};
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
-#[derive(Debug, Serialize, Clone)]
+#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct ModRemoveCommentView {
pub mod_remove_comment: ModRemoveComment,
pub moderator: PersonSafe,
},
PersonId,
};
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
-#[derive(Debug, Serialize, Clone)]
+#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct ModRemoveCommunityView {
pub mod_remove_community: ModRemoveCommunity,
pub moderator: PersonSafe,
CommunityId,
PersonId,
};
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
-#[derive(Debug, Serialize, Clone)]
+#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct ModRemovePostView {
pub mod_remove_post: ModRemovePost,
pub moderator: PersonSafe,
CommunityId,
PersonId,
};
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
-#[derive(Debug, Serialize, Clone)]
+#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct ModStickyPostView {
pub mod_sticky_post: ModStickyPost,
pub moderator: PersonSafe,
CommunityId,
PersonId,
};
-use serde::Serialize;
+use serde::{Deserialize, Serialize};
-#[derive(Debug, Serialize, Clone)]
+#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct ModTransferCommunityView {
pub mod_transfer_community: ModTransferCommunity,
pub moderator: PersonSafe,