Remove unused derive macros
This commit is contained in:
parent
2dd453afdf
commit
7500d53fe6
25 changed files with 157 additions and 164 deletions
|
@ -1,7 +1,7 @@
|
||||||
use lemmy_db::comment_view::CommentView;
|
use lemmy_db::comment_view::CommentView;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct CreateComment {
|
pub struct CreateComment {
|
||||||
pub content: String,
|
pub content: String,
|
||||||
pub parent_id: Option<i32>,
|
pub parent_id: Option<i32>,
|
||||||
|
@ -10,7 +10,7 @@ pub struct CreateComment {
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct EditComment {
|
pub struct EditComment {
|
||||||
pub content: String,
|
pub content: String,
|
||||||
pub edit_id: i32,
|
pub edit_id: i32,
|
||||||
|
@ -18,14 +18,14 @@ pub struct EditComment {
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct DeleteComment {
|
pub struct DeleteComment {
|
||||||
pub edit_id: i32,
|
pub edit_id: i32,
|
||||||
pub deleted: bool,
|
pub deleted: bool,
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct RemoveComment {
|
pub struct RemoveComment {
|
||||||
pub edit_id: i32,
|
pub edit_id: i32,
|
||||||
pub removed: bool,
|
pub removed: bool,
|
||||||
|
@ -33,35 +33,35 @@ pub struct RemoveComment {
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct MarkCommentAsRead {
|
pub struct MarkCommentAsRead {
|
||||||
pub edit_id: i32,
|
pub edit_id: i32,
|
||||||
pub read: bool,
|
pub read: bool,
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct SaveComment {
|
pub struct SaveComment {
|
||||||
pub comment_id: i32,
|
pub comment_id: i32,
|
||||||
pub save: bool,
|
pub save: bool,
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone)]
|
#[derive(Serialize, Clone)]
|
||||||
pub struct CommentResponse {
|
pub struct CommentResponse {
|
||||||
pub comment: CommentView,
|
pub comment: CommentView,
|
||||||
pub recipient_ids: Vec<i32>,
|
pub recipient_ids: Vec<i32>,
|
||||||
pub form_id: Option<String>,
|
pub form_id: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct CreateCommentLike {
|
pub struct CreateCommentLike {
|
||||||
pub comment_id: i32,
|
pub comment_id: i32,
|
||||||
pub score: i16,
|
pub score: i16,
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct GetComments {
|
pub struct GetComments {
|
||||||
pub type_: String,
|
pub type_: String,
|
||||||
pub sort: String,
|
pub sort: String,
|
||||||
|
@ -71,7 +71,7 @@ pub struct GetComments {
|
||||||
pub auth: Option<String>,
|
pub auth: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize)]
|
||||||
pub struct GetCommentsResponse {
|
pub struct GetCommentsResponse {
|
||||||
pub comments: Vec<CommentView>,
|
pub comments: Vec<CommentView>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,21 +4,21 @@ use lemmy_db::{
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct GetCommunity {
|
pub struct GetCommunity {
|
||||||
pub id: Option<i32>,
|
pub id: Option<i32>,
|
||||||
pub name: Option<String>,
|
pub name: Option<String>,
|
||||||
pub auth: Option<String>,
|
pub auth: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize)]
|
||||||
pub struct GetCommunityResponse {
|
pub struct GetCommunityResponse {
|
||||||
pub community: CommunityView,
|
pub community: CommunityView,
|
||||||
pub moderators: Vec<CommunityModeratorView>,
|
pub moderators: Vec<CommunityModeratorView>,
|
||||||
pub online: usize,
|
pub online: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct CreateCommunity {
|
pub struct CreateCommunity {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub title: String,
|
pub title: String,
|
||||||
|
@ -30,12 +30,12 @@ pub struct CreateCommunity {
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone)]
|
#[derive(Serialize, Clone)]
|
||||||
pub struct CommunityResponse {
|
pub struct CommunityResponse {
|
||||||
pub community: CommunityView,
|
pub community: CommunityView,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Deserialize, Debug)]
|
||||||
pub struct ListCommunities {
|
pub struct ListCommunities {
|
||||||
pub sort: String,
|
pub sort: String,
|
||||||
pub page: Option<i64>,
|
pub page: Option<i64>,
|
||||||
|
@ -43,12 +43,12 @@ pub struct ListCommunities {
|
||||||
pub auth: Option<String>,
|
pub auth: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Debug)]
|
||||||
pub struct ListCommunitiesResponse {
|
pub struct ListCommunitiesResponse {
|
||||||
pub communities: Vec<CommunityView>,
|
pub communities: Vec<CommunityView>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone)]
|
#[derive(Deserialize, Clone)]
|
||||||
pub struct BanFromCommunity {
|
pub struct BanFromCommunity {
|
||||||
pub community_id: i32,
|
pub community_id: i32,
|
||||||
pub user_id: i32,
|
pub user_id: i32,
|
||||||
|
@ -59,13 +59,13 @@ pub struct BanFromCommunity {
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone)]
|
#[derive(Serialize, Clone)]
|
||||||
pub struct BanFromCommunityResponse {
|
pub struct BanFromCommunityResponse {
|
||||||
pub user: UserView,
|
pub user: UserView,
|
||||||
pub banned: bool,
|
pub banned: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct AddModToCommunity {
|
pub struct AddModToCommunity {
|
||||||
pub community_id: i32,
|
pub community_id: i32,
|
||||||
pub user_id: i32,
|
pub user_id: i32,
|
||||||
|
@ -73,12 +73,12 @@ pub struct AddModToCommunity {
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone)]
|
#[derive(Serialize, Clone)]
|
||||||
pub struct AddModToCommunityResponse {
|
pub struct AddModToCommunityResponse {
|
||||||
pub moderators: Vec<CommunityModeratorView>,
|
pub moderators: Vec<CommunityModeratorView>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct EditCommunity {
|
pub struct EditCommunity {
|
||||||
pub edit_id: i32,
|
pub edit_id: i32,
|
||||||
pub title: String,
|
pub title: String,
|
||||||
|
@ -90,14 +90,14 @@ pub struct EditCommunity {
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct DeleteCommunity {
|
pub struct DeleteCommunity {
|
||||||
pub edit_id: i32,
|
pub edit_id: i32,
|
||||||
pub deleted: bool,
|
pub deleted: bool,
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct RemoveCommunity {
|
pub struct RemoveCommunity {
|
||||||
pub edit_id: i32,
|
pub edit_id: i32,
|
||||||
pub removed: bool,
|
pub removed: bool,
|
||||||
|
@ -106,24 +106,24 @@ pub struct RemoveCommunity {
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct FollowCommunity {
|
pub struct FollowCommunity {
|
||||||
pub community_id: i32,
|
pub community_id: i32,
|
||||||
pub follow: bool,
|
pub follow: bool,
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct GetFollowedCommunities {
|
pub struct GetFollowedCommunities {
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize)]
|
||||||
pub struct GetFollowedCommunitiesResponse {
|
pub struct GetFollowedCommunitiesResponse {
|
||||||
pub communities: Vec<CommunityFollowerView>,
|
pub communities: Vec<CommunityFollowerView>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct TransferCommunity {
|
pub struct TransferCommunity {
|
||||||
pub community_id: i32,
|
pub community_id: i32,
|
||||||
pub user_id: i32,
|
pub user_id: i32,
|
||||||
|
|
|
@ -5,7 +5,7 @@ use lemmy_db::{
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Deserialize, Debug)]
|
||||||
pub struct CreatePost {
|
pub struct CreatePost {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub url: Option<String>,
|
pub url: Option<String>,
|
||||||
|
@ -15,18 +15,18 @@ pub struct CreatePost {
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone)]
|
#[derive(Serialize, Clone)]
|
||||||
pub struct PostResponse {
|
pub struct PostResponse {
|
||||||
pub post: PostView,
|
pub post: PostView,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct GetPost {
|
pub struct GetPost {
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
pub auth: Option<String>,
|
pub auth: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize)]
|
||||||
pub struct GetPostResponse {
|
pub struct GetPostResponse {
|
||||||
pub post: PostView,
|
pub post: PostView,
|
||||||
pub comments: Vec<CommentView>,
|
pub comments: Vec<CommentView>,
|
||||||
|
@ -35,7 +35,7 @@ pub struct GetPostResponse {
|
||||||
pub online: usize,
|
pub online: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Deserialize, Debug)]
|
||||||
pub struct GetPosts {
|
pub struct GetPosts {
|
||||||
pub type_: String,
|
pub type_: String,
|
||||||
pub sort: String,
|
pub sort: String,
|
||||||
|
@ -46,19 +46,19 @@ pub struct GetPosts {
|
||||||
pub auth: Option<String>,
|
pub auth: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Debug)]
|
||||||
pub struct GetPostsResponse {
|
pub struct GetPostsResponse {
|
||||||
pub posts: Vec<PostView>,
|
pub posts: Vec<PostView>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct CreatePostLike {
|
pub struct CreatePostLike {
|
||||||
pub post_id: i32,
|
pub post_id: i32,
|
||||||
pub score: i16,
|
pub score: i16,
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct EditPost {
|
pub struct EditPost {
|
||||||
pub edit_id: i32,
|
pub edit_id: i32,
|
||||||
pub name: String,
|
pub name: String,
|
||||||
|
@ -68,14 +68,14 @@ pub struct EditPost {
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct DeletePost {
|
pub struct DeletePost {
|
||||||
pub edit_id: i32,
|
pub edit_id: i32,
|
||||||
pub deleted: bool,
|
pub deleted: bool,
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct RemovePost {
|
pub struct RemovePost {
|
||||||
pub edit_id: i32,
|
pub edit_id: i32,
|
||||||
pub removed: bool,
|
pub removed: bool,
|
||||||
|
@ -83,21 +83,21 @@ pub struct RemovePost {
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct LockPost {
|
pub struct LockPost {
|
||||||
pub edit_id: i32,
|
pub edit_id: i32,
|
||||||
pub locked: bool,
|
pub locked: bool,
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct StickyPost {
|
pub struct StickyPost {
|
||||||
pub edit_id: i32,
|
pub edit_id: i32,
|
||||||
pub stickied: bool,
|
pub stickied: bool,
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct SavePost {
|
pub struct SavePost {
|
||||||
pub post_id: i32,
|
pub post_id: i32,
|
||||||
pub save: bool,
|
pub save: bool,
|
||||||
|
|
|
@ -10,15 +10,15 @@ use lemmy_db::{
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct ListCategories {}
|
pub struct ListCategories {}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize)]
|
||||||
pub struct ListCategoriesResponse {
|
pub struct ListCategoriesResponse {
|
||||||
pub categories: Vec<Category>,
|
pub categories: Vec<Category>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Deserialize, Debug)]
|
||||||
pub struct Search {
|
pub struct Search {
|
||||||
pub q: String,
|
pub q: String,
|
||||||
pub type_: String,
|
pub type_: String,
|
||||||
|
@ -29,7 +29,7 @@ pub struct Search {
|
||||||
pub auth: Option<String>,
|
pub auth: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Debug)]
|
||||||
pub struct SearchResponse {
|
pub struct SearchResponse {
|
||||||
pub type_: String,
|
pub type_: String,
|
||||||
pub comments: Vec<CommentView>,
|
pub comments: Vec<CommentView>,
|
||||||
|
@ -38,7 +38,7 @@ pub struct SearchResponse {
|
||||||
pub users: Vec<UserView>,
|
pub users: Vec<UserView>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct GetModlog {
|
pub struct GetModlog {
|
||||||
pub mod_user_id: Option<i32>,
|
pub mod_user_id: Option<i32>,
|
||||||
pub community_id: Option<i32>,
|
pub community_id: Option<i32>,
|
||||||
|
@ -46,7 +46,7 @@ pub struct GetModlog {
|
||||||
pub limit: Option<i64>,
|
pub limit: Option<i64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize)]
|
||||||
pub struct GetModlogResponse {
|
pub struct GetModlogResponse {
|
||||||
pub removed_posts: Vec<ModRemovePostView>,
|
pub removed_posts: Vec<ModRemovePostView>,
|
||||||
pub locked_posts: Vec<ModLockPostView>,
|
pub locked_posts: Vec<ModLockPostView>,
|
||||||
|
@ -59,7 +59,7 @@ pub struct GetModlogResponse {
|
||||||
pub added: Vec<ModAddView>,
|
pub added: Vec<ModAddView>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct CreateSite {
|
pub struct CreateSite {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub description: Option<String>,
|
pub description: Option<String>,
|
||||||
|
@ -71,7 +71,7 @@ pub struct CreateSite {
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct EditSite {
|
pub struct EditSite {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub description: Option<String>,
|
pub description: Option<String>,
|
||||||
|
@ -83,17 +83,17 @@ pub struct EditSite {
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct GetSite {
|
pub struct GetSite {
|
||||||
pub auth: Option<String>,
|
pub auth: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone)]
|
#[derive(Serialize, Clone)]
|
||||||
pub struct SiteResponse {
|
pub struct SiteResponse {
|
||||||
pub site: SiteView,
|
pub site: SiteView,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize)]
|
||||||
pub struct GetSiteResponse {
|
pub struct GetSiteResponse {
|
||||||
pub site: Option<SiteView>,
|
pub site: Option<SiteView>,
|
||||||
pub admins: Vec<UserView>,
|
pub admins: Vec<UserView>,
|
||||||
|
@ -104,23 +104,23 @@ pub struct GetSiteResponse {
|
||||||
pub federated_instances: Vec<String>,
|
pub federated_instances: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct TransferSite {
|
pub struct TransferSite {
|
||||||
pub user_id: i32,
|
pub user_id: i32,
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct GetSiteConfig {
|
pub struct GetSiteConfig {
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize)]
|
||||||
pub struct GetSiteConfigResponse {
|
pub struct GetSiteConfigResponse {
|
||||||
pub config_hjson: String,
|
pub config_hjson: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct SaveSiteConfig {
|
pub struct SaveSiteConfig {
|
||||||
pub config_hjson: String,
|
pub config_hjson: String,
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
|
|
|
@ -8,13 +8,13 @@ use lemmy_db::{
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Deserialize, Debug)]
|
||||||
pub struct Login {
|
pub struct Login {
|
||||||
pub username_or_email: String,
|
pub username_or_email: String,
|
||||||
pub password: String,
|
pub password: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct Register {
|
pub struct Register {
|
||||||
pub username: String,
|
pub username: String,
|
||||||
pub email: Option<String>,
|
pub email: Option<String>,
|
||||||
|
@ -26,22 +26,22 @@ pub struct Register {
|
||||||
pub captcha_answer: Option<String>,
|
pub captcha_answer: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct GetCaptcha {}
|
pub struct GetCaptcha {}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize)]
|
||||||
pub struct GetCaptchaResponse {
|
pub struct GetCaptchaResponse {
|
||||||
pub ok: Option<CaptchaResponse>,
|
pub ok: Option<CaptchaResponse>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize)]
|
||||||
pub struct CaptchaResponse {
|
pub struct CaptchaResponse {
|
||||||
pub png: String, // A Base64 encoded png
|
pub png: String, // A Base64 encoded png
|
||||||
pub wav: Option<String>, // A Base64 encoded wav audio
|
pub wav: Option<String>, // A Base64 encoded wav audio
|
||||||
pub uuid: String,
|
pub uuid: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct SaveUserSettings {
|
pub struct SaveUserSettings {
|
||||||
pub show_nsfw: bool,
|
pub show_nsfw: bool,
|
||||||
pub theme: String,
|
pub theme: String,
|
||||||
|
@ -62,12 +62,12 @@ pub struct SaveUserSettings {
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize)]
|
||||||
pub struct LoginResponse {
|
pub struct LoginResponse {
|
||||||
pub jwt: String,
|
pub jwt: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct GetUserDetails {
|
pub struct GetUserDetails {
|
||||||
pub user_id: Option<i32>,
|
pub user_id: Option<i32>,
|
||||||
pub username: Option<String>,
|
pub username: Option<String>,
|
||||||
|
@ -79,7 +79,7 @@ pub struct GetUserDetails {
|
||||||
pub auth: Option<String>,
|
pub auth: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize)]
|
||||||
pub struct GetUserDetailsResponse {
|
pub struct GetUserDetailsResponse {
|
||||||
pub user: UserView,
|
pub user: UserView,
|
||||||
pub follows: Vec<CommunityFollowerView>,
|
pub follows: Vec<CommunityFollowerView>,
|
||||||
|
@ -88,34 +88,34 @@ pub struct GetUserDetailsResponse {
|
||||||
pub posts: Vec<PostView>,
|
pub posts: Vec<PostView>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize)]
|
||||||
pub struct GetRepliesResponse {
|
pub struct GetRepliesResponse {
|
||||||
pub replies: Vec<ReplyView>,
|
pub replies: Vec<ReplyView>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize)]
|
||||||
pub struct GetUserMentionsResponse {
|
pub struct GetUserMentionsResponse {
|
||||||
pub mentions: Vec<UserMentionView>,
|
pub mentions: Vec<UserMentionView>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct MarkAllAsRead {
|
pub struct MarkAllAsRead {
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct AddAdmin {
|
pub struct AddAdmin {
|
||||||
pub user_id: i32,
|
pub user_id: i32,
|
||||||
pub added: bool,
|
pub added: bool,
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone)]
|
#[derive(Serialize, Clone)]
|
||||||
pub struct AddAdminResponse {
|
pub struct AddAdminResponse {
|
||||||
pub admins: Vec<UserView>,
|
pub admins: Vec<UserView>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct BanUser {
|
pub struct BanUser {
|
||||||
pub user_id: i32,
|
pub user_id: i32,
|
||||||
pub ban: bool,
|
pub ban: bool,
|
||||||
|
@ -125,13 +125,13 @@ pub struct BanUser {
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone)]
|
#[derive(Serialize, Clone)]
|
||||||
pub struct BanUserResponse {
|
pub struct BanUserResponse {
|
||||||
pub user: UserView,
|
pub user: UserView,
|
||||||
pub banned: bool,
|
pub banned: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct GetReplies {
|
pub struct GetReplies {
|
||||||
pub sort: String,
|
pub sort: String,
|
||||||
pub page: Option<i64>,
|
pub page: Option<i64>,
|
||||||
|
@ -140,7 +140,7 @@ pub struct GetReplies {
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct GetUserMentions {
|
pub struct GetUserMentions {
|
||||||
pub sort: String,
|
pub sort: String,
|
||||||
pub page: Option<i64>,
|
pub page: Option<i64>,
|
||||||
|
@ -149,68 +149,68 @@ pub struct GetUserMentions {
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct MarkUserMentionAsRead {
|
pub struct MarkUserMentionAsRead {
|
||||||
pub user_mention_id: i32,
|
pub user_mention_id: i32,
|
||||||
pub read: bool,
|
pub read: bool,
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone)]
|
#[derive(Serialize, Clone)]
|
||||||
pub struct UserMentionResponse {
|
pub struct UserMentionResponse {
|
||||||
pub mention: UserMentionView,
|
pub mention: UserMentionView,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct DeleteAccount {
|
pub struct DeleteAccount {
|
||||||
pub password: String,
|
pub password: String,
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct PasswordReset {
|
pub struct PasswordReset {
|
||||||
pub email: String,
|
pub email: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone)]
|
#[derive(Serialize, Clone)]
|
||||||
pub struct PasswordResetResponse {}
|
pub struct PasswordResetResponse {}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct PasswordChange {
|
pub struct PasswordChange {
|
||||||
pub token: String,
|
pub token: String,
|
||||||
pub password: String,
|
pub password: String,
|
||||||
pub password_verify: String,
|
pub password_verify: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct CreatePrivateMessage {
|
pub struct CreatePrivateMessage {
|
||||||
pub content: String,
|
pub content: String,
|
||||||
pub recipient_id: i32,
|
pub recipient_id: i32,
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct EditPrivateMessage {
|
pub struct EditPrivateMessage {
|
||||||
pub edit_id: i32,
|
pub edit_id: i32,
|
||||||
pub content: String,
|
pub content: String,
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct DeletePrivateMessage {
|
pub struct DeletePrivateMessage {
|
||||||
pub edit_id: i32,
|
pub edit_id: i32,
|
||||||
pub deleted: bool,
|
pub deleted: bool,
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct MarkPrivateMessageAsRead {
|
pub struct MarkPrivateMessageAsRead {
|
||||||
pub edit_id: i32,
|
pub edit_id: i32,
|
||||||
pub read: bool,
|
pub read: bool,
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct GetPrivateMessages {
|
pub struct GetPrivateMessages {
|
||||||
pub unread_only: bool,
|
pub unread_only: bool,
|
||||||
pub page: Option<i64>,
|
pub page: Option<i64>,
|
||||||
|
@ -218,22 +218,22 @@ pub struct GetPrivateMessages {
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone)]
|
#[derive(Serialize, Clone)]
|
||||||
pub struct PrivateMessagesResponse {
|
pub struct PrivateMessagesResponse {
|
||||||
pub messages: Vec<PrivateMessageView>,
|
pub messages: Vec<PrivateMessageView>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone)]
|
#[derive(Serialize, Clone)]
|
||||||
pub struct PrivateMessageResponse {
|
pub struct PrivateMessageResponse {
|
||||||
pub message: PrivateMessageView,
|
pub message: PrivateMessageView,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Deserialize, Debug)]
|
||||||
pub struct UserJoin {
|
pub struct UserJoin {
|
||||||
pub auth: String,
|
pub auth: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone)]
|
#[derive(Serialize, Clone)]
|
||||||
pub struct UserJoinResponse {
|
pub struct UserJoinResponse {
|
||||||
pub user_id: i32,
|
pub user_id: i32,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
use crate::{schema::activity, Crud};
|
use crate::{schema::activity, Crud};
|
||||||
use diesel::{dsl::*, result::Error, *};
|
use diesel::{dsl::*, result::Error, *};
|
||||||
use log::debug;
|
use log::debug;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Serialize};
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
use std::{
|
use std::{
|
||||||
fmt::Debug,
|
fmt::Debug,
|
||||||
io::{Error as IoError, ErrorKind},
|
io::{Error as IoError, ErrorKind},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
|
#[derive(Queryable, Identifiable, PartialEq, Debug)]
|
||||||
#[table_name = "activity"]
|
#[table_name = "activity"]
|
||||||
pub struct Activity {
|
pub struct Activity {
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
|
@ -19,7 +19,7 @@ pub struct Activity {
|
||||||
pub updated: Option<chrono::NaiveDateTime>,
|
pub updated: Option<chrono::NaiveDateTime>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Insertable, AsChangeset, Clone, Serialize, Deserialize)]
|
#[derive(Insertable, AsChangeset)]
|
||||||
#[table_name = "activity"]
|
#[table_name = "activity"]
|
||||||
pub struct ActivityForm {
|
pub struct ActivityForm {
|
||||||
pub user_id: i32,
|
pub user_id: i32,
|
||||||
|
|
|
@ -3,16 +3,16 @@ use crate::{
|
||||||
Crud,
|
Crud,
|
||||||
};
|
};
|
||||||
use diesel::{dsl::*, result::Error, *};
|
use diesel::{dsl::*, result::Error, *};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Serialize};
|
||||||
|
|
||||||
#[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
|
#[derive(Queryable, Identifiable, PartialEq, Debug, Serialize)]
|
||||||
#[table_name = "category"]
|
#[table_name = "category"]
|
||||||
pub struct Category {
|
pub struct Category {
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
pub name: String,
|
pub name: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Insertable, AsChangeset, Clone, Serialize, Deserialize)]
|
#[derive(Insertable, AsChangeset)]
|
||||||
#[table_name = "category"]
|
#[table_name = "category"]
|
||||||
pub struct CategoryForm {
|
pub struct CategoryForm {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
|
|
|
@ -7,7 +7,6 @@ use crate::{
|
||||||
Saveable,
|
Saveable,
|
||||||
};
|
};
|
||||||
use diesel::{dsl::*, result::Error, *};
|
use diesel::{dsl::*, result::Error, *};
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
use url::{ParseError, Url};
|
use url::{ParseError, Url};
|
||||||
|
|
||||||
// WITH RECURSIVE MyTree AS (
|
// WITH RECURSIVE MyTree AS (
|
||||||
|
@ -17,7 +16,7 @@ use url::{ParseError, Url};
|
||||||
// )
|
// )
|
||||||
// SELECT * FROM MyTree;
|
// SELECT * FROM MyTree;
|
||||||
|
|
||||||
#[derive(Clone, Queryable, Associations, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Queryable, Associations, Identifiable, PartialEq, Debug)]
|
||||||
#[belongs_to(Post)]
|
#[belongs_to(Post)]
|
||||||
#[table_name = "comment"]
|
#[table_name = "comment"]
|
||||||
pub struct Comment {
|
pub struct Comment {
|
||||||
|
@ -230,7 +229,7 @@ pub struct CommentSaved {
|
||||||
pub published: chrono::NaiveDateTime,
|
pub published: chrono::NaiveDateTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Insertable, AsChangeset, Clone)]
|
#[derive(Insertable, AsChangeset)]
|
||||||
#[table_name = "comment_saved"]
|
#[table_name = "comment_saved"]
|
||||||
pub struct CommentSavedForm {
|
pub struct CommentSavedForm {
|
||||||
pub comment_id: i32,
|
pub comment_id: i32,
|
||||||
|
|
|
@ -85,7 +85,7 @@ table! {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize, QueryableByName, Clone,
|
Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone,
|
||||||
)]
|
)]
|
||||||
#[table_name = "comment_fast_view"]
|
#[table_name = "comment_fast_view"]
|
||||||
pub struct CommentView {
|
pub struct CommentView {
|
||||||
|
|
|
@ -7,9 +7,8 @@ use crate::{
|
||||||
Joinable,
|
Joinable,
|
||||||
};
|
};
|
||||||
use diesel::{dsl::*, result::Error, *};
|
use diesel::{dsl::*, result::Error, *};
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Queryable, Identifiable, PartialEq, Debug)]
|
||||||
#[table_name = "community"]
|
#[table_name = "community"]
|
||||||
pub struct Community {
|
pub struct Community {
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
|
@ -32,7 +31,7 @@ pub struct Community {
|
||||||
pub banner: Option<String>,
|
pub banner: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Insertable, AsChangeset, Clone, Serialize, Deserialize, Debug)]
|
#[derive(Insertable, AsChangeset, Debug)]
|
||||||
#[table_name = "community"]
|
#[table_name = "community"]
|
||||||
pub struct CommunityForm {
|
pub struct CommunityForm {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
|
|
|
@ -124,7 +124,7 @@ table! {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize, QueryableByName, Clone,
|
Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone,
|
||||||
)]
|
)]
|
||||||
#[table_name = "community_fast_view"]
|
#[table_name = "community_fast_view"]
|
||||||
pub struct CommunityView {
|
pub struct CommunityView {
|
||||||
|
|
|
@ -13,9 +13,8 @@ use crate::{
|
||||||
Crud,
|
Crud,
|
||||||
};
|
};
|
||||||
use diesel::{dsl::*, result::Error, *};
|
use diesel::{dsl::*, result::Error, *};
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
#[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
|
#[derive(Queryable, Identifiable, PartialEq, Debug)]
|
||||||
#[table_name = "mod_remove_post"]
|
#[table_name = "mod_remove_post"]
|
||||||
pub struct ModRemovePost {
|
pub struct ModRemovePost {
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
|
@ -26,7 +25,7 @@ pub struct ModRemovePost {
|
||||||
pub when_: chrono::NaiveDateTime,
|
pub when_: chrono::NaiveDateTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Insertable, AsChangeset, Clone, Serialize, Deserialize)]
|
#[derive(Insertable, AsChangeset)]
|
||||||
#[table_name = "mod_remove_post"]
|
#[table_name = "mod_remove_post"]
|
||||||
pub struct ModRemovePostForm {
|
pub struct ModRemovePostForm {
|
||||||
pub mod_user_id: i32,
|
pub mod_user_id: i32,
|
||||||
|
@ -56,7 +55,7 @@ impl Crud<ModRemovePostForm> for ModRemovePost {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
|
#[derive(Queryable, Identifiable, PartialEq, Debug)]
|
||||||
#[table_name = "mod_lock_post"]
|
#[table_name = "mod_lock_post"]
|
||||||
pub struct ModLockPost {
|
pub struct ModLockPost {
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
|
@ -66,7 +65,7 @@ pub struct ModLockPost {
|
||||||
pub when_: chrono::NaiveDateTime,
|
pub when_: chrono::NaiveDateTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Insertable, AsChangeset, Clone, Serialize, Deserialize)]
|
#[derive(Insertable, AsChangeset)]
|
||||||
#[table_name = "mod_lock_post"]
|
#[table_name = "mod_lock_post"]
|
||||||
pub struct ModLockPostForm {
|
pub struct ModLockPostForm {
|
||||||
pub mod_user_id: i32,
|
pub mod_user_id: i32,
|
||||||
|
@ -95,7 +94,7 @@ impl Crud<ModLockPostForm> for ModLockPost {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
|
#[derive(Queryable, Identifiable, PartialEq, Debug)]
|
||||||
#[table_name = "mod_sticky_post"]
|
#[table_name = "mod_sticky_post"]
|
||||||
pub struct ModStickyPost {
|
pub struct ModStickyPost {
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
|
@ -105,7 +104,7 @@ pub struct ModStickyPost {
|
||||||
pub when_: chrono::NaiveDateTime,
|
pub when_: chrono::NaiveDateTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Insertable, AsChangeset, Clone, Serialize, Deserialize)]
|
#[derive(Insertable, AsChangeset)]
|
||||||
#[table_name = "mod_sticky_post"]
|
#[table_name = "mod_sticky_post"]
|
||||||
pub struct ModStickyPostForm {
|
pub struct ModStickyPostForm {
|
||||||
pub mod_user_id: i32,
|
pub mod_user_id: i32,
|
||||||
|
@ -134,7 +133,7 @@ impl Crud<ModStickyPostForm> for ModStickyPost {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
|
#[derive(Queryable, Identifiable, PartialEq, Debug)]
|
||||||
#[table_name = "mod_remove_comment"]
|
#[table_name = "mod_remove_comment"]
|
||||||
pub struct ModRemoveComment {
|
pub struct ModRemoveComment {
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
|
@ -145,7 +144,7 @@ pub struct ModRemoveComment {
|
||||||
pub when_: chrono::NaiveDateTime,
|
pub when_: chrono::NaiveDateTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Insertable, AsChangeset, Clone, Serialize, Deserialize)]
|
#[derive(Insertable, AsChangeset)]
|
||||||
#[table_name = "mod_remove_comment"]
|
#[table_name = "mod_remove_comment"]
|
||||||
pub struct ModRemoveCommentForm {
|
pub struct ModRemoveCommentForm {
|
||||||
pub mod_user_id: i32,
|
pub mod_user_id: i32,
|
||||||
|
@ -175,7 +174,7 @@ impl Crud<ModRemoveCommentForm> for ModRemoveComment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
|
#[derive(Queryable, Identifiable, PartialEq, Debug)]
|
||||||
#[table_name = "mod_remove_community"]
|
#[table_name = "mod_remove_community"]
|
||||||
pub struct ModRemoveCommunity {
|
pub struct ModRemoveCommunity {
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
|
@ -187,7 +186,7 @@ pub struct ModRemoveCommunity {
|
||||||
pub when_: chrono::NaiveDateTime,
|
pub when_: chrono::NaiveDateTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Insertable, AsChangeset, Clone, Serialize, Deserialize)]
|
#[derive(Insertable, AsChangeset)]
|
||||||
#[table_name = "mod_remove_community"]
|
#[table_name = "mod_remove_community"]
|
||||||
pub struct ModRemoveCommunityForm {
|
pub struct ModRemoveCommunityForm {
|
||||||
pub mod_user_id: i32,
|
pub mod_user_id: i32,
|
||||||
|
@ -222,7 +221,7 @@ impl Crud<ModRemoveCommunityForm> for ModRemoveCommunity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
|
#[derive(Queryable, Identifiable, PartialEq, Debug)]
|
||||||
#[table_name = "mod_ban_from_community"]
|
#[table_name = "mod_ban_from_community"]
|
||||||
pub struct ModBanFromCommunity {
|
pub struct ModBanFromCommunity {
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
|
@ -235,7 +234,7 @@ pub struct ModBanFromCommunity {
|
||||||
pub when_: chrono::NaiveDateTime,
|
pub when_: chrono::NaiveDateTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Insertable, AsChangeset, Clone, Serialize, Deserialize)]
|
#[derive(Insertable, AsChangeset)]
|
||||||
#[table_name = "mod_ban_from_community"]
|
#[table_name = "mod_ban_from_community"]
|
||||||
pub struct ModBanFromCommunityForm {
|
pub struct ModBanFromCommunityForm {
|
||||||
pub mod_user_id: i32,
|
pub mod_user_id: i32,
|
||||||
|
@ -271,7 +270,7 @@ impl Crud<ModBanFromCommunityForm> for ModBanFromCommunity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
|
#[derive(Queryable, Identifiable, PartialEq, Debug)]
|
||||||
#[table_name = "mod_ban"]
|
#[table_name = "mod_ban"]
|
||||||
pub struct ModBan {
|
pub struct ModBan {
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
|
@ -283,7 +282,7 @@ pub struct ModBan {
|
||||||
pub when_: chrono::NaiveDateTime,
|
pub when_: chrono::NaiveDateTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Insertable, AsChangeset, Clone, Serialize, Deserialize)]
|
#[derive(Insertable, AsChangeset)]
|
||||||
#[table_name = "mod_ban"]
|
#[table_name = "mod_ban"]
|
||||||
pub struct ModBanForm {
|
pub struct ModBanForm {
|
||||||
pub mod_user_id: i32,
|
pub mod_user_id: i32,
|
||||||
|
@ -312,7 +311,7 @@ impl Crud<ModBanForm> for ModBan {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
|
#[derive(Queryable, Identifiable, PartialEq, Debug)]
|
||||||
#[table_name = "mod_add_community"]
|
#[table_name = "mod_add_community"]
|
||||||
pub struct ModAddCommunity {
|
pub struct ModAddCommunity {
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
|
@ -323,7 +322,7 @@ pub struct ModAddCommunity {
|
||||||
pub when_: chrono::NaiveDateTime,
|
pub when_: chrono::NaiveDateTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Insertable, AsChangeset, Clone, Serialize, Deserialize)]
|
#[derive(Insertable, AsChangeset)]
|
||||||
#[table_name = "mod_add_community"]
|
#[table_name = "mod_add_community"]
|
||||||
pub struct ModAddCommunityForm {
|
pub struct ModAddCommunityForm {
|
||||||
pub mod_user_id: i32,
|
pub mod_user_id: i32,
|
||||||
|
@ -353,7 +352,7 @@ impl Crud<ModAddCommunityForm> for ModAddCommunity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
|
#[derive(Queryable, Identifiable, PartialEq, Debug)]
|
||||||
#[table_name = "mod_add"]
|
#[table_name = "mod_add"]
|
||||||
pub struct ModAdd {
|
pub struct ModAdd {
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
|
@ -363,7 +362,7 @@ pub struct ModAdd {
|
||||||
pub when_: chrono::NaiveDateTime,
|
pub when_: chrono::NaiveDateTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Insertable, AsChangeset, Clone, Serialize, Deserialize)]
|
#[derive(Insertable, AsChangeset)]
|
||||||
#[table_name = "mod_add"]
|
#[table_name = "mod_add"]
|
||||||
pub struct ModAddForm {
|
pub struct ModAddForm {
|
||||||
pub mod_user_id: i32,
|
pub mod_user_id: i32,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::limit_and_offset;
|
use crate::limit_and_offset;
|
||||||
use diesel::{result::Error, *};
|
use diesel::{result::Error, *};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Serialize};
|
||||||
|
|
||||||
table! {
|
table! {
|
||||||
mod_remove_post_view (id) {
|
mod_remove_post_view (id) {
|
||||||
|
@ -18,7 +18,7 @@ table! {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize, QueryableByName, Clone,
|
Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone,
|
||||||
)]
|
)]
|
||||||
#[table_name = "mod_remove_post_view"]
|
#[table_name = "mod_remove_post_view"]
|
||||||
pub struct ModRemovePostView {
|
pub struct ModRemovePostView {
|
||||||
|
@ -78,7 +78,7 @@ table! {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize, QueryableByName, Clone,
|
Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone,
|
||||||
)]
|
)]
|
||||||
#[table_name = "mod_lock_post_view"]
|
#[table_name = "mod_lock_post_view"]
|
||||||
pub struct ModLockPostView {
|
pub struct ModLockPostView {
|
||||||
|
@ -137,7 +137,7 @@ table! {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize, QueryableByName, Clone,
|
Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone,
|
||||||
)]
|
)]
|
||||||
#[table_name = "mod_sticky_post_view"]
|
#[table_name = "mod_sticky_post_view"]
|
||||||
pub struct ModStickyPostView {
|
pub struct ModStickyPostView {
|
||||||
|
@ -201,7 +201,7 @@ table! {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize, QueryableByName, Clone,
|
Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone,
|
||||||
)]
|
)]
|
||||||
#[table_name = "mod_remove_comment_view"]
|
#[table_name = "mod_remove_comment_view"]
|
||||||
pub struct ModRemoveCommentView {
|
pub struct ModRemoveCommentView {
|
||||||
|
@ -265,7 +265,7 @@ table! {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize, QueryableByName, Clone,
|
Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone,
|
||||||
)]
|
)]
|
||||||
#[table_name = "mod_remove_community_view"]
|
#[table_name = "mod_remove_community_view"]
|
||||||
pub struct ModRemoveCommunityView {
|
pub struct ModRemoveCommunityView {
|
||||||
|
@ -321,7 +321,7 @@ table! {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize, QueryableByName, Clone,
|
Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone,
|
||||||
)]
|
)]
|
||||||
#[table_name = "mod_ban_from_community_view"]
|
#[table_name = "mod_ban_from_community_view"]
|
||||||
pub struct ModBanFromCommunityView {
|
pub struct ModBanFromCommunityView {
|
||||||
|
@ -382,7 +382,7 @@ table! {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize, QueryableByName, Clone,
|
Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone,
|
||||||
)]
|
)]
|
||||||
#[table_name = "mod_ban_view"]
|
#[table_name = "mod_ban_view"]
|
||||||
pub struct ModBanView {
|
pub struct ModBanView {
|
||||||
|
@ -436,7 +436,7 @@ table! {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize, QueryableByName, Clone,
|
Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone,
|
||||||
)]
|
)]
|
||||||
#[table_name = "mod_add_community_view"]
|
#[table_name = "mod_add_community_view"]
|
||||||
pub struct ModAddCommunityView {
|
pub struct ModAddCommunityView {
|
||||||
|
@ -493,7 +493,7 @@ table! {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize, QueryableByName, Clone,
|
Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone,
|
||||||
)]
|
)]
|
||||||
#[table_name = "mod_add_view"]
|
#[table_name = "mod_add_view"]
|
||||||
pub struct ModAddView {
|
pub struct ModAddView {
|
||||||
|
|
|
@ -14,7 +14,7 @@ pub struct PasswordResetRequest {
|
||||||
pub published: chrono::NaiveDateTime,
|
pub published: chrono::NaiveDateTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Insertable, AsChangeset, Clone)]
|
#[derive(Insertable, AsChangeset)]
|
||||||
#[table_name = "password_reset_request"]
|
#[table_name = "password_reset_request"]
|
||||||
pub struct PasswordResetRequestForm {
|
pub struct PasswordResetRequestForm {
|
||||||
pub user_id: i32,
|
pub user_id: i32,
|
||||||
|
|
|
@ -7,10 +7,9 @@ use crate::{
|
||||||
Saveable,
|
Saveable,
|
||||||
};
|
};
|
||||||
use diesel::{dsl::*, result::Error, *};
|
use diesel::{dsl::*, result::Error, *};
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
use url::{ParseError, Url};
|
use url::{ParseError, Url};
|
||||||
|
|
||||||
#[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
|
#[derive(Queryable, Identifiable, PartialEq, Debug)]
|
||||||
#[table_name = "post"]
|
#[table_name = "post"]
|
||||||
pub struct Post {
|
pub struct Post {
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
|
@ -34,7 +33,7 @@ pub struct Post {
|
||||||
pub local: bool,
|
pub local: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Insertable, AsChangeset, Clone, Debug)]
|
#[derive(Insertable, AsChangeset)]
|
||||||
#[table_name = "post"]
|
#[table_name = "post"]
|
||||||
pub struct PostForm {
|
pub struct PostForm {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
|
@ -261,7 +260,7 @@ pub struct PostSaved {
|
||||||
pub published: chrono::NaiveDateTime,
|
pub published: chrono::NaiveDateTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Insertable, AsChangeset, Clone)]
|
#[derive(Insertable, AsChangeset)]
|
||||||
#[table_name = "post_saved"]
|
#[table_name = "post_saved"]
|
||||||
pub struct PostSavedForm {
|
pub struct PostSavedForm {
|
||||||
pub post_id: i32,
|
pub post_id: i32,
|
||||||
|
@ -299,7 +298,7 @@ pub struct PostRead {
|
||||||
pub published: chrono::NaiveDateTime,
|
pub published: chrono::NaiveDateTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Insertable, AsChangeset, Clone)]
|
#[derive(Insertable, AsChangeset)]
|
||||||
#[table_name = "post_read"]
|
#[table_name = "post_read"]
|
||||||
pub struct PostReadForm {
|
pub struct PostReadForm {
|
||||||
pub post_id: i32,
|
pub post_id: i32,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use super::post_view::post_fast_view::BoxedQuery;
|
use super::post_view::post_fast_view::BoxedQuery;
|
||||||
use crate::{fuzzy_search, limit_and_offset, ListingType, MaybeOptional, SortType};
|
use crate::{fuzzy_search, limit_and_offset, ListingType, MaybeOptional, SortType};
|
||||||
use diesel::{dsl::*, pg::Pg, result::Error, *};
|
use diesel::{dsl::*, pg::Pg, result::Error, *};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Serialize};
|
||||||
|
|
||||||
// The faked schema since diesel doesn't do views
|
// The faked schema since diesel doesn't do views
|
||||||
table! {
|
table! {
|
||||||
|
@ -107,7 +107,7 @@ table! {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize, QueryableByName, Clone,
|
Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone,
|
||||||
)]
|
)]
|
||||||
#[table_name = "post_fast_view"]
|
#[table_name = "post_fast_view"]
|
||||||
pub struct PostView {
|
pub struct PostView {
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
use crate::{naive_now, schema::private_message, Crud};
|
use crate::{naive_now, schema::private_message, Crud};
|
||||||
use diesel::{dsl::*, result::Error, *};
|
use diesel::{dsl::*, result::Error, *};
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
#[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
|
#[derive(Queryable, Identifiable, PartialEq, Debug)]
|
||||||
#[table_name = "private_message"]
|
#[table_name = "private_message"]
|
||||||
pub struct PrivateMessage {
|
pub struct PrivateMessage {
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
|
@ -17,7 +16,7 @@ pub struct PrivateMessage {
|
||||||
pub local: bool,
|
pub local: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Insertable, AsChangeset, Clone)]
|
#[derive(Insertable, AsChangeset)]
|
||||||
#[table_name = "private_message"]
|
#[table_name = "private_message"]
|
||||||
pub struct PrivateMessageForm {
|
pub struct PrivateMessageForm {
|
||||||
pub creator_id: i32,
|
pub creator_id: i32,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::{limit_and_offset, MaybeOptional};
|
use crate::{limit_and_offset, MaybeOptional};
|
||||||
use diesel::{pg::Pg, result::Error, *};
|
use diesel::{pg::Pg, result::Error, *};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Serialize};
|
||||||
|
|
||||||
// The faked schema since diesel doesn't do views
|
// The faked schema since diesel doesn't do views
|
||||||
table! {
|
table! {
|
||||||
|
@ -29,7 +29,7 @@ table! {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize, QueryableByName, Clone,
|
Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone,
|
||||||
)]
|
)]
|
||||||
#[table_name = "private_message_view"]
|
#[table_name = "private_message_view"]
|
||||||
pub struct PrivateMessageView {
|
pub struct PrivateMessageView {
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
use crate::{naive_now, schema::site, Crud};
|
use crate::{naive_now, schema::site, Crud};
|
||||||
use diesel::{dsl::*, result::Error, *};
|
use diesel::{dsl::*, result::Error, *};
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
#[derive(Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
|
#[derive(Queryable, Identifiable, PartialEq, Debug)]
|
||||||
#[table_name = "site"]
|
#[table_name = "site"]
|
||||||
pub struct Site {
|
pub struct Site {
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
|
@ -18,7 +17,7 @@ pub struct Site {
|
||||||
pub banner: Option<String>,
|
pub banner: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Insertable, AsChangeset, Clone, Serialize, Deserialize)]
|
#[derive(Insertable, AsChangeset)]
|
||||||
#[table_name = "site"]
|
#[table_name = "site"]
|
||||||
pub struct SiteForm {
|
pub struct SiteForm {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use diesel::{result::Error, *};
|
use diesel::{result::Error, *};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Serialize};
|
||||||
|
|
||||||
table! {
|
table! {
|
||||||
site_view (id) {
|
site_view (id) {
|
||||||
|
@ -25,7 +25,7 @@ table! {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize, QueryableByName, Clone,
|
Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone,
|
||||||
)]
|
)]
|
||||||
#[table_name = "site_view"]
|
#[table_name = "site_view"]
|
||||||
pub struct SiteView {
|
pub struct SiteView {
|
||||||
|
|
|
@ -6,9 +6,9 @@ use crate::{
|
||||||
};
|
};
|
||||||
use bcrypt::{hash, DEFAULT_COST};
|
use bcrypt::{hash, DEFAULT_COST};
|
||||||
use diesel::{dsl::*, result::Error, *};
|
use diesel::{dsl::*, result::Error, *};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Serialize};
|
||||||
|
|
||||||
#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
|
||||||
#[table_name = "user_"]
|
#[table_name = "user_"]
|
||||||
pub struct User_ {
|
pub struct User_ {
|
||||||
pub id: i32,
|
pub id: i32,
|
||||||
|
@ -38,7 +38,7 @@ pub struct User_ {
|
||||||
pub banner: Option<String>,
|
pub banner: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Insertable, AsChangeset, Clone, Debug)]
|
#[derive(Insertable, AsChangeset, Clone)]
|
||||||
#[table_name = "user_"]
|
#[table_name = "user_"]
|
||||||
pub struct UserForm {
|
pub struct UserForm {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
use super::comment::Comment;
|
use super::comment::Comment;
|
||||||
use crate::{schema::user_mention, Crud};
|
use crate::{schema::user_mention, Crud};
|
||||||
use diesel::{dsl::*, result::Error, *};
|
use diesel::{dsl::*, result::Error, *};
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
|
|
||||||
#[derive(Queryable, Associations, Identifiable, PartialEq, Debug, Serialize, Deserialize)]
|
#[derive(Queryable, Associations, Identifiable, PartialEq, Debug)]
|
||||||
#[belongs_to(Comment)]
|
#[belongs_to(Comment)]
|
||||||
#[table_name = "user_mention"]
|
#[table_name = "user_mention"]
|
||||||
pub struct UserMention {
|
pub struct UserMention {
|
||||||
|
@ -14,7 +13,7 @@ pub struct UserMention {
|
||||||
pub published: chrono::NaiveDateTime,
|
pub published: chrono::NaiveDateTime,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Insertable, AsChangeset, Clone)]
|
#[derive(Insertable, AsChangeset)]
|
||||||
#[table_name = "user_mention"]
|
#[table_name = "user_mention"]
|
||||||
pub struct UserMentionForm {
|
pub struct UserMentionForm {
|
||||||
pub recipient_id: i32,
|
pub recipient_id: i32,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::{limit_and_offset, MaybeOptional, SortType};
|
use crate::{limit_and_offset, MaybeOptional, SortType};
|
||||||
use diesel::{dsl::*, pg::Pg, result::Error, *};
|
use diesel::{dsl::*, pg::Pg, result::Error, *};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Serialize};
|
||||||
|
|
||||||
// The faked schema since diesel doesn't do views
|
// The faked schema since diesel doesn't do views
|
||||||
table! {
|
table! {
|
||||||
|
@ -84,7 +84,7 @@ table! {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize, QueryableByName, Clone,
|
Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone,
|
||||||
)]
|
)]
|
||||||
#[table_name = "user_mention_fast_view"]
|
#[table_name = "user_mention_fast_view"]
|
||||||
pub struct UserMentionView {
|
pub struct UserMentionView {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use super::user_view::user_fast::BoxedQuery;
|
use super::user_view::user_fast::BoxedQuery;
|
||||||
use crate::{fuzzy_search, limit_and_offset, MaybeOptional, SortType};
|
use crate::{fuzzy_search, limit_and_offset, MaybeOptional, SortType};
|
||||||
use diesel::{dsl::*, pg::Pg, result::Error, *};
|
use diesel::{dsl::*, pg::Pg, result::Error, *};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Serialize};
|
||||||
|
|
||||||
table! {
|
table! {
|
||||||
user_view (id) {
|
user_view (id) {
|
||||||
|
@ -52,7 +52,7 @@ table! {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
Queryable, Identifiable, PartialEq, Debug, Serialize, Deserialize, QueryableByName, Clone,
|
Queryable, Identifiable, PartialEq, Debug, Serialize, QueryableByName, Clone,
|
||||||
)]
|
)]
|
||||||
#[table_name = "user_fast"]
|
#[table_name = "user_fast"]
|
||||||
pub struct UserView {
|
pub struct UserView {
|
||||||
|
|
|
@ -2,7 +2,7 @@ use crate::{api::Perform, LemmyContext};
|
||||||
use actix_web::{error::ErrorBadRequest, *};
|
use actix_web::{error::ErrorBadRequest, *};
|
||||||
use lemmy_api_structs::{comment::*, community::*, post::*, site::*, user::*};
|
use lemmy_api_structs::{comment::*, community::*, post::*, site::*, user::*};
|
||||||
use lemmy_rate_limit::RateLimit;
|
use lemmy_rate_limit::RateLimit;
|
||||||
use serde::Serialize;
|
use serde::Deserialize;
|
||||||
|
|
||||||
pub fn config(cfg: &mut web::ServiceConfig, rate_limit: &RateLimit) {
|
pub fn config(cfg: &mut web::ServiceConfig, rate_limit: &RateLimit) {
|
||||||
cfg.service(
|
cfg.service(
|
||||||
|
@ -187,22 +187,22 @@ where
|
||||||
Ok(res)
|
Ok(res)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn route_get<Data>(
|
async fn route_get<'a, Data>(
|
||||||
data: web::Query<Data>,
|
data: web::Query<Data>,
|
||||||
context: web::Data<LemmyContext>,
|
context: web::Data<LemmyContext>,
|
||||||
) -> Result<HttpResponse, Error>
|
) -> Result<HttpResponse, Error>
|
||||||
where
|
where
|
||||||
Data: Serialize + Send + 'static + Perform,
|
Data: Deserialize<'a> + Send + 'static + Perform,
|
||||||
{
|
{
|
||||||
perform::<Data>(data.0, context).await
|
perform::<Data>(data.0, context).await
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn route_post<Data>(
|
async fn route_post<'a, Data>(
|
||||||
data: web::Json<Data>,
|
data: web::Json<Data>,
|
||||||
context: web::Data<LemmyContext>,
|
context: web::Data<LemmyContext>,
|
||||||
) -> Result<HttpResponse, Error>
|
) -> Result<HttpResponse, Error>
|
||||||
where
|
where
|
||||||
Data: Serialize + Send + 'static + Perform,
|
Data: Deserialize<'a> + Send + 'static + Perform,
|
||||||
{
|
{
|
||||||
perform::<Data>(data.0, context).await
|
perform::<Data>(data.0, context).await
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue