From: Dessalines Date: Sun, 13 Dec 2020 17:04:42 +0000 (-0500) Subject: Re-organizing source tables into a different folder. X-Git-Url: http://these/git/%22%7Burl%7D/static/%7B%7D/%7B%60%24%7BrepoUrl%7D?a=commitdiff_plain;h=f456f5da4604cae2d3f3422283bf236b0a13fca6;p=lemmy.git Re-organizing source tables into a different folder. --- diff --git a/lemmy_api/src/claims.rs b/lemmy_api/src/claims.rs index f475f1df..4a0ab12b 100644 --- a/lemmy_api/src/claims.rs +++ b/lemmy_api/src/claims.rs @@ -1,5 +1,5 @@ use jsonwebtoken::{decode, encode, DecodingKey, EncodingKey, Header, TokenData, Validation}; -use lemmy_db::user::User_; +use lemmy_db::source::user::User_; use lemmy_utils::settings::Settings; use serde::{Deserialize, Serialize}; diff --git a/lemmy_api/src/comment.rs b/lemmy_api/src/comment.rs index 5ad62f14..fe5fe859 100644 --- a/lemmy_api/src/comment.rs +++ b/lemmy_api/src/comment.rs @@ -10,12 +10,9 @@ use crate::{ use actix_web::web::Data; use lemmy_apub::{ApubLikeableType, ApubObjectType}; use lemmy_db::{ - comment::*, comment_report::*, comment_view::*, - moderator::*, - post::*, - user::*, + source::{comment::*, moderator::*, post::*, user::*}, views::site_view::SiteView, Crud, Likeable, diff --git a/lemmy_api/src/community.rs b/lemmy_api/src/community.rs index fe7748f9..b704d24b 100644 --- a/lemmy_api/src/community.rs +++ b/lemmy_api/src/community.rs @@ -10,14 +10,10 @@ use actix_web::web::Data; use anyhow::Context; use lemmy_apub::ActorType; use lemmy_db::{ - comment::Comment, comment_view::CommentQueryBuilder, - community::*, diesel_option_overwrite, - moderator::*, naive_now, - post::Post, - site::*, + source::{comment::Comment, community::*, moderator::*, post::Post, site::*}, views::{ community_follower_view::CommunityFollowerView, community_moderator_view::CommunityModeratorView, diff --git a/lemmy_api/src/lib.rs b/lemmy_api/src/lib.rs index 13998dc4..92287f8d 100644 --- a/lemmy_api/src/lib.rs +++ b/lemmy_api/src/lib.rs @@ -1,9 +1,11 @@ use crate::claims::Claims; use actix_web::{web, web::Data}; use lemmy_db::{ - community::{Community, CommunityModerator}, - post::Post, - user::User_, + source::{ + community::{Community, CommunityModerator}, + post::Post, + user::User_, + }, views::community_user_ban_view::CommunityUserBanView, Crud, DbPool, diff --git a/lemmy_api/src/post.rs b/lemmy_api/src/post.rs index 66c174e7..2b3b4b5b 100644 --- a/lemmy_api/src/post.rs +++ b/lemmy_api/src/post.rs @@ -11,10 +11,9 @@ use actix_web::web::Data; use lemmy_apub::{ApubLikeableType, ApubObjectType}; use lemmy_db::{ comment_view::*, - moderator::*, naive_now, - post::*, post_report::*, + source::{moderator::*, post::*}, views::{ community_moderator_view::CommunityModeratorView, community_view::CommunityView, diff --git a/lemmy_api/src/site.rs b/lemmy_api/src/site.rs index f1ef6e26..98c501f1 100644 --- a/lemmy_api/src/site.rs +++ b/lemmy_api/src/site.rs @@ -11,13 +11,11 @@ use anyhow::Context; use lemmy_apub::fetcher::search_by_apub_id; use lemmy_db::{ aggregates::site_aggregates::SiteAggregates, - category::*, comment_view::*, diesel_option_overwrite, - moderator::*, moderator_views::*, naive_now, - site::*, + source::{category::*, moderator::*, site::*}, views::{ community_view::CommunityQueryBuilder, post_view::PostQueryBuilder, diff --git a/lemmy_api/src/user.rs b/lemmy_api/src/user.rs index b8131fa3..e8099af8 100644 --- a/lemmy_api/src/user.rs +++ b/lemmy_api/src/user.rs @@ -15,21 +15,23 @@ use captcha::{gen, Difficulty}; use chrono::Duration; use lemmy_apub::ApubObjectType; use lemmy_db::{ - comment::*, comment_report::CommentReportView, comment_view::*, - community::*, diesel_option_overwrite, - moderator::*, naive_now, - password_reset_request::*, - post::*, post_report::PostReportView, - private_message::*, private_message_view::*, - site::*, - user::*, - user_mention::*, + source::{ + comment::*, + community::*, + moderator::*, + password_reset_request::*, + post::*, + private_message::*, + site::*, + user::*, + user_mention::*, + }, user_mention_view::*, views::{ community_follower_view::CommunityFollowerView, diff --git a/lemmy_apub/src/activities/receive/comment.rs b/lemmy_apub/src/activities/receive/comment.rs index ff0fb819..f545a042 100644 --- a/lemmy_apub/src/activities/receive/comment.rs +++ b/lemmy_apub/src/activities/receive/comment.rs @@ -5,9 +5,11 @@ use activitystreams::{ }; use anyhow::Context; use lemmy_db::{ - comment::{Comment, CommentLike, CommentLikeForm}, comment_view::CommentView, - post::Post, + source::{ + comment::{Comment, CommentLike, CommentLikeForm}, + post::Post, + }, Likeable, }; use lemmy_structs::{blocking, comment::CommentResponse, send_local_notifs}; diff --git a/lemmy_apub/src/activities/receive/comment_undo.rs b/lemmy_apub/src/activities/receive/comment_undo.rs index 2ee8c6ea..bf91fe3d 100644 --- a/lemmy_apub/src/activities/receive/comment_undo.rs +++ b/lemmy_apub/src/activities/receive/comment_undo.rs @@ -1,8 +1,8 @@ use crate::activities::receive::get_actor_as_user; use activitystreams::activity::{Dislike, Like}; use lemmy_db::{ - comment::{Comment, CommentLike}, comment_view::CommentView, + source::comment::{Comment, CommentLike}, Likeable, }; use lemmy_structs::{blocking, comment::CommentResponse}; diff --git a/lemmy_apub/src/activities/receive/community.rs b/lemmy_apub/src/activities/receive/community.rs index 16b0c4e3..cacb54ee 100644 --- a/lemmy_apub/src/activities/receive/community.rs +++ b/lemmy_apub/src/activities/receive/community.rs @@ -4,7 +4,7 @@ use activitystreams::{ base::{AnyBase, ExtendsExt}, }; use anyhow::Context; -use lemmy_db::{community::Community, views::community_view::CommunityView, ApubObject}; +use lemmy_db::{source::community::Community, views::community_view::CommunityView, ApubObject}; use lemmy_structs::{blocking, community::CommunityResponse}; use lemmy_utils::{location_info, LemmyError}; use lemmy_websocket::{messages::SendCommunityRoomMessage, LemmyContext, UserOperation}; diff --git a/lemmy_apub/src/activities/receive/mod.rs b/lemmy_apub/src/activities/receive/mod.rs index 1f17fe9f..a66ddfb9 100644 --- a/lemmy_apub/src/activities/receive/mod.rs +++ b/lemmy_apub/src/activities/receive/mod.rs @@ -5,7 +5,7 @@ use activitystreams::{ error::DomainError, }; use anyhow::{anyhow, Context}; -use lemmy_db::user::User_; +use lemmy_db::source::user::User_; use lemmy_utils::{location_info, LemmyError}; use lemmy_websocket::LemmyContext; use log::debug; diff --git a/lemmy_apub/src/activities/receive/post.rs b/lemmy_apub/src/activities/receive/post.rs index f3ac96c2..f0907112 100644 --- a/lemmy_apub/src/activities/receive/post.rs +++ b/lemmy_apub/src/activities/receive/post.rs @@ -5,7 +5,7 @@ use activitystreams::{ }; use anyhow::Context; use lemmy_db::{ - post::{Post, PostLike, PostLikeForm}, + source::post::{Post, PostLike, PostLikeForm}, views::post_view::PostView, Likeable, }; diff --git a/lemmy_apub/src/activities/receive/post_undo.rs b/lemmy_apub/src/activities/receive/post_undo.rs index 9cc01b7d..6827ded0 100644 --- a/lemmy_apub/src/activities/receive/post_undo.rs +++ b/lemmy_apub/src/activities/receive/post_undo.rs @@ -1,7 +1,7 @@ use crate::activities::receive::get_actor_as_user; use activitystreams::activity::{Dislike, Like}; use lemmy_db::{ - post::{Post, PostLike}, + source::post::{Post, PostLike}, views::post_view::PostView, Likeable, }; diff --git a/lemmy_apub/src/activities/receive/private_message.rs b/lemmy_apub/src/activities/receive/private_message.rs index f05b5237..25d4c26c 100644 --- a/lemmy_apub/src/activities/receive/private_message.rs +++ b/lemmy_apub/src/activities/receive/private_message.rs @@ -13,7 +13,7 @@ use activitystreams::{ public, }; use anyhow::{anyhow, Context}; -use lemmy_db::{private_message::PrivateMessage, private_message_view::PrivateMessageView}; +use lemmy_db::{private_message_view::PrivateMessageView, source::private_message::PrivateMessage}; use lemmy_structs::{blocking, user::PrivateMessageResponse}; use lemmy_utils::{location_info, LemmyError}; use lemmy_websocket::{messages::SendUserRoomMessage, LemmyContext, UserOperation}; diff --git a/lemmy_apub/src/activities/send/comment.rs b/lemmy_apub/src/activities/send/comment.rs index 744a1cdd..6b417c25 100644 --- a/lemmy_apub/src/activities/send/comment.rs +++ b/lemmy_apub/src/activities/send/comment.rs @@ -26,7 +26,11 @@ use activitystreams::{ }; use anyhow::anyhow; use itertools::Itertools; -use lemmy_db::{comment::Comment, community::Community, post::Post, user::User_, Crud, DbPool}; +use lemmy_db::{ + source::{comment::Comment, community::Community, post::Post, user::User_}, + Crud, + DbPool, +}; use lemmy_structs::{blocking, WebFingerResponse}; use lemmy_utils::{ request::{retry, RecvError}, diff --git a/lemmy_apub/src/activities/send/community.rs b/lemmy_apub/src/activities/send/community.rs index b1a2352d..8596fc4e 100644 --- a/lemmy_apub/src/activities/send/community.rs +++ b/lemmy_apub/src/activities/send/community.rs @@ -24,7 +24,7 @@ use activitystreams::{ use anyhow::Context; use itertools::Itertools; use lemmy_db::{ - community::Community, + source::community::Community, views::community_follower_view::CommunityFollowerView, DbPool, }; diff --git a/lemmy_apub/src/activities/send/post.rs b/lemmy_apub/src/activities/send/post.rs index f6eabb04..ec1ca67d 100644 --- a/lemmy_apub/src/activities/send/post.rs +++ b/lemmy_apub/src/activities/send/post.rs @@ -21,7 +21,10 @@ use activitystreams::{ prelude::*, public, }; -use lemmy_db::{community::Community, post::Post, user::User_, Crud}; +use lemmy_db::{ + source::{community::Community, post::Post, user::User_}, + Crud, +}; use lemmy_structs::blocking; use lemmy_utils::LemmyError; use lemmy_websocket::LemmyContext; diff --git a/lemmy_apub/src/activities/send/private_message.rs b/lemmy_apub/src/activities/send/private_message.rs index e8bc979a..9abe70d6 100644 --- a/lemmy_apub/src/activities/send/private_message.rs +++ b/lemmy_apub/src/activities/send/private_message.rs @@ -16,7 +16,10 @@ use activitystreams::{ }, prelude::*, }; -use lemmy_db::{private_message::PrivateMessage, user::User_, Crud}; +use lemmy_db::{ + source::{private_message::PrivateMessage, user::User_}, + Crud, +}; use lemmy_structs::blocking; use lemmy_utils::LemmyError; use lemmy_websocket::LemmyContext; diff --git a/lemmy_apub/src/activities/send/user.rs b/lemmy_apub/src/activities/send/user.rs index 8c539c4b..26c5a5d5 100644 --- a/lemmy_apub/src/activities/send/user.rs +++ b/lemmy_apub/src/activities/send/user.rs @@ -14,8 +14,10 @@ use activitystreams::{ object::ObjectExt, }; use lemmy_db::{ - community::{Community, CommunityFollower, CommunityFollowerForm}, - user::User_, + source::{ + community::{Community, CommunityFollower, CommunityFollowerForm}, + user::User_, + }, ApubObject, DbPool, Followable, diff --git a/lemmy_apub/src/activity_queue.rs b/lemmy_apub/src/activity_queue.rs index 46780279..07990457 100644 --- a/lemmy_apub/src/activity_queue.rs +++ b/lemmy_apub/src/activity_queue.rs @@ -19,7 +19,10 @@ use background_jobs::{ WorkerConfig, }; use itertools::Itertools; -use lemmy_db::{community::Community, user::User_, DbPool}; +use lemmy_db::{ + source::{community::Community, user::User_}, + DbPool, +}; use lemmy_utils::{location_info, settings::Settings, LemmyError}; use lemmy_websocket::LemmyContext; use log::{debug, warn}; diff --git a/lemmy_apub/src/extensions/group_extensions.rs b/lemmy_apub/src/extensions/group_extensions.rs index cb152672..ab7acf33 100644 --- a/lemmy_apub/src/extensions/group_extensions.rs +++ b/lemmy_apub/src/extensions/group_extensions.rs @@ -1,7 +1,7 @@ use activitystreams::unparsed::UnparsedMutExt; use activitystreams_ext::UnparsedExtension; use diesel::PgConnection; -use lemmy_db::{category::Category, Crud}; +use lemmy_db::{source::category::Category, Crud}; use lemmy_utils::LemmyError; use serde::{Deserialize, Serialize}; diff --git a/lemmy_apub/src/fetcher.rs b/lemmy_apub/src/fetcher.rs index 5614af65..2d40673f 100644 --- a/lemmy_apub/src/fetcher.rs +++ b/lemmy_apub/src/fetcher.rs @@ -13,12 +13,14 @@ use anyhow::{anyhow, Context}; use chrono::NaiveDateTime; use diesel::result::Error::NotFound; use lemmy_db::{ - comment::Comment, comment_view::CommentView, - community::{Community, CommunityModerator, CommunityModeratorForm}, naive_now, - post::Post, - user::User_, + source::{ + comment::Comment, + community::{Community, CommunityModerator, CommunityModeratorForm}, + post::Post, + user::User_, + }, views::{community_view::CommunityView, post_view::PostView, user_view::UserViewSafe}, ApubObject, Joinable, diff --git a/lemmy_apub/src/http/comment.rs b/lemmy_apub/src/http/comment.rs index bb3d13ac..16f41190 100644 --- a/lemmy_apub/src/http/comment.rs +++ b/lemmy_apub/src/http/comment.rs @@ -4,7 +4,7 @@ use crate::{ }; use actix_web::{body::Body, web, web::Path, HttpResponse}; use diesel::result::Error::NotFound; -use lemmy_db::{comment::Comment, Crud}; +use lemmy_db::{source::comment::Comment, Crud}; use lemmy_structs::blocking; use lemmy_utils::LemmyError; use lemmy_websocket::LemmyContext; diff --git a/lemmy_apub/src/http/community.rs b/lemmy_apub/src/http/community.rs index d2a18ee0..3caaf661 100644 --- a/lemmy_apub/src/http/community.rs +++ b/lemmy_apub/src/http/community.rs @@ -10,8 +10,7 @@ use activitystreams::{ }; use actix_web::{body::Body, web, HttpResponse}; use lemmy_db::{ - community::Community, - post::Post, + source::{community::Community, post::Post}, views::community_follower_view::CommunityFollowerView, }; use lemmy_structs::blocking; diff --git a/lemmy_apub/src/http/mod.rs b/lemmy_apub/src/http/mod.rs index 4f31f6a5..fee15b77 100644 --- a/lemmy_apub/src/http/mod.rs +++ b/lemmy_apub/src/http/mod.rs @@ -1,6 +1,6 @@ use crate::APUB_JSON_CONTENT_TYPE; use actix_web::{body::Body, web, HttpResponse}; -use lemmy_db::activity::Activity; +use lemmy_db::source::activity::Activity; use lemmy_structs::blocking; use lemmy_utils::{settings::Settings, LemmyError}; use lemmy_websocket::LemmyContext; diff --git a/lemmy_apub/src/http/post.rs b/lemmy_apub/src/http/post.rs index 1d25ed95..563af845 100644 --- a/lemmy_apub/src/http/post.rs +++ b/lemmy_apub/src/http/post.rs @@ -4,7 +4,7 @@ use crate::{ }; use actix_web::{body::Body, web, HttpResponse}; use diesel::result::Error::NotFound; -use lemmy_db::post::Post; +use lemmy_db::source::post::Post; use lemmy_structs::blocking; use lemmy_utils::LemmyError; use lemmy_websocket::LemmyContext; diff --git a/lemmy_apub/src/http/user.rs b/lemmy_apub/src/http/user.rs index 1e546d95..8dcc8eda 100644 --- a/lemmy_apub/src/http/user.rs +++ b/lemmy_apub/src/http/user.rs @@ -9,7 +9,7 @@ use activitystreams::{ collection::{CollectionExt, OrderedCollection}, }; use actix_web::{body::Body, web, HttpResponse}; -use lemmy_db::user::User_; +use lemmy_db::source::user::User_; use lemmy_structs::blocking; use lemmy_utils::LemmyError; use lemmy_websocket::LemmyContext; diff --git a/lemmy_apub/src/inbox/community_inbox.rs b/lemmy_apub/src/inbox/community_inbox.rs index 1c7b32e9..82df26be 100644 --- a/lemmy_apub/src/inbox/community_inbox.rs +++ b/lemmy_apub/src/inbox/community_inbox.rs @@ -27,8 +27,10 @@ use activitystreams::{ use actix_web::{web, HttpRequest, HttpResponse}; use anyhow::{anyhow, Context}; use lemmy_db::{ - community::{Community, CommunityFollower, CommunityFollowerForm}, - user::User_, + source::{ + community::{Community, CommunityFollower, CommunityFollowerForm}, + user::User_, + }, views::community_user_ban_view::CommunityUserBanView, ApubObject, DbPool, diff --git a/lemmy_apub/src/inbox/mod.rs b/lemmy_apub/src/inbox/mod.rs index d36a34c9..41585188 100644 --- a/lemmy_apub/src/inbox/mod.rs +++ b/lemmy_apub/src/inbox/mod.rs @@ -12,7 +12,11 @@ use activitystreams::{ }; use actix_web::HttpRequest; use anyhow::{anyhow, Context}; -use lemmy_db::{activity::Activity, community::Community, user::User_, ApubObject, DbPool}; +use lemmy_db::{ + source::{activity::Activity, community::Community, user::User_}, + ApubObject, + DbPool, +}; use lemmy_structs::blocking; use lemmy_utils::{location_info, settings::Settings, LemmyError}; use lemmy_websocket::LemmyContext; diff --git a/lemmy_apub/src/inbox/receive_for_community.rs b/lemmy_apub/src/inbox/receive_for_community.rs index eaad6b1c..73deb971 100644 --- a/lemmy_apub/src/inbox/receive_for_community.rs +++ b/lemmy_apub/src/inbox/receive_for_community.rs @@ -41,7 +41,11 @@ use activitystreams::{ }; use anyhow::Context; use diesel::result::Error::NotFound; -use lemmy_db::{comment::Comment, post::Post, site::Site, ApubObject, Crud}; +use lemmy_db::{ + source::{comment::Comment, post::Post, site::Site}, + ApubObject, + Crud, +}; use lemmy_structs::blocking; use lemmy_utils::{location_info, LemmyError}; use lemmy_websocket::LemmyContext; diff --git a/lemmy_apub/src/inbox/shared_inbox.rs b/lemmy_apub/src/inbox/shared_inbox.rs index 01086229..d94c54f2 100644 --- a/lemmy_apub/src/inbox/shared_inbox.rs +++ b/lemmy_apub/src/inbox/shared_inbox.rs @@ -15,7 +15,7 @@ use crate::{ use activitystreams::{activity::ActorAndObject, prelude::*}; use actix_web::{web, HttpRequest, HttpResponse}; use anyhow::Context; -use lemmy_db::{community::Community, ApubObject, DbPool}; +use lemmy_db::{source::community::Community, ApubObject, DbPool}; use lemmy_structs::blocking; use lemmy_utils::{location_info, LemmyError}; use lemmy_websocket::LemmyContext; diff --git a/lemmy_apub/src/inbox/user_inbox.rs b/lemmy_apub/src/inbox/user_inbox.rs index 28f2de60..374772d6 100644 --- a/lemmy_apub/src/inbox/user_inbox.rs +++ b/lemmy_apub/src/inbox/user_inbox.rs @@ -49,9 +49,11 @@ use actix_web::{web, HttpRequest, HttpResponse}; use anyhow::{anyhow, Context}; use diesel::NotFound; use lemmy_db::{ - community::{Community, CommunityFollower}, - private_message::PrivateMessage, - user::User_, + source::{ + community::{Community, CommunityFollower}, + private_message::PrivateMessage, + user::User_, + }, ApubObject, Followable, }; diff --git a/lemmy_apub/src/lib.rs b/lemmy_apub/src/lib.rs index 9b933b6e..78224c32 100644 --- a/lemmy_apub/src/lib.rs +++ b/lemmy_apub/src/lib.rs @@ -22,7 +22,10 @@ use activitystreams::{ }; use activitystreams_ext::{Ext1, Ext2}; use anyhow::{anyhow, Context}; -use lemmy_db::{activity::Activity, user::User_, DbPool}; +use lemmy_db::{ + source::{activity::Activity, user::User_}, + DbPool, +}; use lemmy_structs::blocking; use lemmy_utils::{location_info, settings::Settings, LemmyError}; use lemmy_websocket::LemmyContext; diff --git a/lemmy_apub/src/objects/comment.rs b/lemmy_apub/src/objects/comment.rs index 56d75a40..957966d7 100644 --- a/lemmy_apub/src/objects/comment.rs +++ b/lemmy_apub/src/objects/comment.rs @@ -24,10 +24,12 @@ use activitystreams::{ }; use anyhow::{anyhow, Context}; use lemmy_db::{ - comment::{Comment, CommentForm}, - community::Community, - post::Post, - user::User_, + source::{ + comment::{Comment, CommentForm}, + community::Community, + post::Post, + user::User_, + }, Crud, DbPool, }; diff --git a/lemmy_apub/src/objects/community.rs b/lemmy_apub/src/objects/community.rs index 8cc5b9eb..3bd47560 100644 --- a/lemmy_apub/src/objects/community.rs +++ b/lemmy_apub/src/objects/community.rs @@ -23,8 +23,8 @@ use activitystreams::{ use activitystreams_ext::Ext2; use anyhow::Context; use lemmy_db::{ - community::{Community, CommunityForm}, naive_now, + source::community::{Community, CommunityForm}, views::community_moderator_view::CommunityModeratorView, DbPool, }; diff --git a/lemmy_apub/src/objects/post.rs b/lemmy_apub/src/objects/post.rs index 39b74997..9c9df5b1 100644 --- a/lemmy_apub/src/objects/post.rs +++ b/lemmy_apub/src/objects/post.rs @@ -21,9 +21,11 @@ use activitystreams::{ use activitystreams_ext::Ext1; use anyhow::Context; use lemmy_db::{ - community::Community, - post::{Post, PostForm}, - user::User_, + source::{ + community::Community, + post::{Post, PostForm}, + user::User_, + }, Crud, DbPool, }; diff --git a/lemmy_apub/src/objects/private_message.rs b/lemmy_apub/src/objects/private_message.rs index ec8b55e7..e69c2811 100644 --- a/lemmy_apub/src/objects/private_message.rs +++ b/lemmy_apub/src/objects/private_message.rs @@ -20,8 +20,10 @@ use activitystreams::{ }; use anyhow::Context; use lemmy_db::{ - private_message::{PrivateMessage, PrivateMessageForm}, - user::User_, + source::{ + private_message::{PrivateMessage, PrivateMessageForm}, + user::User_, + }, Crud, DbPool, }; diff --git a/lemmy_apub/src/objects/user.rs b/lemmy_apub/src/objects/user.rs index 18490796..8c3312d1 100644 --- a/lemmy_apub/src/objects/user.rs +++ b/lemmy_apub/src/objects/user.rs @@ -20,7 +20,7 @@ use activitystreams_ext::Ext1; use anyhow::Context; use lemmy_db::{ naive_now, - user::{UserForm, User_}, + source::user::{UserForm, User_}, ApubObject, DbPool, }; diff --git a/lemmy_db/src/aggregates/community_aggregates.rs b/lemmy_db/src/aggregates/community_aggregates.rs index 04257c50..8c977bf0 100644 --- a/lemmy_db/src/aggregates/community_aggregates.rs +++ b/lemmy_db/src/aggregates/community_aggregates.rs @@ -24,11 +24,13 @@ impl CommunityAggregates { mod tests { use crate::{ aggregates::community_aggregates::CommunityAggregates, - comment::{Comment, CommentForm}, - community::{Community, CommunityFollower, CommunityFollowerForm, CommunityForm}, - post::{Post, PostForm}, + source::{ + comment::{Comment, CommentForm}, + community::{Community, CommunityFollower, CommunityFollowerForm, CommunityForm}, + post::{Post, PostForm}, + user::{UserForm, User_}, + }, tests::establish_unpooled_connection, - user::{UserForm, User_}, Crud, Followable, ListingType, diff --git a/lemmy_db/src/aggregates/post_aggregates.rs b/lemmy_db/src/aggregates/post_aggregates.rs index 07db37ef..dff16f9b 100644 --- a/lemmy_db/src/aggregates/post_aggregates.rs +++ b/lemmy_db/src/aggregates/post_aggregates.rs @@ -26,11 +26,13 @@ impl PostAggregates { mod tests { use crate::{ aggregates::post_aggregates::PostAggregates, - comment::{Comment, CommentForm}, - community::{Community, CommunityForm}, - post::{Post, PostForm, PostLike, PostLikeForm}, + source::{ + comment::{Comment, CommentForm}, + community::{Community, CommunityForm}, + post::{Post, PostForm, PostLike, PostLikeForm}, + user::{UserForm, User_}, + }, tests::establish_unpooled_connection, - user::{UserForm, User_}, Crud, Likeable, ListingType, diff --git a/lemmy_db/src/aggregates/site_aggregates.rs b/lemmy_db/src/aggregates/site_aggregates.rs index 76b45555..6856bfc9 100644 --- a/lemmy_db/src/aggregates/site_aggregates.rs +++ b/lemmy_db/src/aggregates/site_aggregates.rs @@ -22,11 +22,13 @@ impl SiteAggregates { mod tests { use crate::{ aggregates::site_aggregates::SiteAggregates, - comment::{Comment, CommentForm}, - community::{Community, CommunityForm}, - post::{Post, PostForm}, + source::{ + comment::{Comment, CommentForm}, + community::{Community, CommunityForm}, + post::{Post, PostForm}, + user::{UserForm, User_}, + }, tests::establish_unpooled_connection, - user::{UserForm, User_}, Crud, ListingType, SortType, diff --git a/lemmy_db/src/aggregates/user_aggregates.rs b/lemmy_db/src/aggregates/user_aggregates.rs index e962c0dd..104bf6f7 100644 --- a/lemmy_db/src/aggregates/user_aggregates.rs +++ b/lemmy_db/src/aggregates/user_aggregates.rs @@ -25,11 +25,13 @@ impl UserAggregates { mod tests { use crate::{ aggregates::user_aggregates::UserAggregates, - comment::{Comment, CommentForm, CommentLike, CommentLikeForm}, - community::{Community, CommunityForm}, - post::{Post, PostForm, PostLike, PostLikeForm}, + source::{ + comment::{Comment, CommentForm, CommentLike, CommentLikeForm}, + community::{Community, CommunityForm}, + post::{Post, PostForm, PostLike, PostLikeForm}, + user::{UserForm, User_}, + }, tests::establish_unpooled_connection, - user::{UserForm, User_}, Crud, Likeable, ListingType, diff --git a/lemmy_db/src/comment_report.rs b/lemmy_db/src/comment_report.rs index a243891e..240b7343 100644 --- a/lemmy_db/src/comment_report.rs +++ b/lemmy_db/src/comment_report.rs @@ -2,10 +2,10 @@ use diesel::{dsl::*, pg::Pg, result::Error, *}; use serde::{Deserialize, Serialize}; use crate::{ - comment::Comment, limit_and_offset, naive_now, schema::comment_report, + source::comment::Comment, MaybeOptional, Reportable, }; diff --git a/lemmy_db/src/comment_view.rs b/lemmy_db/src/comment_view.rs index 4b6dc192..f463168b 100644 --- a/lemmy_db/src/comment_view.rs +++ b/lemmy_db/src/comment_view.rs @@ -497,12 +497,9 @@ impl<'a> ReplyQueryBuilder<'a> { #[cfg(test)] mod tests { use crate::{ - comment::*, comment_view::*, - community::*, - post::*, + source::{comment::*, community::*, post::*, user::*}, tests::establish_unpooled_connection, - user::*, Crud, Likeable, *, diff --git a/lemmy_db/src/lib.rs b/lemmy_db/src/lib.rs index 5488360a..098a88e4 100644 --- a/lemmy_db/src/lib.rs +++ b/lemmy_db/src/lib.rs @@ -11,25 +11,16 @@ use regex::Regex; use serde::{Deserialize, Serialize}; use std::{env, env::VarError}; -pub mod activity; -pub mod aggregates; -pub mod category; -pub mod comment; pub mod comment_report; pub mod comment_view; -pub mod community; -pub mod moderator; pub mod moderator_views; -pub mod password_reset_request; -pub mod post; pub mod post_report; -pub mod private_message; pub mod private_message_view; -pub mod schema; -pub mod site; -pub mod user; -pub mod user_mention; pub mod user_mention_view; + +pub mod aggregates; +pub mod schema; +pub mod source; pub mod views; pub type DbPool = diesel::r2d2::Pool>; diff --git a/lemmy_db/src/post_report.rs b/lemmy_db/src/post_report.rs index 5f8aa5ea..230368c5 100644 --- a/lemmy_db/src/post_report.rs +++ b/lemmy_db/src/post_report.rs @@ -4,8 +4,8 @@ use serde::{Deserialize, Serialize}; use crate::{ limit_and_offset, naive_now, - post::Post, schema::post_report, + source::post::Post, MaybeOptional, Reportable, }; diff --git a/lemmy_db/src/activity.rs b/lemmy_db/src/source/activity.rs similarity index 98% rename from lemmy_db/src/activity.rs rename to lemmy_db/src/source/activity.rs index 190dd411..b4b54c6e 100644 --- a/lemmy_db/src/activity.rs +++ b/lemmy_db/src/source/activity.rs @@ -97,9 +97,11 @@ impl Activity { #[cfg(test)] mod tests { use crate::{ - activity::{Activity, ActivityForm}, + source::{ + activity::{Activity, ActivityForm}, + user::{UserForm, User_}, + }, tests::establish_unpooled_connection, - user::{UserForm, User_}, Crud, ListingType, SortType, diff --git a/lemmy_db/src/category.rs b/lemmy_db/src/source/category.rs similarity index 94% rename from lemmy_db/src/category.rs rename to lemmy_db/src/source/category.rs index af2e7226..95b65dc8 100644 --- a/lemmy_db/src/category.rs +++ b/lemmy_db/src/source/category.rs @@ -48,7 +48,7 @@ impl Category { #[cfg(test)] mod tests { - use crate::{category::Category, tests::establish_unpooled_connection}; + use crate::{source::category::Category, tests::establish_unpooled_connection}; #[test] fn test_crud() { diff --git a/lemmy_db/src/comment.rs b/lemmy_db/src/source/comment.rs similarity index 99% rename from lemmy_db/src/comment.rs rename to lemmy_db/src/source/comment.rs index fb327a30..dd4fb39d 100644 --- a/lemmy_db/src/comment.rs +++ b/lemmy_db/src/source/comment.rs @@ -260,11 +260,8 @@ impl Saveable for CommentSaved { #[cfg(test)] mod tests { use crate::{ - comment::*, - community::*, - post::*, + source::{comment::*, community::*, post::*, user::*}, tests::establish_unpooled_connection, - user::*, Crud, ListingType, SortType, diff --git a/lemmy_db/src/community.rs b/lemmy_db/src/source/community.rs similarity index 98% rename from lemmy_db/src/community.rs rename to lemmy_db/src/source/community.rs index eda643ad..ea7a028e 100644 --- a/lemmy_db/src/community.rs +++ b/lemmy_db/src/source/community.rs @@ -55,7 +55,7 @@ pub struct CommunitySafe { } mod safe_type { - use crate::{community::Community, schema::community::columns::*, ToSafe}; + use crate::{schema::community::columns::*, source::community::Community, ToSafe}; type Columns = ( id, name, @@ -415,7 +415,12 @@ impl Followable for CommunityFollower { #[cfg(test)] mod tests { - use crate::{community::*, tests::establish_unpooled_connection, user::*, ListingType, SortType}; + use crate::{ + source::{community::*, user::*}, + tests::establish_unpooled_connection, + ListingType, + SortType, + }; #[test] fn test_crud() { diff --git a/lemmy_db/src/source/mod.rs b/lemmy_db/src/source/mod.rs new file mode 100644 index 00000000..2247cd88 --- /dev/null +++ b/lemmy_db/src/source/mod.rs @@ -0,0 +1,11 @@ +pub mod activity; +pub mod category; +pub mod comment; +pub mod community; +pub mod moderator; +pub mod password_reset_request; +pub mod post; +pub mod private_message; +pub mod site; +pub mod user; +pub mod user_mention; diff --git a/lemmy_db/src/moderator.rs b/lemmy_db/src/source/moderator.rs similarity index 99% rename from lemmy_db/src/moderator.rs rename to lemmy_db/src/source/moderator.rs index c0c0ff10..1be3e31b 100644 --- a/lemmy_db/src/moderator.rs +++ b/lemmy_db/src/source/moderator.rs @@ -392,12 +392,8 @@ impl Crud for ModAdd { #[cfg(test)] mod tests { use crate::{ - comment::*, - community::*, - moderator::*, - post::*, + source::{comment::*, community::*, moderator::*, post::*, user::*}, tests::establish_unpooled_connection, - user::*, ListingType, SortType, }; diff --git a/lemmy_db/src/password_reset_request.rs b/lemmy_db/src/source/password_reset_request.rs similarity index 98% rename from lemmy_db/src/password_reset_request.rs rename to lemmy_db/src/source/password_reset_request.rs index 8ae18cbd..0cf0169f 100644 --- a/lemmy_db/src/password_reset_request.rs +++ b/lemmy_db/src/source/password_reset_request.rs @@ -80,7 +80,7 @@ impl PasswordResetRequest { mod tests { use super::super::user::*; use crate::{ - password_reset_request::PasswordResetRequest, + source::password_reset_request::PasswordResetRequest, tests::establish_unpooled_connection, Crud, ListingType, diff --git a/lemmy_db/src/post.rs b/lemmy_db/src/source/post.rs similarity index 99% rename from lemmy_db/src/post.rs rename to lemmy_db/src/source/post.rs index 5767c72b..b584798e 100644 --- a/lemmy_db/src/post.rs +++ b/lemmy_db/src/source/post.rs @@ -332,10 +332,8 @@ impl Readable for PostRead { #[cfg(test)] mod tests { use crate::{ - community::*, - post::*, + source::{community::*, post::*, user::*}, tests::establish_unpooled_connection, - user::*, ListingType, SortType, }; diff --git a/lemmy_db/src/private_message.rs b/lemmy_db/src/source/private_message.rs similarity index 99% rename from lemmy_db/src/private_message.rs rename to lemmy_db/src/source/private_message.rs index 0e1aef10..47bb78fb 100644 --- a/lemmy_db/src/private_message.rs +++ b/lemmy_db/src/source/private_message.rs @@ -138,9 +138,8 @@ impl PrivateMessage { #[cfg(test)] mod tests { use crate::{ - private_message::*, + source::{private_message::*, user::*}, tests::establish_unpooled_connection, - user::*, ListingType, SortType, }; diff --git a/lemmy_db/src/site.rs b/lemmy_db/src/source/site.rs similarity index 100% rename from lemmy_db/src/site.rs rename to lemmy_db/src/source/site.rs diff --git a/lemmy_db/src/user.rs b/lemmy_db/src/source/user.rs similarity index 98% rename from lemmy_db/src/user.rs rename to lemmy_db/src/source/user.rs index 41d3ed18..5fdb56bb 100644 --- a/lemmy_db/src/user.rs +++ b/lemmy_db/src/source/user.rs @@ -62,7 +62,7 @@ pub struct UserSafe { } mod safe_type { - use crate::{schema::user_::columns::*, user::User_, ToSafe}; + use crate::{schema::user_::columns::*, source::user::User_, ToSafe}; type Columns = ( id, name, @@ -275,7 +275,7 @@ impl User_ { #[cfg(test)] mod tests { - use crate::{tests::establish_unpooled_connection, user::*, ListingType, SortType}; + use crate::{source::user::*, tests::establish_unpooled_connection, ListingType, SortType}; #[test] fn test_crud() { diff --git a/lemmy_db/src/user_mention.rs b/lemmy_db/src/source/user_mention.rs similarity index 98% rename from lemmy_db/src/user_mention.rs rename to lemmy_db/src/source/user_mention.rs index 68f56633..7ad96521 100644 --- a/lemmy_db/src/user_mention.rs +++ b/lemmy_db/src/source/user_mention.rs @@ -73,12 +73,8 @@ impl UserMention { #[cfg(test)] mod tests { use crate::{ - comment::*, - community::*, - post::*, + source::{comment::*, community::*, post::*, user::*, user_mention::*}, tests::establish_unpooled_connection, - user::*, - user_mention::*, ListingType, SortType, }; diff --git a/lemmy_db/src/views/community_follower_view.rs b/lemmy_db/src/views/community_follower_view.rs index 555a9bcd..64adae3b 100644 --- a/lemmy_db/src/views/community_follower_view.rs +++ b/lemmy_db/src/views/community_follower_view.rs @@ -1,7 +1,9 @@ use crate::{ - community::{Community, CommunitySafe}, schema::{community, community_follower, user_}, - user::{UserSafe, User_}, + source::{ + community::{Community, CommunitySafe}, + user::{UserSafe, User_}, + }, views::ViewToVec, ToSafe, }; diff --git a/lemmy_db/src/views/community_moderator_view.rs b/lemmy_db/src/views/community_moderator_view.rs index a2196ea3..c98f072a 100644 --- a/lemmy_db/src/views/community_moderator_view.rs +++ b/lemmy_db/src/views/community_moderator_view.rs @@ -1,7 +1,9 @@ use crate::{ - community::{Community, CommunitySafe}, schema::{community, community_moderator, user_}, - user::{UserSafe, User_}, + source::{ + community::{Community, CommunitySafe}, + user::{UserSafe, User_}, + }, views::ViewToVec, ToSafe, }; diff --git a/lemmy_db/src/views/community_user_ban_view.rs b/lemmy_db/src/views/community_user_ban_view.rs index faaae0f2..3358f01b 100644 --- a/lemmy_db/src/views/community_user_ban_view.rs +++ b/lemmy_db/src/views/community_user_ban_view.rs @@ -1,7 +1,9 @@ use crate::{ - community::{Community, CommunitySafe}, schema::{community, community_user_ban, user_}, - user::{UserSafe, User_}, + source::{ + community::{Community, CommunitySafe}, + user::{UserSafe, User_}, + }, ToSafe, }; use diesel::{result::Error, *}; diff --git a/lemmy_db/src/views/community_view.rs b/lemmy_db/src/views/community_view.rs index 0ac5081e..d4518f7f 100644 --- a/lemmy_db/src/views/community_view.rs +++ b/lemmy_db/src/views/community_view.rs @@ -1,12 +1,14 @@ use crate::{ aggregates::community_aggregates::CommunityAggregates, - category::Category, - community::{Community, CommunityFollower, CommunitySafe}, functions::hot_rank, fuzzy_search, limit_and_offset, schema::{category, community, community_aggregates, community_follower, user_}, - user::{UserSafe, User_}, + source::{ + category::Category, + community::{Community, CommunityFollower, CommunitySafe}, + user::{UserSafe, User_}, + }, views::ViewToVec, MaybeOptional, SortType, diff --git a/lemmy_db/src/views/post_view.rs b/lemmy_db/src/views/post_view.rs index dc21e621..4888f9cf 100644 --- a/lemmy_db/src/views/post_view.rs +++ b/lemmy_db/src/views/post_view.rs @@ -1,10 +1,8 @@ use crate::{ aggregates::post_aggregates::PostAggregates, - community::{Community, CommunityFollower, CommunitySafe, CommunityUserBan}, functions::hot_rank, fuzzy_search, limit_and_offset, - post::{Post, PostRead, PostSaved}, schema::{ community, community_follower, @@ -16,7 +14,11 @@ use crate::{ post_saved, user_, }, - user::{UserSafe, User_}, + source::{ + community::{Community, CommunityFollower, CommunitySafe, CommunityUserBan}, + post::{Post, PostRead, PostSaved}, + user::{UserSafe, User_}, + }, views::ViewToVec, ListingType, MaybeOptional, @@ -589,10 +591,8 @@ impl ViewToVec for PostView { mod tests { use crate::{ aggregates::post_aggregates::PostAggregates, - community::*, - post::*, + source::{community::*, post::*, user::*}, tests::establish_unpooled_connection, - user::*, views::post_view::{PostQueryBuilder, PostView}, Crud, Likeable, diff --git a/lemmy_db/src/views/site_view.rs b/lemmy_db/src/views/site_view.rs index c00b8378..d10702fc 100644 --- a/lemmy_db/src/views/site_view.rs +++ b/lemmy_db/src/views/site_view.rs @@ -1,7 +1,9 @@ use crate::{ schema::{site, user_}, - site::Site, - user::{UserSafe, User_}, + source::{ + site::Site, + user::{UserSafe, User_}, + }, ToSafe, }; use diesel::{result::Error, *}; diff --git a/lemmy_db/src/views/user_view.rs b/lemmy_db/src/views/user_view.rs index dae26409..4d4e78c7 100644 --- a/lemmy_db/src/views/user_view.rs +++ b/lemmy_db/src/views/user_view.rs @@ -3,7 +3,7 @@ use crate::{ fuzzy_search, limit_and_offset, schema::{user_, user_aggregates}, - user::{UserSafe, User_}, + source::user::{UserSafe, User_}, views::ViewToVec, MaybeOptional, SortType, diff --git a/lemmy_structs/src/lib.rs b/lemmy_structs/src/lib.rs index 5d2e4273..3a2e28d9 100644 --- a/lemmy_structs/src/lib.rs +++ b/lemmy_structs/src/lib.rs @@ -7,10 +7,12 @@ pub mod websocket; use diesel::PgConnection; use lemmy_db::{ - comment::Comment, - post::Post, - user::User_, - user_mention::{UserMention, UserMentionForm}, + source::{ + comment::Comment, + post::Post, + user::User_, + user_mention::{UserMention, UserMentionForm}, + }, Crud, DbPool, }; diff --git a/lemmy_structs/src/site.rs b/lemmy_structs/src/site.rs index 74badcd3..002c3ace 100644 --- a/lemmy_structs/src/site.rs +++ b/lemmy_structs/src/site.rs @@ -1,9 +1,8 @@ use lemmy_db::{ aggregates::site_aggregates::SiteAggregates, - category::*, comment_view::*, moderator_views::*, - user::*, + source::{category::*, user::*}, views::{ community_view::CommunityView, post_view::PostView, diff --git a/src/code_migrations.rs b/src/code_migrations.rs index c41f5bd9..7a749e9b 100644 --- a/src/code_migrations.rs +++ b/src/code_migrations.rs @@ -4,12 +4,14 @@ use diesel::{ *, }; use lemmy_db::{ - comment::Comment, - community::{Community, CommunityForm}, naive_now, - post::Post, - private_message::PrivateMessage, - user::{UserForm, User_}, + source::{ + comment::Comment, + community::{Community, CommunityForm}, + post::Post, + private_message::PrivateMessage, + user::{UserForm, User_}, + }, Crud, }; use lemmy_utils::{ diff --git a/src/routes/feeds.rs b/src/routes/feeds.rs index 4dd7643a..887faa88 100644 --- a/src/routes/feeds.rs +++ b/src/routes/feeds.rs @@ -5,8 +5,7 @@ use diesel::PgConnection; use lemmy_api::claims::Claims; use lemmy_db::{ comment_view::{ReplyQueryBuilder, ReplyView}, - community::Community, - user::User_, + source::{community::Community, user::User_}, user_mention_view::{UserMentionQueryBuilder, UserMentionView}, views::{ post_view::{PostQueryBuilder, PostView}, diff --git a/src/routes/webfinger.rs b/src/routes/webfinger.rs index ba687abd..d59b4e38 100644 --- a/src/routes/webfinger.rs +++ b/src/routes/webfinger.rs @@ -1,6 +1,6 @@ use actix_web::{error::ErrorBadRequest, web::Query, *}; use anyhow::anyhow; -use lemmy_db::{community::Community, user::User_}; +use lemmy_db::source::{community::Community, user::User_}; use lemmy_structs::{blocking, WebFingerLink, WebFingerResponse}; use lemmy_utils::{ settings::Settings, diff --git a/tests/integration_test.rs b/tests/integration_test.rs index 2a79dd4b..a61c8ff6 100644 --- a/tests/integration_test.rs +++ b/tests/integration_test.rs @@ -29,8 +29,10 @@ use lemmy_apub::{ }, }; use lemmy_db::{ - community::{Community, CommunityForm}, - user::{User_, *}, + source::{ + community::{Community, CommunityForm}, + user::{User_, *}, + }, Crud, ListingType, SortType,