Split up lemmy_db_views, put lemmy_rate_limit into lemmy_utils
This commit is contained in:
parent
d5efebbf47
commit
95e30f0e08
99 changed files with 294 additions and 253 deletions
50
Cargo.lock
generated
50
Cargo.lock
generated
|
@ -1720,7 +1720,8 @@ dependencies = [
|
|||
"lemmy_db_queries",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_views",
|
||||
"lemmy_rate_limit",
|
||||
"lemmy_db_views_actor",
|
||||
"lemmy_db_views_moderator",
|
||||
"lemmy_structs",
|
||||
"lemmy_utils",
|
||||
"lemmy_websocket",
|
||||
|
@ -1766,6 +1767,7 @@ dependencies = [
|
|||
"lemmy_db_queries",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_views",
|
||||
"lemmy_db_views_actor",
|
||||
"lemmy_structs",
|
||||
"lemmy_utils",
|
||||
"lemmy_websocket",
|
||||
|
@ -1785,17 +1787,6 @@ dependencies = [
|
|||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lemmy_db_aggregates"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"diesel",
|
||||
"lemmy_db_queries",
|
||||
"lemmy_db_schema",
|
||||
"serde 1.0.118",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lemmy_db_queries"
|
||||
version = "0.1.0"
|
||||
|
@ -1834,23 +1825,29 @@ name = "lemmy_db_views"
|
|||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"diesel",
|
||||
"lemmy_db_aggregates",
|
||||
"lemmy_db_queries",
|
||||
"lemmy_db_schema",
|
||||
"serde 1.0.118",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lemmy_rate_limit"
|
||||
name = "lemmy_db_views_actor"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"actix-web",
|
||||
"futures",
|
||||
"lemmy_utils",
|
||||
"log",
|
||||
"strum",
|
||||
"strum_macros",
|
||||
"tokio 0.3.6",
|
||||
"diesel",
|
||||
"lemmy_db_queries",
|
||||
"lemmy_db_schema",
|
||||
"serde 1.0.118",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lemmy_db_views_moderator"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"diesel",
|
||||
"lemmy_db_queries",
|
||||
"lemmy_db_schema",
|
||||
"serde 1.0.118",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1874,11 +1871,11 @@ dependencies = [
|
|||
"lazy_static",
|
||||
"lemmy_api",
|
||||
"lemmy_apub",
|
||||
"lemmy_db_aggregates",
|
||||
"lemmy_db_queries",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_views",
|
||||
"lemmy_rate_limit",
|
||||
"lemmy_db_views_actor",
|
||||
"lemmy_db_views_moderator",
|
||||
"lemmy_structs",
|
||||
"lemmy_utils",
|
||||
"lemmy_websocket",
|
||||
|
@ -1904,6 +1901,8 @@ dependencies = [
|
|||
"lemmy_db_queries",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_views",
|
||||
"lemmy_db_views_actor",
|
||||
"lemmy_db_views_moderator",
|
||||
"lemmy_utils",
|
||||
"log",
|
||||
"serde 1.0.118",
|
||||
|
@ -1920,6 +1919,7 @@ dependencies = [
|
|||
"chrono",
|
||||
"comrak",
|
||||
"config",
|
||||
"futures",
|
||||
"itertools",
|
||||
"lazy_static",
|
||||
"lettre",
|
||||
|
@ -1931,7 +1931,10 @@ dependencies = [
|
|||
"reqwest",
|
||||
"serde 1.0.118",
|
||||
"serde_json",
|
||||
"strum",
|
||||
"strum_macros",
|
||||
"thiserror",
|
||||
"tokio 0.3.6",
|
||||
"url",
|
||||
]
|
||||
|
||||
|
@ -1946,7 +1949,6 @@ dependencies = [
|
|||
"diesel",
|
||||
"lemmy_db_queries",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_rate_limit",
|
||||
"lemmy_structs",
|
||||
"lemmy_utils",
|
||||
"log",
|
||||
|
|
|
@ -13,8 +13,10 @@ members = [
|
|||
"lemmy_utils",
|
||||
"lemmy_db_queries",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_views",
|
||||
"lemmy_db_views_actor",
|
||||
"lemmy_db_views_actor",
|
||||
"lemmy_structs",
|
||||
"lemmy_rate_limit",
|
||||
"lemmy_websocket",
|
||||
]
|
||||
|
||||
|
@ -25,9 +27,9 @@ lemmy_utils = { path = "./lemmy_utils" }
|
|||
lemmy_db_schema = { path = "./lemmy_db_schema" }
|
||||
lemmy_db_queries = { path = "lemmy_db_queries" }
|
||||
lemmy_db_views = { path = "./lemmy_db_views" }
|
||||
lemmy_db_aggregates = { path = "./lemmy_db_aggregates" }
|
||||
lemmy_db_views_moderator = { path = "./lemmy_db_views_moderator" }
|
||||
lemmy_db_views_actor = { path = "lemmy_db_views_actor" }
|
||||
lemmy_structs = { path = "./lemmy_structs" }
|
||||
lemmy_rate_limit = { path = "./lemmy_rate_limit" }
|
||||
lemmy_websocket = { path = "./lemmy_websocket" }
|
||||
diesel = "1.4.5"
|
||||
diesel_migrations = "1.4.0"
|
||||
|
|
|
@ -14,8 +14,9 @@ lemmy_utils = { path = "../lemmy_utils" }
|
|||
lemmy_db_queries = { path = "../lemmy_db_queries" }
|
||||
lemmy_db_schema = { path = "../lemmy_db_schema" }
|
||||
lemmy_db_views = { path = "../lemmy_db_views" }
|
||||
lemmy_db_views_moderator = { path = "../lemmy_db_views_moderator" }
|
||||
lemmy_db_views_actor = { path = "../lemmy_db_views_actor" }
|
||||
lemmy_structs = { path = "../lemmy_structs" }
|
||||
lemmy_rate_limit = { path = "../lemmy_rate_limit" }
|
||||
lemmy_websocket = { path = "../lemmy_websocket" }
|
||||
diesel = "1.4.5"
|
||||
bcrypt = "0.9.0"
|
||||
|
|
|
@ -10,7 +10,7 @@ use crate::{
|
|||
};
|
||||
use actix_web::web::Data;
|
||||
use lemmy_apub::{ApubLikeableType, ApubObjectType};
|
||||
use lemmy_db::{
|
||||
use lemmy_db_queries::{
|
||||
source::comment::Comment_,
|
||||
Crud,
|
||||
Likeable,
|
||||
|
|
|
@ -9,7 +9,7 @@ use crate::{
|
|||
use actix_web::web::Data;
|
||||
use anyhow::Context;
|
||||
use lemmy_apub::ActorType;
|
||||
use lemmy_db::{
|
||||
use lemmy_db_queries::{
|
||||
diesel_option_overwrite,
|
||||
source::{
|
||||
comment::Comment_,
|
||||
|
@ -27,13 +27,11 @@ use lemmy_db_schema::{
|
|||
naive_now,
|
||||
source::{comment::Comment, community::*, moderator::*, post::Post, site::*},
|
||||
};
|
||||
use lemmy_db_views::{
|
||||
comment_view::CommentQueryBuilder,
|
||||
community::{
|
||||
community_follower_view::CommunityFollowerView,
|
||||
community_moderator_view::CommunityModeratorView,
|
||||
community_view::{CommunityQueryBuilder, CommunityView},
|
||||
},
|
||||
use lemmy_db_views::comment_view::CommentQueryBuilder;
|
||||
use lemmy_db_views_actor::{
|
||||
community_follower_view::CommunityFollowerView,
|
||||
community_moderator_view::CommunityModeratorView,
|
||||
community_view::{CommunityQueryBuilder, CommunityView},
|
||||
user_view::UserViewSafe,
|
||||
};
|
||||
use lemmy_structs::{blocking, community::*};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use crate::claims::Claims;
|
||||
use actix_web::{web, web::Data};
|
||||
use lemmy_db::{
|
||||
use lemmy_db_queries::{
|
||||
source::{
|
||||
community::{CommunityModerator_, Community_},
|
||||
site::Site_,
|
||||
|
@ -14,7 +14,7 @@ use lemmy_db_schema::source::{
|
|||
site::Site,
|
||||
user::User_,
|
||||
};
|
||||
use lemmy_db_views::community::{
|
||||
use lemmy_db_views_actor::{
|
||||
community_user_ban_view::CommunityUserBanView,
|
||||
community_view::CommunityView,
|
||||
};
|
||||
|
|
|
@ -10,7 +10,15 @@ use crate::{
|
|||
};
|
||||
use actix_web::web::Data;
|
||||
use lemmy_apub::{ApubLikeableType, ApubObjectType};
|
||||
use lemmy_db::{source::post::Post_, Crud, Likeable, ListingType, Reportable, Saveable, SortType};
|
||||
use lemmy_db_queries::{
|
||||
source::post::Post_,
|
||||
Crud,
|
||||
Likeable,
|
||||
ListingType,
|
||||
Reportable,
|
||||
Saveable,
|
||||
SortType,
|
||||
};
|
||||
use lemmy_db_schema::{
|
||||
naive_now,
|
||||
source::{
|
||||
|
@ -21,10 +29,10 @@ use lemmy_db_schema::{
|
|||
};
|
||||
use lemmy_db_views::{
|
||||
comment_view::CommentQueryBuilder,
|
||||
community::community_moderator_view::CommunityModeratorView,
|
||||
post_report_view::{PostReportQueryBuilder, PostReportView},
|
||||
post_view::{PostQueryBuilder, PostView},
|
||||
};
|
||||
use lemmy_db_views_actor::community_moderator_view::CommunityModeratorView;
|
||||
use lemmy_structs::{blocking, post::*};
|
||||
use lemmy_utils::{
|
||||
apub::{make_apub_endpoint, EndpointType},
|
||||
|
|
|
@ -9,7 +9,7 @@ use crate::{
|
|||
use actix_web::web::Data;
|
||||
use anyhow::Context;
|
||||
use lemmy_apub::fetcher::search_by_apub_id;
|
||||
use lemmy_db::{
|
||||
use lemmy_db_queries::{
|
||||
diesel_option_overwrite,
|
||||
source::{category::Category_, site::Site_},
|
||||
Crud,
|
||||
|
@ -26,22 +26,24 @@ use lemmy_db_schema::{
|
|||
};
|
||||
use lemmy_db_views::{
|
||||
comment_view::CommentQueryBuilder,
|
||||
community::community_view::CommunityQueryBuilder,
|
||||
moderator::{
|
||||
mod_add_community_view::ModAddCommunityView,
|
||||
mod_add_view::ModAddView,
|
||||
mod_ban_from_community_view::ModBanFromCommunityView,
|
||||
mod_ban_view::ModBanView,
|
||||
mod_lock_post_view::ModLockPostView,
|
||||
mod_remove_comment_view::ModRemoveCommentView,
|
||||
mod_remove_community_view::ModRemoveCommunityView,
|
||||
mod_remove_post_view::ModRemovePostView,
|
||||
mod_sticky_post_view::ModStickyPostView,
|
||||
},
|
||||
post_view::PostQueryBuilder,
|
||||
site_view::SiteView,
|
||||
};
|
||||
use lemmy_db_views_actor::{
|
||||
community_view::CommunityQueryBuilder,
|
||||
user_view::{UserQueryBuilder, UserViewSafe},
|
||||
};
|
||||
use lemmy_db_views_moderator::{
|
||||
mod_add_community_view::ModAddCommunityView,
|
||||
mod_add_view::ModAddView,
|
||||
mod_ban_from_community_view::ModBanFromCommunityView,
|
||||
mod_ban_view::ModBanView,
|
||||
mod_lock_post_view::ModLockPostView,
|
||||
mod_remove_comment_view::ModRemoveCommentView,
|
||||
mod_remove_community_view::ModRemoveCommunityView,
|
||||
mod_remove_post_view::ModRemovePostView,
|
||||
mod_sticky_post_view::ModStickyPostView,
|
||||
};
|
||||
use lemmy_structs::{blocking, site::*, user::Register};
|
||||
use lemmy_utils::{
|
||||
location_info,
|
||||
|
|
|
@ -14,7 +14,7 @@ use bcrypt::verify;
|
|||
use captcha::{gen, Difficulty};
|
||||
use chrono::Duration;
|
||||
use lemmy_apub::ApubObjectType;
|
||||
use lemmy_db::{
|
||||
use lemmy_db_queries::{
|
||||
diesel_option_overwrite,
|
||||
source::{
|
||||
comment::Comment_,
|
||||
|
@ -49,13 +49,13 @@ use lemmy_db_schema::{
|
|||
use lemmy_db_views::{
|
||||
comment_report_view::CommentReportView,
|
||||
comment_view::CommentQueryBuilder,
|
||||
community::{
|
||||
community_follower_view::CommunityFollowerView,
|
||||
community_moderator_view::CommunityModeratorView,
|
||||
},
|
||||
post_report_view::PostReportView,
|
||||
post_view::PostQueryBuilder,
|
||||
private_message_view::{PrivateMessageQueryBuilder, PrivateMessageView},
|
||||
};
|
||||
use lemmy_db_views_actor::{
|
||||
community_follower_view::CommunityFollowerView,
|
||||
community_moderator_view::CommunityModeratorView,
|
||||
user_mention_view::{UserMentionQueryBuilder, UserMentionView},
|
||||
user_view::{UserViewDangerous, UserViewSafe},
|
||||
};
|
||||
|
|
|
@ -13,6 +13,7 @@ lemmy_utils = { path = "../lemmy_utils" }
|
|||
lemmy_db_queries = { path = "../lemmy_db_queries" }
|
||||
lemmy_db_schema = { path = "../lemmy_db_schema" }
|
||||
lemmy_db_views = { path = "../lemmy_db_views" }
|
||||
lemmy_db_views_actor = { path = "../lemmy_db_views_actor" }
|
||||
lemmy_structs = { path = "../lemmy_structs" }
|
||||
lemmy_websocket = { path = "../lemmy_websocket" }
|
||||
diesel = "1.4.5"
|
||||
|
|
|
@ -4,7 +4,7 @@ use activitystreams::{
|
|||
base::ExtendsExt,
|
||||
};
|
||||
use anyhow::Context;
|
||||
use lemmy_db::{source::comment::Comment_, Crud, Likeable};
|
||||
use lemmy_db_queries::{source::comment::Comment_, Crud, Likeable};
|
||||
use lemmy_db_schema::source::{
|
||||
comment::{Comment, CommentLike, CommentLikeForm},
|
||||
post::Post,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use crate::activities::receive::get_actor_as_user;
|
||||
use activitystreams::activity::{Dislike, Like};
|
||||
use lemmy_db::{source::comment::Comment_, Likeable};
|
||||
use lemmy_db_queries::{source::comment::Comment_, Likeable};
|
||||
use lemmy_db_schema::source::comment::{Comment, CommentLike};
|
||||
use lemmy_db_views::comment_view::CommentView;
|
||||
use lemmy_structs::{blocking, comment::CommentResponse};
|
||||
|
|
|
@ -4,9 +4,9 @@ use activitystreams::{
|
|||
base::{AnyBase, ExtendsExt},
|
||||
};
|
||||
use anyhow::Context;
|
||||
use lemmy_db::{source::community::Community_, ApubObject};
|
||||
use lemmy_db_queries::{source::community::Community_, ApubObject};
|
||||
use lemmy_db_schema::source::community::Community;
|
||||
use lemmy_db_views::community::community_view::CommunityView;
|
||||
use lemmy_db_views_actor::community_view::CommunityView;
|
||||
use lemmy_structs::{blocking, community::CommunityResponse};
|
||||
use lemmy_utils::{location_info, LemmyError};
|
||||
use lemmy_websocket::{messages::SendCommunityRoomMessage, LemmyContext, UserOperation};
|
||||
|
|
|
@ -4,7 +4,7 @@ use activitystreams::{
|
|||
prelude::*,
|
||||
};
|
||||
use anyhow::Context;
|
||||
use lemmy_db::{source::post::Post_, Likeable};
|
||||
use lemmy_db_queries::{source::post::Post_, Likeable};
|
||||
use lemmy_db_schema::source::post::{Post, PostLike, PostLikeForm};
|
||||
use lemmy_db_views::post_view::PostView;
|
||||
use lemmy_structs::{blocking, post::PostResponse};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use crate::activities::receive::get_actor_as_user;
|
||||
use activitystreams::activity::{Dislike, Like};
|
||||
use lemmy_db::{source::post::Post_, Likeable};
|
||||
use lemmy_db_queries::{source::post::Post_, Likeable};
|
||||
use lemmy_db_schema::source::post::{Post, PostLike};
|
||||
use lemmy_db_views::post_view::PostView;
|
||||
use lemmy_structs::{blocking, post::PostResponse};
|
||||
|
|
|
@ -13,7 +13,7 @@ use activitystreams::{
|
|||
public,
|
||||
};
|
||||
use anyhow::{anyhow, Context};
|
||||
use lemmy_db::source::private_message::PrivateMessage_;
|
||||
use lemmy_db_queries::source::private_message::PrivateMessage_;
|
||||
use lemmy_db_schema::source::private_message::PrivateMessage;
|
||||
use lemmy_db_views::private_message_view::PrivateMessageView;
|
||||
use lemmy_structs::{blocking, user::PrivateMessageResponse};
|
||||
|
|
|
@ -26,7 +26,7 @@ use activitystreams::{
|
|||
};
|
||||
use anyhow::anyhow;
|
||||
use itertools::Itertools;
|
||||
use lemmy_db::{Crud, DbPool};
|
||||
use lemmy_db_queries::{Crud, DbPool};
|
||||
use lemmy_db_schema::source::{comment::Comment, community::Community, post::Post, user::User_};
|
||||
use lemmy_structs::{blocking, WebFingerResponse};
|
||||
use lemmy_utils::{
|
||||
|
|
|
@ -23,9 +23,9 @@ use activitystreams::{
|
|||
};
|
||||
use anyhow::Context;
|
||||
use itertools::Itertools;
|
||||
use lemmy_db::DbPool;
|
||||
use lemmy_db_queries::DbPool;
|
||||
use lemmy_db_schema::source::community::Community;
|
||||
use lemmy_db_views::community::community_follower_view::CommunityFollowerView;
|
||||
use lemmy_db_views_actor::community_follower_view::CommunityFollowerView;
|
||||
use lemmy_structs::blocking;
|
||||
use lemmy_utils::{location_info, settings::Settings, LemmyError};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
|
|
@ -21,7 +21,7 @@ use activitystreams::{
|
|||
prelude::*,
|
||||
public,
|
||||
};
|
||||
use lemmy_db::Crud;
|
||||
use lemmy_db_queries::Crud;
|
||||
use lemmy_db_schema::source::{community::Community, post::Post, user::User_};
|
||||
use lemmy_structs::blocking;
|
||||
use lemmy_utils::LemmyError;
|
||||
|
|
|
@ -16,7 +16,7 @@ use activitystreams::{
|
|||
},
|
||||
prelude::*,
|
||||
};
|
||||
use lemmy_db::Crud;
|
||||
use lemmy_db_queries::Crud;
|
||||
use lemmy_db_schema::source::{private_message::PrivateMessage, user::User_};
|
||||
use lemmy_structs::blocking;
|
||||
use lemmy_utils::LemmyError;
|
||||
|
|
|
@ -13,7 +13,7 @@ use activitystreams::{
|
|||
base::{AnyBase, BaseExt, ExtendsExt},
|
||||
object::ObjectExt,
|
||||
};
|
||||
use lemmy_db::{ApubObject, DbPool, Followable};
|
||||
use lemmy_db_queries::{ApubObject, DbPool, Followable};
|
||||
use lemmy_db_schema::source::{
|
||||
community::{Community, CommunityFollower, CommunityFollowerForm},
|
||||
user::User_,
|
||||
|
|
|
@ -19,7 +19,7 @@ use background_jobs::{
|
|||
WorkerConfig,
|
||||
};
|
||||
use itertools::Itertools;
|
||||
use lemmy_db::DbPool;
|
||||
use lemmy_db_queries::DbPool;
|
||||
use lemmy_db_schema::source::{community::Community, user::User_};
|
||||
use lemmy_utils::{location_info, settings::Settings, LemmyError};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use activitystreams::unparsed::UnparsedMutExt;
|
||||
use activitystreams_ext::UnparsedExtension;
|
||||
use diesel::PgConnection;
|
||||
use lemmy_db::Crud;
|
||||
use lemmy_db_queries::Crud;
|
||||
use lemmy_db_schema::source::category::Category;
|
||||
use lemmy_utils::LemmyError;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
|
|
@ -12,7 +12,7 @@ use activitystreams::{base::BaseExt, collection::OrderedCollection, prelude::*};
|
|||
use anyhow::{anyhow, Context};
|
||||
use chrono::NaiveDateTime;
|
||||
use diesel::result::Error::NotFound;
|
||||
use lemmy_db::{source::user::User, ApubObject, Crud, Joinable, SearchType};
|
||||
use lemmy_db_queries::{source::user::User, ApubObject, Crud, Joinable, SearchType};
|
||||
use lemmy_db_schema::{
|
||||
naive_now,
|
||||
source::{
|
||||
|
@ -22,12 +22,8 @@ use lemmy_db_schema::{
|
|||
user::User_,
|
||||
},
|
||||
};
|
||||
use lemmy_db_views::{
|
||||
comment_view::CommentView,
|
||||
community::community_view::CommunityView,
|
||||
post_view::PostView,
|
||||
user_view::UserViewSafe,
|
||||
};
|
||||
use lemmy_db_views::{comment_view::CommentView, post_view::PostView};
|
||||
use lemmy_db_views_actor::{community_view::CommunityView, user_view::UserViewSafe};
|
||||
use lemmy_structs::{blocking, site::SearchResponse};
|
||||
use lemmy_utils::{
|
||||
location_info,
|
||||
|
|
|
@ -4,7 +4,7 @@ use crate::{
|
|||
};
|
||||
use actix_web::{body::Body, web, web::Path, HttpResponse};
|
||||
use diesel::result::Error::NotFound;
|
||||
use lemmy_db::Crud;
|
||||
use lemmy_db_queries::Crud;
|
||||
use lemmy_db_schema::source::comment::Comment;
|
||||
use lemmy_structs::blocking;
|
||||
use lemmy_utils::LemmyError;
|
||||
|
|
|
@ -9,9 +9,9 @@ use activitystreams::{
|
|||
collection::{CollectionExt, OrderedCollection, UnorderedCollection},
|
||||
};
|
||||
use actix_web::{body::Body, web, HttpResponse};
|
||||
use lemmy_db::source::{community::Community_, post::Post_};
|
||||
use lemmy_db_queries::source::{community::Community_, post::Post_};
|
||||
use lemmy_db_schema::source::{community::Community, post::Post};
|
||||
use lemmy_db_views::community::community_follower_view::CommunityFollowerView;
|
||||
use lemmy_db_views_actor::community_follower_view::CommunityFollowerView;
|
||||
use lemmy_structs::blocking;
|
||||
use lemmy_utils::LemmyError;
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use crate::APUB_JSON_CONTENT_TYPE;
|
||||
use actix_web::{body::Body, web, HttpResponse};
|
||||
use lemmy_db::source::activity::Activity_;
|
||||
use lemmy_db_queries::source::activity::Activity_;
|
||||
use lemmy_db_schema::source::activity::Activity;
|
||||
use lemmy_structs::blocking;
|
||||
use lemmy_utils::{settings::Settings, LemmyError};
|
||||
|
|
|
@ -4,7 +4,7 @@ use crate::{
|
|||
};
|
||||
use actix_web::{body::Body, web, HttpResponse};
|
||||
use diesel::result::Error::NotFound;
|
||||
use lemmy_db::Crud;
|
||||
use lemmy_db_queries::Crud;
|
||||
use lemmy_db_schema::source::post::Post;
|
||||
use lemmy_structs::blocking;
|
||||
use lemmy_utils::LemmyError;
|
||||
|
|
|
@ -9,7 +9,7 @@ use activitystreams::{
|
|||
collection::{CollectionExt, OrderedCollection},
|
||||
};
|
||||
use actix_web::{body::Body, web, HttpResponse};
|
||||
use lemmy_db::source::user::User;
|
||||
use lemmy_db_queries::source::user::User;
|
||||
use lemmy_db_schema::source::user::User_;
|
||||
use lemmy_structs::blocking;
|
||||
use lemmy_utils::LemmyError;
|
||||
|
|
|
@ -26,12 +26,12 @@ use activitystreams::{
|
|||
};
|
||||
use actix_web::{web, HttpRequest, HttpResponse};
|
||||
use anyhow::{anyhow, Context};
|
||||
use lemmy_db::{source::community::Community_, ApubObject, DbPool, Followable};
|
||||
use lemmy_db_queries::{source::community::Community_, ApubObject, DbPool, Followable};
|
||||
use lemmy_db_schema::source::{
|
||||
community::{Community, CommunityFollower, CommunityFollowerForm},
|
||||
user::User_,
|
||||
};
|
||||
use lemmy_db_views::community::community_user_ban_view::CommunityUserBanView;
|
||||
use lemmy_db_views_actor::community_user_ban_view::CommunityUserBanView;
|
||||
use lemmy_structs::blocking;
|
||||
use lemmy_utils::{location_info, LemmyError};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
|
|
@ -12,7 +12,7 @@ use activitystreams::{
|
|||
};
|
||||
use actix_web::HttpRequest;
|
||||
use anyhow::{anyhow, Context};
|
||||
use lemmy_db::{source::activity::Activity_, ApubObject, DbPool};
|
||||
use lemmy_db_queries::{source::activity::Activity_, ApubObject, DbPool};
|
||||
use lemmy_db_schema::source::{activity::Activity, community::Community, user::User_};
|
||||
use lemmy_structs::blocking;
|
||||
use lemmy_utils::{location_info, settings::Settings, LemmyError};
|
||||
|
|
|
@ -41,7 +41,7 @@ use activitystreams::{
|
|||
};
|
||||
use anyhow::Context;
|
||||
use diesel::result::Error::NotFound;
|
||||
use lemmy_db::{ApubObject, Crud};
|
||||
use lemmy_db_queries::{ApubObject, Crud};
|
||||
use lemmy_db_schema::source::{comment::Comment, post::Post, site::Site};
|
||||
use lemmy_structs::blocking;
|
||||
use lemmy_utils::{location_info, LemmyError};
|
||||
|
|
|
@ -15,7 +15,7 @@ use crate::{
|
|||
use activitystreams::{activity::ActorAndObject, prelude::*};
|
||||
use actix_web::{web, HttpRequest, HttpResponse};
|
||||
use anyhow::Context;
|
||||
use lemmy_db::{ApubObject, DbPool};
|
||||
use lemmy_db_queries::{ApubObject, DbPool};
|
||||
use lemmy_db_schema::source::community::Community;
|
||||
use lemmy_structs::blocking;
|
||||
use lemmy_utils::{location_info, LemmyError};
|
||||
|
|
|
@ -48,7 +48,7 @@ use activitystreams::{
|
|||
use actix_web::{web, HttpRequest, HttpResponse};
|
||||
use anyhow::{anyhow, Context};
|
||||
use diesel::NotFound;
|
||||
use lemmy_db::{source::user::User, ApubObject, Followable};
|
||||
use lemmy_db_queries::{source::user::User, ApubObject, Followable};
|
||||
use lemmy_db_schema::source::{
|
||||
community::{Community, CommunityFollower},
|
||||
private_message::PrivateMessage,
|
||||
|
|
|
@ -22,7 +22,7 @@ use activitystreams::{
|
|||
};
|
||||
use activitystreams_ext::{Ext1, Ext2};
|
||||
use anyhow::{anyhow, Context};
|
||||
use lemmy_db::{source::activity::Activity_, DbPool};
|
||||
use lemmy_db_queries::{source::activity::Activity_, DbPool};
|
||||
use lemmy_db_schema::source::{activity::Activity, user::User_};
|
||||
use lemmy_structs::blocking;
|
||||
use lemmy_utils::{location_info, settings::Settings, LemmyError};
|
||||
|
|
|
@ -23,7 +23,7 @@ use activitystreams::{
|
|||
prelude::*,
|
||||
};
|
||||
use anyhow::{anyhow, Context};
|
||||
use lemmy_db::{Crud, DbPool};
|
||||
use lemmy_db_queries::{Crud, DbPool};
|
||||
use lemmy_db_schema::source::{
|
||||
comment::{Comment, CommentForm},
|
||||
community::Community,
|
||||
|
|
|
@ -22,12 +22,12 @@ use activitystreams::{
|
|||
};
|
||||
use activitystreams_ext::Ext2;
|
||||
use anyhow::Context;
|
||||
use lemmy_db::DbPool;
|
||||
use lemmy_db_queries::DbPool;
|
||||
use lemmy_db_schema::{
|
||||
naive_now,
|
||||
source::community::{Community, CommunityForm},
|
||||
};
|
||||
use lemmy_db_views::community::community_moderator_view::CommunityModeratorView;
|
||||
use lemmy_db_views_actor::community_moderator_view::CommunityModeratorView;
|
||||
use lemmy_structs::blocking;
|
||||
use lemmy_utils::{
|
||||
location_info,
|
||||
|
|
|
@ -11,7 +11,7 @@ use activitystreams::{
|
|||
};
|
||||
use anyhow::{anyhow, Context};
|
||||
use chrono::NaiveDateTime;
|
||||
use lemmy_db::{ApubObject, Crud, DbPool};
|
||||
use lemmy_db_queries::{ApubObject, Crud, DbPool};
|
||||
use lemmy_structs::blocking;
|
||||
use lemmy_utils::{location_info, settings::Settings, utils::convert_datetime, LemmyError};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
|
|
@ -20,7 +20,7 @@ use activitystreams::{
|
|||
};
|
||||
use activitystreams_ext::Ext1;
|
||||
use anyhow::Context;
|
||||
use lemmy_db::{Crud, DbPool};
|
||||
use lemmy_db_queries::{Crud, DbPool};
|
||||
use lemmy_db_schema::source::{
|
||||
community::Community,
|
||||
post::{Post, PostForm},
|
||||
|
|
|
@ -19,7 +19,7 @@ use activitystreams::{
|
|||
prelude::*,
|
||||
};
|
||||
use anyhow::Context;
|
||||
use lemmy_db::{Crud, DbPool};
|
||||
use lemmy_db_queries::{Crud, DbPool};
|
||||
use lemmy_db_schema::source::{
|
||||
private_message::{PrivateMessage, PrivateMessageForm},
|
||||
user::User_,
|
||||
|
|
|
@ -18,7 +18,7 @@ use activitystreams::{
|
|||
};
|
||||
use activitystreams_ext::Ext1;
|
||||
use anyhow::Context;
|
||||
use lemmy_db::{ApubObject, DbPool};
|
||||
use lemmy_db_queries::{ApubObject, DbPool};
|
||||
use lemmy_db_schema::{
|
||||
naive_now,
|
||||
source::user::{UserForm, User_},
|
||||
|
|
|
@ -4,7 +4,7 @@ version = "0.1.0"
|
|||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
name = "lemmy_db"
|
||||
name = "lemmy_db_queries"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
|
|
|
@ -22,8 +22,14 @@ impl CommentAggregates {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::comment_aggregates::CommentAggregates;
|
||||
use lemmy_db::{establish_unpooled_connection, Crud, Likeable, ListingType, SortType};
|
||||
use crate::{
|
||||
aggregates::comment_aggregates::CommentAggregates,
|
||||
establish_unpooled_connection,
|
||||
Crud,
|
||||
Likeable,
|
||||
ListingType,
|
||||
SortType,
|
||||
};
|
||||
use lemmy_db_schema::source::{
|
||||
comment::{Comment, CommentForm, CommentLike, CommentLikeForm},
|
||||
community::{Community, CommunityForm},
|
|
@ -22,8 +22,14 @@ impl CommunityAggregates {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::community_aggregates::CommunityAggregates;
|
||||
use lemmy_db::{establish_unpooled_connection, Crud, Followable, ListingType, SortType};
|
||||
use crate::{
|
||||
aggregates::community_aggregates::CommunityAggregates,
|
||||
establish_unpooled_connection,
|
||||
Crud,
|
||||
Followable,
|
||||
ListingType,
|
||||
SortType,
|
||||
};
|
||||
use lemmy_db_schema::source::{
|
||||
comment::{Comment, CommentForm},
|
||||
community::{Community, CommunityFollower, CommunityFollowerForm, CommunityForm},
|
|
@ -24,8 +24,14 @@ impl PostAggregates {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::post_aggregates::PostAggregates;
|
||||
use lemmy_db::{establish_unpooled_connection, Crud, Likeable, ListingType, SortType};
|
||||
use crate::{
|
||||
aggregates::post_aggregates::PostAggregates,
|
||||
establish_unpooled_connection,
|
||||
Crud,
|
||||
Likeable,
|
||||
ListingType,
|
||||
SortType,
|
||||
};
|
||||
use lemmy_db_schema::source::{
|
||||
comment::{Comment, CommentForm},
|
||||
community::{Community, CommunityForm},
|
|
@ -21,8 +21,13 @@ impl SiteAggregates {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::site_aggregates::SiteAggregates;
|
||||
use lemmy_db::{establish_unpooled_connection, Crud, ListingType, SortType};
|
||||
use crate::{
|
||||
aggregates::site_aggregates::SiteAggregates,
|
||||
establish_unpooled_connection,
|
||||
Crud,
|
||||
ListingType,
|
||||
SortType,
|
||||
};
|
||||
use lemmy_db_schema::source::{
|
||||
comment::{Comment, CommentForm},
|
||||
community::{Community, CommunityForm},
|
|
@ -23,8 +23,14 @@ impl UserAggregates {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::user_aggregates::UserAggregates;
|
||||
use lemmy_db::{establish_unpooled_connection, Crud, Likeable, ListingType, SortType};
|
||||
use crate::{
|
||||
aggregates::user_aggregates::UserAggregates,
|
||||
establish_unpooled_connection,
|
||||
Crud,
|
||||
Likeable,
|
||||
ListingType,
|
||||
SortType,
|
||||
};
|
||||
use lemmy_db_schema::source::{
|
||||
comment::{Comment, CommentForm, CommentLike, CommentLikeForm},
|
||||
community::{Community, CommunityForm},
|
|
@ -14,6 +14,7 @@ use regex::Regex;
|
|||
use serde::{Deserialize, Serialize};
|
||||
use std::{env, env::VarError};
|
||||
|
||||
pub mod aggregates;
|
||||
pub mod source;
|
||||
|
||||
pub type DbPool = diesel::r2d2::Pool<diesel::r2d2::ConnectionManager<diesel::PgConnection>>;
|
||||
|
@ -136,6 +137,13 @@ pub trait ToSafe {
|
|||
fn safe_columns_tuple() -> Self::SafeColumns;
|
||||
}
|
||||
|
||||
pub trait ViewToVec {
|
||||
type DbTuple;
|
||||
fn to_vec(tuple: Vec<Self::DbTuple>) -> Vec<Self>
|
||||
where
|
||||
Self: Sized;
|
||||
}
|
||||
|
||||
pub fn get_database_url_from_env() -> Result<String, VarError> {
|
||||
env::var("LEMMY_DATABASE_URL")
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
use crate::{schema::comment_report, source::comment::Comment};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Identifiable, Queryable, Associations, PartialEq, Serialize, Deserialize, Debug, Clone)]
|
||||
#[derive(
|
||||
Identifiable, Queryable, Associations, PartialEq, Serialize, Deserialize, Debug, Clone,
|
||||
)]
|
||||
#[belongs_to(Comment)]
|
||||
#[table_name = "comment_report"]
|
||||
pub struct CommentReport {
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
use crate::{schema::post_report, source::post::Post};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Identifiable, Queryable, Associations, PartialEq, Serialize, Deserialize, Debug, Clone)]
|
||||
#[derive(
|
||||
Identifiable, Queryable, Associations, PartialEq, Serialize, Deserialize, Debug, Clone,
|
||||
)]
|
||||
#[belongs_to(Post)]
|
||||
#[table_name = "post_report"]
|
||||
pub struct PostReport {
|
||||
|
|
|
@ -6,6 +6,5 @@ edition = "2018"
|
|||
[dependencies]
|
||||
lemmy_db_queries = { path = "../lemmy_db_queries" }
|
||||
lemmy_db_schema = { path = "../lemmy_db_schema" }
|
||||
lemmy_db_aggregates = { path = "../lemmy_db_aggregates" }
|
||||
diesel = { version = "1.4.5", features = ["postgres","chrono","r2d2","serde_json"] }
|
||||
serde = { version = "1.0.118", features = ["derive"] }
|
|
@ -1,6 +1,5 @@
|
|||
use crate::ViewToVec;
|
||||
use diesel::{result::Error, *};
|
||||
use lemmy_db::{limit_and_offset, MaybeOptional, ToSafe};
|
||||
use lemmy_db_queries::{limit_and_offset, MaybeOptional, ToSafe, ViewToVec};
|
||||
use lemmy_db_schema::{
|
||||
schema::{comment, comment_report, community, post, user_, user_alias_1, user_alias_2},
|
||||
source::{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use crate::ViewToVec;
|
||||
use diesel::{result::Error, *};
|
||||
use lemmy_db::{
|
||||
use lemmy_db_queries::{
|
||||
aggregates::comment_aggregates::CommentAggregates,
|
||||
functions::hot_rank,
|
||||
fuzzy_search,
|
||||
limit_and_offset,
|
||||
|
@ -8,8 +8,8 @@ use lemmy_db::{
|
|||
MaybeOptional,
|
||||
SortType,
|
||||
ToSafe,
|
||||
ViewToVec,
|
||||
};
|
||||
use lemmy_db_aggregates::comment_aggregates::CommentAggregates;
|
||||
use lemmy_db_schema::{
|
||||
schema::{
|
||||
comment,
|
||||
|
@ -419,8 +419,14 @@ impl ViewToVec for CommentView {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::comment_view::*;
|
||||
use lemmy_db::{establish_unpooled_connection, Crud, Likeable, ListingType, SortType};
|
||||
use lemmy_db_aggregates::comment_aggregates::CommentAggregates;
|
||||
use lemmy_db_queries::{
|
||||
aggregates::comment_aggregates::CommentAggregates,
|
||||
establish_unpooled_connection,
|
||||
Crud,
|
||||
Likeable,
|
||||
ListingType,
|
||||
SortType,
|
||||
};
|
||||
use lemmy_db_schema::source::{comment::*, community::*, post::*, user::*};
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -1,17 +1,6 @@
|
|||
pub mod comment_report_view;
|
||||
pub mod comment_view;
|
||||
pub mod community;
|
||||
pub mod moderator;
|
||||
pub mod post_report_view;
|
||||
pub mod post_view;
|
||||
pub mod private_message_view;
|
||||
pub mod site_view;
|
||||
pub mod user_mention_view;
|
||||
pub mod user_view;
|
||||
|
||||
pub(crate) trait ViewToVec {
|
||||
type DbTuple;
|
||||
fn to_vec(tuple: Vec<Self::DbTuple>) -> Vec<Self>
|
||||
where
|
||||
Self: Sized;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use crate::ViewToVec;
|
||||
use diesel::{result::Error, *};
|
||||
use lemmy_db::{limit_and_offset, MaybeOptional, ToSafe};
|
||||
use lemmy_db_queries::{limit_and_offset, MaybeOptional, ToSafe, ViewToVec};
|
||||
use lemmy_db_schema::{
|
||||
schema::{community, post, post_report, user_, user_alias_1, user_alias_2},
|
||||
source::{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use crate::ViewToVec;
|
||||
use diesel::{result::Error, *};
|
||||
use lemmy_db::{
|
||||
use lemmy_db_queries::{
|
||||
aggregates::post_aggregates::PostAggregates,
|
||||
functions::hot_rank,
|
||||
fuzzy_search,
|
||||
limit_and_offset,
|
||||
|
@ -8,8 +8,8 @@ use lemmy_db::{
|
|||
MaybeOptional,
|
||||
SortType,
|
||||
ToSafe,
|
||||
ViewToVec,
|
||||
};
|
||||
use lemmy_db_aggregates::post_aggregates::PostAggregates;
|
||||
use lemmy_db_schema::{
|
||||
schema::{
|
||||
community,
|
||||
|
@ -407,8 +407,14 @@ impl ViewToVec for PostView {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::post_view::{PostQueryBuilder, PostView};
|
||||
use lemmy_db::{establish_unpooled_connection, Crud, Likeable, ListingType, SortType};
|
||||
use lemmy_db_aggregates::post_aggregates::PostAggregates;
|
||||
use lemmy_db_queries::{
|
||||
aggregates::post_aggregates::PostAggregates,
|
||||
establish_unpooled_connection,
|
||||
Crud,
|
||||
Likeable,
|
||||
ListingType,
|
||||
SortType,
|
||||
};
|
||||
use lemmy_db_schema::source::{community::*, post::*, user::*};
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use crate::ViewToVec;
|
||||
use diesel::{result::Error, *};
|
||||
use lemmy_db::{limit_and_offset, MaybeOptional, ToSafe};
|
||||
use lemmy_db_queries::{limit_and_offset, MaybeOptional, ToSafe, ViewToVec};
|
||||
use lemmy_db_schema::{
|
||||
schema::{private_message, user_, user_alias_1},
|
||||
source::{
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use diesel::{result::Error, *};
|
||||
use lemmy_db::ToSafe;
|
||||
use lemmy_db_aggregates::site_aggregates::SiteAggregates;
|
||||
use lemmy_db_queries::{aggregates::site_aggregates::SiteAggregates, ToSafe};
|
||||
use lemmy_db_schema::{
|
||||
schema::{site, site_aggregates, user_},
|
||||
source::{
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
[package]
|
||||
name = "lemmy_db_aggregates"
|
||||
name = "lemmy_db_views_actor"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_schema = { path = "../lemmy_db_schema" }
|
||||
lemmy_db_queries = { path = "../lemmy_db_queries" }
|
||||
lemmy_db_schema = { path = "../lemmy_db_schema" }
|
||||
diesel = { version = "1.4.5", features = ["postgres","chrono","r2d2","serde_json"] }
|
||||
serde = { version = "1.0.118", features = ["derive"] }
|
||||
chrono = { version = "0.4.19", features = ["serde"] }
|
|
@ -1,6 +1,5 @@
|
|||
use crate::ViewToVec;
|
||||
use diesel::{result::Error, *};
|
||||
use lemmy_db::ToSafe;
|
||||
use lemmy_db_queries::{ToSafe, ViewToVec};
|
||||
use lemmy_db_schema::{
|
||||
schema::{community, community_follower, user_},
|
||||
source::{
|
|
@ -1,6 +1,5 @@
|
|||
use crate::ViewToVec;
|
||||
use diesel::{result::Error, *};
|
||||
use lemmy_db::ToSafe;
|
||||
use lemmy_db_queries::{ToSafe, ViewToVec};
|
||||
use lemmy_db_schema::{
|
||||
schema::{community, community_moderator, user_},
|
||||
source::{
|
|
@ -1,5 +1,5 @@
|
|||
use diesel::{result::Error, *};
|
||||
use lemmy_db::ToSafe;
|
||||
use lemmy_db_queries::ToSafe;
|
||||
use lemmy_db_schema::{
|
||||
schema::{community, community_user_ban, user_},
|
||||
source::{
|
|
@ -1,18 +1,15 @@
|
|||
use crate::{
|
||||
community::community_moderator_view::CommunityModeratorView,
|
||||
user_view::UserViewSafe,
|
||||
ViewToVec,
|
||||
};
|
||||
use crate::{community_moderator_view::CommunityModeratorView, user_view::UserViewSafe};
|
||||
use diesel::{result::Error, *};
|
||||
use lemmy_db::{
|
||||
use lemmy_db_queries::{
|
||||
aggregates::community_aggregates::CommunityAggregates,
|
||||
functions::hot_rank,
|
||||
fuzzy_search,
|
||||
limit_and_offset,
|
||||
MaybeOptional,
|
||||
SortType,
|
||||
ToSafe,
|
||||
ViewToVec,
|
||||
};
|
||||
use lemmy_db_aggregates::community_aggregates::CommunityAggregates;
|
||||
use lemmy_db_schema::{
|
||||
schema::{category, community, community_aggregates, community_follower, user_},
|
||||
source::{
|
|
@ -2,3 +2,5 @@ pub mod community_follower_view;
|
|||
pub mod community_moderator_view;
|
||||
pub mod community_user_ban_view;
|
||||
pub mod community_view;
|
||||
pub mod user_mention_view;
|
||||
pub mod user_view;
|
|
@ -1,7 +1,13 @@
|
|||
use crate::ViewToVec;
|
||||
use diesel::{result::Error, *};
|
||||
use lemmy_db::{functions::hot_rank, limit_and_offset, MaybeOptional, SortType, ToSafe};
|
||||
use lemmy_db_aggregates::comment_aggregates::CommentAggregates;
|
||||
use lemmy_db_queries::{
|
||||
aggregates::comment_aggregates::CommentAggregates,
|
||||
functions::hot_rank,
|
||||
limit_and_offset,
|
||||
MaybeOptional,
|
||||
SortType,
|
||||
ToSafe,
|
||||
ViewToVec,
|
||||
};
|
||||
use lemmy_db_schema::{
|
||||
schema::{
|
||||
comment,
|
|
@ -1,7 +1,13 @@
|
|||
use crate::ViewToVec;
|
||||
use diesel::{dsl::*, result::Error, *};
|
||||
use lemmy_db::{fuzzy_search, limit_and_offset, MaybeOptional, SortType, ToSafe};
|
||||
use lemmy_db_aggregates::user_aggregates::UserAggregates;
|
||||
use lemmy_db_queries::{
|
||||
aggregates::user_aggregates::UserAggregates,
|
||||
fuzzy_search,
|
||||
limit_and_offset,
|
||||
MaybeOptional,
|
||||
SortType,
|
||||
ToSafe,
|
||||
ViewToVec,
|
||||
};
|
||||
use lemmy_db_schema::{
|
||||
schema::{user_, user_aggregates},
|
||||
source::user::{UserSafe, User_},
|
10
lemmy_db_views_moderator/Cargo.toml
Normal file
10
lemmy_db_views_moderator/Cargo.toml
Normal file
|
@ -0,0 +1,10 @@
|
|||
[package]
|
||||
name = "lemmy_db_views_moderator"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_queries = { path = "../lemmy_db_queries" }
|
||||
lemmy_db_schema = { path = "../lemmy_db_schema" }
|
||||
diesel = { version = "1.4.5", features = ["postgres","chrono","r2d2","serde_json"] }
|
||||
serde = { version = "1.0.118", features = ["derive"] }
|
|
@ -1,6 +1,5 @@
|
|||
use crate::ViewToVec;
|
||||
use diesel::{result::Error, *};
|
||||
use lemmy_db::{limit_and_offset, ToSafe};
|
||||
use lemmy_db_queries::{limit_and_offset, ToSafe, ViewToVec};
|
||||
use lemmy_db_schema::{
|
||||
schema::{community, mod_add_community, user_, user_alias_1},
|
||||
source::{
|
|
@ -1,6 +1,5 @@
|
|||
use crate::ViewToVec;
|
||||
use diesel::{result::Error, *};
|
||||
use lemmy_db::{limit_and_offset, ToSafe};
|
||||
use lemmy_db_queries::{limit_and_offset, ToSafe, ViewToVec};
|
||||
use lemmy_db_schema::{
|
||||
schema::{mod_add, user_, user_alias_1},
|
||||
source::{
|
|
@ -1,6 +1,5 @@
|
|||
use crate::ViewToVec;
|
||||
use diesel::{result::Error, *};
|
||||
use lemmy_db::{limit_and_offset, ToSafe};
|
||||
use lemmy_db_queries::{limit_and_offset, ToSafe, ViewToVec};
|
||||
use lemmy_db_schema::{
|
||||
schema::{community, mod_ban_from_community, user_, user_alias_1},
|
||||
source::{
|
|
@ -1,6 +1,5 @@
|
|||
use crate::ViewToVec;
|
||||
use diesel::{result::Error, *};
|
||||
use lemmy_db::{limit_and_offset, ToSafe};
|
||||
use lemmy_db_queries::{limit_and_offset, ToSafe, ViewToVec};
|
||||
use lemmy_db_schema::{
|
||||
schema::{mod_ban, user_, user_alias_1},
|
||||
source::{
|
|
@ -1,6 +1,5 @@
|
|||
use crate::ViewToVec;
|
||||
use diesel::{result::Error, *};
|
||||
use lemmy_db::{limit_and_offset, ToSafe};
|
||||
use lemmy_db_queries::{limit_and_offset, ToSafe, ViewToVec};
|
||||
use lemmy_db_schema::{
|
||||
schema::{community, mod_lock_post, post, user_},
|
||||
source::{
|
|
@ -1,6 +1,5 @@
|
|||
use crate::ViewToVec;
|
||||
use diesel::{result::Error, *};
|
||||
use lemmy_db::{limit_and_offset, ToSafe};
|
||||
use lemmy_db_queries::{limit_and_offset, ToSafe, ViewToVec};
|
||||
use lemmy_db_schema::{
|
||||
schema::{comment, community, mod_remove_comment, post, user_, user_alias_1},
|
||||
source::{
|
|
@ -1,6 +1,5 @@
|
|||
use crate::ViewToVec;
|
||||
use diesel::{result::Error, *};
|
||||
use lemmy_db::{limit_and_offset, ToSafe};
|
||||
use lemmy_db_queries::{limit_and_offset, ToSafe, ViewToVec};
|
||||
use lemmy_db_schema::{
|
||||
schema::{community, mod_remove_community, user_},
|
||||
source::{
|
|
@ -1,6 +1,5 @@
|
|||
use crate::ViewToVec;
|
||||
use diesel::{result::Error, *};
|
||||
use lemmy_db::{limit_and_offset, ToSafe};
|
||||
use lemmy_db_queries::{limit_and_offset, ToSafe, ViewToVec};
|
||||
use lemmy_db_schema::{
|
||||
schema::{community, mod_remove_post, post, user_},
|
||||
source::{
|
|
@ -1,6 +1,5 @@
|
|||
use crate::ViewToVec;
|
||||
use diesel::{result::Error, *};
|
||||
use lemmy_db::{limit_and_offset, ToSafe};
|
||||
use lemmy_db_queries::{limit_and_offset, ToSafe, ViewToVec};
|
||||
use lemmy_db_schema::{
|
||||
schema::{community, mod_sticky_post, post, user_},
|
||||
source::{
|
|
@ -1,18 +0,0 @@
|
|||
[package]
|
||||
name = "lemmy_rate_limit"
|
||||
version = "0.1.0"
|
||||
authors = ["Felix Ableitner <me@nutomic.com>"]
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
name = "lemmy_rate_limit"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
lemmy_utils = { path = "../lemmy_utils" }
|
||||
tokio = { version = "0.3.6", features = ["sync"] }
|
||||
strum = "0.20.0"
|
||||
strum_macros = "0.20.1"
|
||||
futures = "0.3.8"
|
||||
actix-web = { version = "3.3.2", default-features = false, features = ["rustls"] }
|
||||
log = "0.4.11"
|
|
@ -11,6 +11,8 @@ path = "src/lib.rs"
|
|||
[dependencies]
|
||||
lemmy_db_queries = { path = "../lemmy_db_queries" }
|
||||
lemmy_db_views = { path = "../lemmy_db_views" }
|
||||
lemmy_db_views_moderator = { path = "../lemmy_db_views_moderator" }
|
||||
lemmy_db_views_actor = { path = "../lemmy_db_views_actor" }
|
||||
lemmy_db_schema = { path = "../lemmy_db_schema" }
|
||||
lemmy_utils = { path = "../lemmy_utils" }
|
||||
serde = { version = "1.0.118", features = ["derive"] }
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
use lemmy_db_views::{
|
||||
community::{
|
||||
community_follower_view::CommunityFollowerView,
|
||||
community_moderator_view::CommunityModeratorView,
|
||||
community_view::CommunityView,
|
||||
},
|
||||
use lemmy_db_views_actor::{
|
||||
community_follower_view::CommunityFollowerView,
|
||||
community_moderator_view::CommunityModeratorView,
|
||||
community_view::CommunityView,
|
||||
user_view::UserViewSafe,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
|
|
@ -5,7 +5,7 @@ pub mod site;
|
|||
pub mod user;
|
||||
|
||||
use diesel::PgConnection;
|
||||
use lemmy_db::{source::user::User, Crud, DbPool};
|
||||
use lemmy_db_queries::{source::user::User, Crud, DbPool};
|
||||
use lemmy_db_schema::source::{
|
||||
comment::Comment,
|
||||
post::Post,
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
use lemmy_db_views::{
|
||||
comment_view::CommentView,
|
||||
community::community_moderator_view::CommunityModeratorView,
|
||||
post_report_view::PostReportView,
|
||||
post_view::PostView,
|
||||
};
|
||||
use lemmy_db_views_actor::community_moderator_view::CommunityModeratorView;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
|
|
|
@ -1,21 +1,16 @@
|
|||
use lemmy_db_schema::source::{category::*, user::User_};
|
||||
use lemmy_db_views::{
|
||||
comment_view::CommentView,
|
||||
community::community_view::CommunityView,
|
||||
moderator::{
|
||||
mod_add_community_view::ModAddCommunityView,
|
||||
mod_add_view::ModAddView,
|
||||
mod_ban_from_community_view::ModBanFromCommunityView,
|
||||
mod_ban_view::ModBanView,
|
||||
mod_lock_post_view::ModLockPostView,
|
||||
mod_remove_comment_view::ModRemoveCommentView,
|
||||
mod_remove_community_view::ModRemoveCommunityView,
|
||||
mod_remove_post_view::ModRemovePostView,
|
||||
mod_sticky_post_view::ModStickyPostView,
|
||||
},
|
||||
post_view::PostView,
|
||||
site_view::SiteView,
|
||||
user_view::UserViewSafe,
|
||||
use lemmy_db_views::{comment_view::CommentView, post_view::PostView, site_view::SiteView};
|
||||
use lemmy_db_views_actor::{community_view::CommunityView, user_view::UserViewSafe};
|
||||
use lemmy_db_views_moderator::{
|
||||
mod_add_community_view::ModAddCommunityView,
|
||||
mod_add_view::ModAddView,
|
||||
mod_ban_from_community_view::ModBanFromCommunityView,
|
||||
mod_ban_view::ModBanView,
|
||||
mod_lock_post_view::ModLockPostView,
|
||||
mod_remove_comment_view::ModRemoveCommentView,
|
||||
mod_remove_community_view::ModRemoveCommunityView,
|
||||
mod_remove_post_view::ModRemovePostView,
|
||||
mod_sticky_post_view::ModStickyPostView,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
use lemmy_db_views::{
|
||||
comment_view::CommentView,
|
||||
community::{
|
||||
community_follower_view::CommunityFollowerView,
|
||||
community_moderator_view::CommunityModeratorView,
|
||||
},
|
||||
post_view::PostView,
|
||||
private_message_view::PrivateMessageView,
|
||||
};
|
||||
use lemmy_db_views_actor::{
|
||||
community_follower_view::CommunityFollowerView,
|
||||
community_moderator_view::CommunityModeratorView,
|
||||
user_mention_view::UserMentionView,
|
||||
user_view::{UserViewDangerous, UserViewSafe},
|
||||
};
|
||||
|
|
|
@ -27,3 +27,7 @@ actix-web = { version = "3.3.2", default-features = false, features = ["rustls"]
|
|||
actix-rt = { version = "1.1.1", default-features = false }
|
||||
anyhow = "1.0.36"
|
||||
reqwest = { version = "0.10.10", features = ["json"] }
|
||||
tokio = { version = "0.3.6", features = ["sync"] }
|
||||
strum = "0.20.0"
|
||||
strum_macros = "0.20.1"
|
||||
futures = "0.3.8"
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
#[macro_use]
|
||||
extern crate strum_macros;
|
||||
|
||||
pub mod apub;
|
||||
pub mod email;
|
||||
pub mod rate_limit;
|
||||
pub mod request;
|
||||
pub mod settings;
|
||||
#[cfg(test)]
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
#[macro_use]
|
||||
extern crate strum_macros;
|
||||
|
||||
use actix_web::dev::{Service, ServiceRequest, ServiceResponse, Transform};
|
||||
use futures::future::{ok, Ready};
|
||||
use lemmy_utils::{
|
||||
use crate::{
|
||||
settings::{RateLimitConfig, Settings},
|
||||
utils::get_ip,
|
||||
LemmyError,
|
||||
};
|
||||
use actix_web::dev::{Service, ServiceRequest, ServiceResponse, Transform};
|
||||
use futures::future::{ok, Ready};
|
||||
use rate_limiter::{RateLimitType, RateLimiter};
|
||||
use std::{
|
||||
future::Future,
|
|
@ -1,4 +1,4 @@
|
|||
use lemmy_utils::{APIError, IPAddr, LemmyError};
|
||||
use crate::{APIError, IPAddr, LemmyError};
|
||||
use log::debug;
|
||||
use std::{collections::HashMap, time::SystemTime};
|
||||
use strum::IntoEnumIterator;
|
|
@ -13,7 +13,6 @@ lemmy_utils = { path = "../lemmy_utils" }
|
|||
lemmy_structs = { path = "../lemmy_structs" }
|
||||
lemmy_db_queries = { path = "../lemmy_db_queries" }
|
||||
lemmy_db_schema = { path = "../lemmy_db_schema" }
|
||||
lemmy_rate_limit = { path = "../lemmy_rate_limit" }
|
||||
reqwest = { version = "0.10.10", features = ["json"] }
|
||||
log = "0.4.11"
|
||||
rand = "0.8.0"
|
||||
|
|
|
@ -6,10 +6,10 @@ use diesel::{
|
|||
r2d2::{ConnectionManager, Pool},
|
||||
PgConnection,
|
||||
};
|
||||
use lemmy_rate_limit::RateLimit;
|
||||
use lemmy_structs::{comment::*, post::*};
|
||||
use lemmy_utils::{
|
||||
location_info,
|
||||
rate_limit::RateLimit,
|
||||
APIError,
|
||||
CommunityId,
|
||||
ConnectionId,
|
||||
|
|
|
@ -4,7 +4,7 @@ extern crate strum_macros;
|
|||
use crate::chat_server::ChatServer;
|
||||
use actix::Addr;
|
||||
use background_jobs::QueueHandle;
|
||||
use lemmy_db::DbPool;
|
||||
use lemmy_db_queries::DbPool;
|
||||
use lemmy_utils::LemmyError;
|
||||
use reqwest::Client;
|
||||
use serde::Serialize;
|
||||
|
|
|
@ -3,7 +3,7 @@ use diesel::{
|
|||
sql_types::{Nullable, Text},
|
||||
*,
|
||||
};
|
||||
use lemmy_db::{
|
||||
use lemmy_db_queries::{
|
||||
source::{comment::Comment_, post::Post_, private_message::PrivateMessage_},
|
||||
Crud,
|
||||
};
|
||||
|
|
|
@ -9,11 +9,14 @@ use diesel::{
|
|||
};
|
||||
use lemmy_api::match_websocket_operation;
|
||||
use lemmy_apub::activity_queue::create_activity_queue;
|
||||
use lemmy_db::get_database_url_from_env;
|
||||
use lemmy_rate_limit::{rate_limiter::RateLimiter, RateLimit};
|
||||
use lemmy_db_queries::get_database_url_from_env;
|
||||
use lemmy_server::{code_migrations::run_advanced_migrations, routes::*};
|
||||
use lemmy_structs::blocking;
|
||||
use lemmy_utils::{settings::Settings, LemmyError};
|
||||
use lemmy_utils::{
|
||||
rate_limit::{rate_limiter::RateLimiter, RateLimit},
|
||||
settings::Settings,
|
||||
LemmyError,
|
||||
};
|
||||
use lemmy_websocket::{chat_server::ChatServer, LemmyContext};
|
||||
use reqwest::Client;
|
||||
use std::sync::Arc;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use actix_web::{error::ErrorBadRequest, *};
|
||||
use lemmy_api::Perform;
|
||||
use lemmy_rate_limit::RateLimit;
|
||||
use lemmy_structs::{comment::*, community::*, post::*, site::*, user::*};
|
||||
use lemmy_utils::rate_limit::RateLimit;
|
||||
use lemmy_websocket::LemmyContext;
|
||||
use serde::Deserialize;
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ use anyhow::anyhow;
|
|||
use chrono::{DateTime, NaiveDateTime, Utc};
|
||||
use diesel::PgConnection;
|
||||
use lemmy_api::claims::Claims;
|
||||
use lemmy_db::{
|
||||
use lemmy_db_queries::{
|
||||
source::{community::Community_, user::User},
|
||||
ListingType,
|
||||
SortType,
|
||||
|
@ -13,8 +13,8 @@ use lemmy_db_views::{
|
|||
comment_view::{CommentQueryBuilder, CommentView},
|
||||
post_view::{PostQueryBuilder, PostView},
|
||||
site_view::SiteView,
|
||||
user_mention_view::{UserMentionQueryBuilder, UserMentionView},
|
||||
};
|
||||
use lemmy_db_views_actor::user_mention_view::{UserMentionQueryBuilder, UserMentionView};
|
||||
use lemmy_structs::blocking;
|
||||
use lemmy_utils::{settings::Settings, utils::markdown_to_html, LemmyError};
|
||||
use lemmy_websocket::LemmyContext;
|
||||
|
|
|
@ -2,8 +2,7 @@ use actix::clock::Duration;
|
|||
use actix_web::{body::BodyStream, http::StatusCode, *};
|
||||
use awc::Client;
|
||||
use lemmy_api::claims::Claims;
|
||||
use lemmy_rate_limit::RateLimit;
|
||||
use lemmy_utils::settings::Settings;
|
||||
use lemmy_utils::{rate_limit::RateLimit, settings::Settings};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
pub fn config(cfg: &mut web::ServiceConfig, rate_limit: &RateLimit) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use actix_web::{error::ErrorBadRequest, web::Query, *};
|
||||
use anyhow::anyhow;
|
||||
use lemmy_db::source::{community::Community_, user::User};
|
||||
use lemmy_db_queries::source::{community::Community_, user::User};
|
||||
use lemmy_db_schema::source::{community::Community, user::User_};
|
||||
use lemmy_structs::{blocking, WebFingerLink, WebFingerResponse};
|
||||
use lemmy_utils::{
|
||||
|
|
|
@ -28,13 +28,16 @@ use lemmy_apub::{
|
|||
user_inbox::user_inbox,
|
||||
},
|
||||
};
|
||||
use lemmy_db::{Crud, ListingType, SortType};
|
||||
use lemmy_db_queries::{Crud, ListingType, SortType};
|
||||
use lemmy_db_schema::source::{
|
||||
community::{Community, CommunityForm},
|
||||
user::{UserForm, User_},
|
||||
};
|
||||
use lemmy_rate_limit::{rate_limiter::RateLimiter, RateLimit};
|
||||
use lemmy_utils::{apub::generate_actor_keypair, settings::Settings};
|
||||
use lemmy_utils::{
|
||||
apub::generate_actor_keypair,
|
||||
rate_limit::{rate_limiter::RateLimiter, RateLimit},
|
||||
settings::Settings,
|
||||
};
|
||||
use lemmy_websocket::{chat_server::ChatServer, LemmyContext};
|
||||
use reqwest::Client;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
|
Loading…
Reference in a new issue