Move sql schema to separate Rust crate (#5581)
* Move db schema file to new crate * db schema compiling * wip * db views * compiling * cleanup * clippy * fix path * move some more files to new crate * fixes * fix * fix
This commit is contained in:
parent
a91a953f1b
commit
e4c87748bf
@ -207,11 +207,11 @@ steps:
|
||||
RUST_BACKTRACE: "1"
|
||||
CARGO_HOME: .cargo_home
|
||||
commands:
|
||||
- cp crates/db_schema/src/schema.rs tmp.schema
|
||||
- cp crates/db_schema_file/src/schema.rs tmp.schema
|
||||
- target/lemmy_server migration --all run
|
||||
- <<: *install_diesel_cli
|
||||
- diesel print-schema
|
||||
- diff tmp.schema crates/db_schema/src/schema.rs
|
||||
- diff tmp.schema crates/db_schema_file/src/schema.rs
|
||||
when: *slow_check_paths
|
||||
|
||||
check_db_perf_tool:
|
||||
|
34
Cargo.lock
generated
34
Cargo.lock
generated
@ -3119,6 +3119,7 @@ dependencies = [
|
||||
"lemmy_api_common",
|
||||
"lemmy_api_crud",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_db_views",
|
||||
"lemmy_email",
|
||||
"lemmy_utils",
|
||||
@ -3149,6 +3150,7 @@ dependencies = [
|
||||
"infer",
|
||||
"jsonwebtoken",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_db_views",
|
||||
"lemmy_email",
|
||||
"lemmy_utils",
|
||||
@ -3187,6 +3189,7 @@ dependencies = [
|
||||
"futures",
|
||||
"lemmy_api_common",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_db_views",
|
||||
"lemmy_email",
|
||||
"lemmy_utils",
|
||||
@ -3216,6 +3219,7 @@ dependencies = [
|
||||
"itertools 0.14.0",
|
||||
"lemmy_api_common",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_db_views",
|
||||
"lemmy_utils",
|
||||
"moka",
|
||||
@ -3243,6 +3247,7 @@ dependencies = [
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_db_views",
|
||||
"lemmy_utils",
|
||||
"tokio",
|
||||
@ -3254,20 +3259,17 @@ name = "lemmy_db_schema"
|
||||
version = "1.0.0-alpha.4"
|
||||
dependencies = [
|
||||
"activitypub_federation",
|
||||
"anyhow",
|
||||
"bcrypt",
|
||||
"chrono",
|
||||
"deadpool",
|
||||
"derive-new",
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"diesel-derive-enum",
|
||||
"diesel-derive-newtype",
|
||||
"diesel_ltree",
|
||||
"diesel_migrations",
|
||||
"diffutils",
|
||||
"futures-util",
|
||||
"i-love-jesus",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_utils",
|
||||
"pretty_assertions",
|
||||
"regex",
|
||||
@ -3287,6 +3289,25 @@ dependencies = [
|
||||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lemmy_db_schema_file"
|
||||
version = "1.0.0-alpha.4"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"chrono",
|
||||
"diesel",
|
||||
"diesel-derive-enum",
|
||||
"diesel_ltree",
|
||||
"diesel_migrations",
|
||||
"diffutils",
|
||||
"lemmy_utils",
|
||||
"serde",
|
||||
"serial_test",
|
||||
"strum",
|
||||
"tracing",
|
||||
"ts-rs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lemmy_db_views"
|
||||
version = "1.0.0-alpha.4"
|
||||
@ -3299,6 +3320,7 @@ dependencies = [
|
||||
"diesel_ltree",
|
||||
"i-love-jesus",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_utils",
|
||||
"pretty_assertions",
|
||||
"serde",
|
||||
@ -3318,6 +3340,7 @@ version = "1.0.0-alpha.4"
|
||||
dependencies = [
|
||||
"html2text",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_db_views",
|
||||
"lemmy_utils",
|
||||
"lettre",
|
||||
@ -3341,6 +3364,7 @@ dependencies = [
|
||||
"lemmy_api_common",
|
||||
"lemmy_apub",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_db_views",
|
||||
"lemmy_utils",
|
||||
"mockall",
|
||||
@ -3375,6 +3399,7 @@ dependencies = [
|
||||
"http 1.2.0",
|
||||
"lemmy_api_common",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_db_views",
|
||||
"lemmy_utils",
|
||||
"pretty_assertions",
|
||||
@ -3401,6 +3426,7 @@ dependencies = [
|
||||
"lemmy_api_crud",
|
||||
"lemmy_apub",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_federate",
|
||||
"lemmy_routes",
|
||||
"lemmy_utils",
|
||||
|
11
Cargo.toml
11
Cargo.toml
@ -47,6 +47,7 @@ members = [
|
||||
"crates/utils",
|
||||
"crates/db_perf",
|
||||
"crates/db_schema",
|
||||
"crates/db_schema_file",
|
||||
"crates/db_views",
|
||||
"crates/routes",
|
||||
"crates/federate",
|
||||
@ -85,6 +86,7 @@ lemmy_api_crud = { version = "=1.0.0-alpha.4", path = "./crates/api_crud" }
|
||||
lemmy_apub = { version = "=1.0.0-alpha.4", path = "./crates/apub" }
|
||||
lemmy_utils = { version = "=1.0.0-alpha.4", path = "./crates/utils", default-features = false }
|
||||
lemmy_db_schema = { version = "=1.0.0-alpha.4", path = "./crates/db_schema" }
|
||||
lemmy_db_schema_file = { version = "=1.0.0-alpha.4", path = "./crates/db_schema_file" }
|
||||
lemmy_api_common = { version = "=1.0.0-alpha.4", path = "./crates/api_common" }
|
||||
lemmy_routes = { version = "=1.0.0-alpha.4", path = "./crates/routes" }
|
||||
lemmy_db_views = { version = "=1.0.0-alpha.4", path = "./crates/db_views" }
|
||||
@ -93,7 +95,13 @@ lemmy_email = { version = "=1.0.0-alpha.4", path = "./crates/email" }
|
||||
activitypub_federation = { version = "0.6.3", default-features = false, features = [
|
||||
"actix-web",
|
||||
] }
|
||||
diesel = "2.2.7"
|
||||
diesel = { version = "2.2.7", features = [
|
||||
"chrono",
|
||||
"postgres",
|
||||
"serde_json",
|
||||
"uuid",
|
||||
"64-column-tables",
|
||||
] }
|
||||
diesel_migrations = "2.2.0"
|
||||
diesel-async = "0.5.2"
|
||||
serde = { version = "1.0.217", features = ["derive"] }
|
||||
@ -165,6 +173,7 @@ lemmy_api_crud = { workspace = true }
|
||||
lemmy_apub = { workspace = true }
|
||||
lemmy_utils = { workspace = true }
|
||||
lemmy_db_schema = { workspace = true }
|
||||
lemmy_db_schema_file = { workspace = true }
|
||||
lemmy_api_common = { workspace = true }
|
||||
lemmy_routes = { workspace = true }
|
||||
lemmy_federate = { workspace = true }
|
||||
|
@ -22,6 +22,7 @@ lemmy_utils = { workspace = true }
|
||||
lemmy_db_schema = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views = { workspace = true, features = ["full"] }
|
||||
lemmy_api_common = { workspace = true, features = ["full"] }
|
||||
lemmy_db_schema_file = { workspace = true }
|
||||
lemmy_email = { workspace = true }
|
||||
activitypub_federation = { workspace = true }
|
||||
bcrypt = { workspace = true }
|
||||
|
@ -9,11 +9,11 @@ use lemmy_api_common::{
|
||||
use lemmy_db_schema::{
|
||||
source::{
|
||||
actor_language::CommunityLanguage,
|
||||
community::{Community, CommunityActions, CommunityFollowerForm, CommunityFollowerState},
|
||||
community::{Community, CommunityActions, CommunityFollowerForm},
|
||||
},
|
||||
traits::{Crud, Followable},
|
||||
CommunityVisibility,
|
||||
};
|
||||
use lemmy_db_schema_file::enums::{CommunityFollowerState, CommunityVisibility};
|
||||
use lemmy_db_views::structs::{CommunityPersonBanView, CommunityView, LocalUserView};
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
|
@ -28,8 +28,8 @@ use lemmy_db_schema::{
|
||||
},
|
||||
traits::Crud,
|
||||
utils::DbPool,
|
||||
RegistrationMode,
|
||||
};
|
||||
use lemmy_db_schema_file::enums::RegistrationMode;
|
||||
use lemmy_db_views::structs::LocalUserView;
|
||||
use lemmy_utils::{
|
||||
error::{LemmyErrorType, LemmyResult},
|
||||
|
@ -40,12 +40,14 @@ full = [
|
||||
"extism-convert",
|
||||
"once_cell",
|
||||
"serde_json",
|
||||
"lemmy_db_schema_file/full",
|
||||
]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_views = { workspace = true }
|
||||
lemmy_db_schema = { workspace = true }
|
||||
lemmy_utils = { workspace = true }
|
||||
lemmy_db_schema_file = { workspace = true }
|
||||
lemmy_email = { workspace = true, optional = true }
|
||||
activitypub_federation = { workspace = true, optional = true }
|
||||
serde = { workspace = true }
|
||||
|
@ -1,8 +1,5 @@
|
||||
use lemmy_db_schema::{
|
||||
newtypes::{CommentId, CommunityId, LanguageId, LocalUserId, PostId},
|
||||
CommentSortType,
|
||||
ListingType,
|
||||
};
|
||||
use lemmy_db_schema::newtypes::{CommentId, CommunityId, LanguageId, LocalUserId, PostId};
|
||||
use lemmy_db_schema_file::enums::{CommentSortType, ListingType};
|
||||
use lemmy_db_views::structs::{CommentSlimView, CommentView, VoteView};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
|
@ -1,9 +1,8 @@
|
||||
use lemmy_db_schema::{
|
||||
newtypes::{CommunityId, LanguageId, PersonId},
|
||||
source::site::Site,
|
||||
CommunityVisibility,
|
||||
ListingType,
|
||||
};
|
||||
use lemmy_db_schema_file::enums::{CommunityVisibility, ListingType};
|
||||
use lemmy_db_views::structs::{
|
||||
CommunityModeratorView,
|
||||
CommunitySortType,
|
||||
|
@ -10,13 +10,10 @@ use lemmy_db_schema::{
|
||||
},
|
||||
sensitive::SensitiveString,
|
||||
source::{login_token::LoginToken, site::Site},
|
||||
CommentSortType,
|
||||
InboxDataType,
|
||||
ListingType,
|
||||
PersonContentType,
|
||||
PostListingMode,
|
||||
PostSortType,
|
||||
};
|
||||
use lemmy_db_schema_file::enums::{CommentSortType, ListingType, PostListingMode, PostSortType};
|
||||
use lemmy_db_views::structs::{
|
||||
CommunityModeratorView,
|
||||
InboxCombinedView,
|
||||
|
@ -1,9 +1,8 @@
|
||||
use lemmy_db_schema::{
|
||||
newtypes::{CommentId, CommunityId, DbUrl, LanguageId, PostId, TagId},
|
||||
ListingType,
|
||||
PostFeatureType,
|
||||
PostSortType,
|
||||
};
|
||||
use lemmy_db_schema_file::enums::{ListingType, PostSortType};
|
||||
use lemmy_db_views::structs::{CommunityView, PostPaginationCursor, PostView, VoteView};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
|
@ -21,15 +21,17 @@ use lemmy_db_schema::{
|
||||
person::Person,
|
||||
tagline::Tagline,
|
||||
},
|
||||
ModlogActionType,
|
||||
SearchSortType,
|
||||
SearchType,
|
||||
};
|
||||
use lemmy_db_schema_file::enums::{
|
||||
CommentSortType,
|
||||
FederationMode,
|
||||
ListingType,
|
||||
ModlogActionType,
|
||||
PostListingMode,
|
||||
PostSortType,
|
||||
RegistrationMode,
|
||||
SearchSortType,
|
||||
SearchType,
|
||||
};
|
||||
use lemmy_db_views::structs::{
|
||||
CommentView,
|
||||
|
@ -37,9 +37,8 @@ use lemmy_db_schema::{
|
||||
},
|
||||
traits::{Blockable, Crud, Likeable, ReadComments},
|
||||
utils::DbPool,
|
||||
FederationMode,
|
||||
RegistrationMode,
|
||||
};
|
||||
use lemmy_db_schema_file::enums::{FederationMode, RegistrationMode};
|
||||
use lemmy_db_views::{
|
||||
comment::comment_view::CommentQuery,
|
||||
structs::{
|
||||
|
@ -17,6 +17,7 @@ lemmy_utils = { workspace = true, features = ["full"] }
|
||||
lemmy_db_schema = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views = { workspace = true, features = ["full"] }
|
||||
lemmy_api_common = { workspace = true, features = ["full"] }
|
||||
lemmy_db_schema_file = { workspace = true }
|
||||
lemmy_email = { workspace = true }
|
||||
activitypub_federation = { workspace = true }
|
||||
bcrypt = { workspace = true }
|
||||
|
@ -22,13 +22,13 @@ use lemmy_db_schema::{
|
||||
Community,
|
||||
CommunityActions,
|
||||
CommunityFollowerForm,
|
||||
CommunityFollowerState,
|
||||
CommunityInsertForm,
|
||||
CommunityModeratorForm,
|
||||
},
|
||||
},
|
||||
traits::{ApubActor, Crud, Followable, Joinable},
|
||||
};
|
||||
use lemmy_db_schema_file::enums::CommunityFollowerState;
|
||||
use lemmy_db_views::structs::{LocalUserView, SiteView};
|
||||
use lemmy_utils::{
|
||||
error::{LemmyErrorExt, LemmyErrorType, LemmyResult},
|
||||
|
@ -1,5 +1,5 @@
|
||||
use lemmy_api_common::utils::is_admin;
|
||||
use lemmy_db_schema::CommunityVisibility;
|
||||
use lemmy_db_schema_file::enums::CommunityVisibility;
|
||||
use lemmy_db_views::structs::LocalUserView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
|
@ -183,12 +183,8 @@ mod tests {
|
||||
|
||||
use crate::site::create::validate_create_payload;
|
||||
use lemmy_api_common::site::CreateSite;
|
||||
use lemmy_db_schema::{
|
||||
source::local_site::LocalSite,
|
||||
ListingType,
|
||||
PostSortType,
|
||||
RegistrationMode,
|
||||
};
|
||||
use lemmy_db_schema::source::local_site::LocalSite;
|
||||
use lemmy_db_schema_file::enums::{ListingType, PostSortType, RegistrationMode};
|
||||
use lemmy_utils::error::LemmyErrorType;
|
||||
|
||||
#[test]
|
||||
|
@ -1,4 +1,4 @@
|
||||
use lemmy_db_schema::{ListingType, RegistrationMode};
|
||||
use lemmy_db_schema_file::enums::{ListingType, RegistrationMode};
|
||||
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
|
||||
|
||||
pub mod create;
|
||||
@ -51,7 +51,7 @@ fn not_zero(val: Option<i32>) -> Option<i32> {
|
||||
mod tests {
|
||||
|
||||
use crate::site::{application_question_check, not_zero, site_default_post_listing_type_check};
|
||||
use lemmy_db_schema::{ListingType, RegistrationMode};
|
||||
use lemmy_db_schema_file::enums::{ListingType, RegistrationMode};
|
||||
|
||||
#[test]
|
||||
fn test_site_default_post_listing_type_check() {
|
||||
|
@ -25,8 +25,8 @@ use lemmy_db_schema::{
|
||||
},
|
||||
traits::Crud,
|
||||
utils::{diesel_opt_number_update, diesel_string_update},
|
||||
RegistrationMode,
|
||||
};
|
||||
use lemmy_db_schema_file::enums::RegistrationMode;
|
||||
use lemmy_db_views::structs::{LocalUserView, SiteView};
|
||||
use lemmy_utils::{
|
||||
error::{LemmyErrorExt, LemmyErrorType, LemmyResult},
|
||||
@ -229,12 +229,8 @@ mod tests {
|
||||
|
||||
use crate::site::update::validate_update_payload;
|
||||
use lemmy_api_common::site::EditSite;
|
||||
use lemmy_db_schema::{
|
||||
source::local_site::LocalSite,
|
||||
ListingType,
|
||||
PostSortType,
|
||||
RegistrationMode,
|
||||
};
|
||||
use lemmy_db_schema::source::local_site::LocalSite;
|
||||
use lemmy_db_schema_file::enums::{ListingType, PostSortType, RegistrationMode};
|
||||
use lemmy_utils::error::LemmyErrorType;
|
||||
|
||||
#[test]
|
||||
|
@ -31,8 +31,8 @@ use lemmy_db_schema::{
|
||||
},
|
||||
traits::Crud,
|
||||
utils::get_conn,
|
||||
RegistrationMode,
|
||||
};
|
||||
use lemmy_db_schema_file::enums::RegistrationMode;
|
||||
use lemmy_db_views::structs::{LocalUserView, SiteView};
|
||||
use lemmy_email::{
|
||||
account::send_verification_email_if_required,
|
||||
|
@ -23,6 +23,7 @@ lemmy_db_schema = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views = { workspace = true, features = ["full"] }
|
||||
lemmy_api_common = { workspace = true, features = ["full"] }
|
||||
activitypub_federation = { workspace = true }
|
||||
lemmy_db_schema_file = { workspace = true }
|
||||
diesel = { workspace = true }
|
||||
chrono = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
|
@ -20,13 +20,13 @@ use lemmy_api_common::context::LemmyContext;
|
||||
use lemmy_db_schema::{
|
||||
source::{
|
||||
activity::ActivitySendTargets,
|
||||
community::{CommunityActions, CommunityFollowerForm, CommunityFollowerState},
|
||||
community::{CommunityActions, CommunityFollowerForm},
|
||||
instance::Instance,
|
||||
person::{PersonActions, PersonFollowerForm},
|
||||
},
|
||||
traits::Followable,
|
||||
CommunityVisibility,
|
||||
};
|
||||
use lemmy_db_schema_file::enums::{CommunityFollowerState, CommunityVisibility};
|
||||
use lemmy_utils::error::{FederationError, LemmyError, LemmyErrorType, LemmyResult};
|
||||
use url::Url;
|
||||
|
||||
|
@ -36,13 +36,13 @@ use lemmy_api_common::{
|
||||
};
|
||||
use lemmy_db_schema::{
|
||||
source::{
|
||||
activity::{ActivitySendTargets, ActorType, SentActivity, SentActivityForm},
|
||||
activity::{ActivitySendTargets, SentActivity, SentActivityForm},
|
||||
community::Community,
|
||||
instance::InstanceActions,
|
||||
},
|
||||
traits::Crud,
|
||||
CommunityVisibility,
|
||||
};
|
||||
use lemmy_db_schema_file::enums::{ActorType, CommunityVisibility};
|
||||
use lemmy_db_views::structs::{CommunityPersonBanView, CommunityView, SiteView};
|
||||
use lemmy_utils::error::{FederationError, LemmyError, LemmyResult};
|
||||
use serde::Serialize;
|
||||
|
@ -18,7 +18,7 @@ use activitypub_federation::{
|
||||
traits::{ActivityHandler, Actor},
|
||||
};
|
||||
use lemmy_api_common::{context::LemmyContext, utils::check_bot_account};
|
||||
use lemmy_db_schema::FederationMode;
|
||||
use lemmy_db_schema_file::enums::FederationMode;
|
||||
use lemmy_db_views::structs::SiteView;
|
||||
use lemmy_utils::error::{LemmyError, LemmyResult};
|
||||
use url::Url;
|
||||
|
@ -4,10 +4,8 @@ use lemmy_api_common::{context::LemmyContext, LemmyErrorType};
|
||||
use lemmy_db_schema::{
|
||||
newtypes::{CommunityId, PersonId},
|
||||
source::{local_site::LocalSite, local_user::LocalUser, person::Person},
|
||||
CommentSortType,
|
||||
ListingType,
|
||||
PostSortType,
|
||||
};
|
||||
use lemmy_db_schema_file::enums::{CommentSortType, ListingType, PostSortType};
|
||||
use lemmy_db_views::structs::LocalUserView;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
|
@ -13,12 +13,7 @@ use lemmy_db_schema::{
|
||||
newtypes::DbUrl,
|
||||
source::{
|
||||
comment::{CommentActions, CommentSavedForm},
|
||||
community::{
|
||||
CommunityActions,
|
||||
CommunityBlockForm,
|
||||
CommunityFollowerForm,
|
||||
CommunityFollowerState,
|
||||
},
|
||||
community::{CommunityActions, CommunityBlockForm, CommunityFollowerForm},
|
||||
instance::{Instance, InstanceActions, InstanceBlockForm},
|
||||
local_user::{LocalUser, LocalUserUpdateForm},
|
||||
person::{Person, PersonActions, PersonBlockForm, PersonUpdateForm},
|
||||
@ -26,6 +21,7 @@ use lemmy_db_schema::{
|
||||
},
|
||||
traits::{Blockable, Crud, Followable, Saveable},
|
||||
};
|
||||
use lemmy_db_schema_file::enums::CommunityFollowerState;
|
||||
use lemmy_db_views::structs::LocalUserView;
|
||||
use lemmy_utils::{
|
||||
error::{LemmyErrorType, LemmyResult, MAX_API_PARAM_ELEMENTS},
|
||||
@ -276,18 +272,13 @@ where
|
||||
#[cfg(test)]
|
||||
#[expect(clippy::indexing_slicing)]
|
||||
pub(crate) mod tests {
|
||||
use super::*;
|
||||
use crate::api::user_settings_backup::{export_settings, import_settings};
|
||||
use actix_web::web::Json;
|
||||
use lemmy_api_common::context::LemmyContext;
|
||||
use lemmy_db_schema::{
|
||||
source::{
|
||||
community::{
|
||||
Community,
|
||||
CommunityActions,
|
||||
CommunityFollowerForm,
|
||||
CommunityFollowerState,
|
||||
CommunityInsertForm,
|
||||
},
|
||||
community::{Community, CommunityActions, CommunityFollowerForm, CommunityInsertForm},
|
||||
instance::Instance,
|
||||
person::Person,
|
||||
},
|
||||
|
@ -18,7 +18,8 @@ use activitypub_federation::{
|
||||
};
|
||||
use futures::future::join_all;
|
||||
use lemmy_api_common::{context::LemmyContext, utils::generate_outbox_url};
|
||||
use lemmy_db_schema::{source::site::Site, utils::FETCH_LIMIT_MAX, PostSortType};
|
||||
use lemmy_db_schema::{source::site::Site, utils::FETCH_LIMIT_MAX};
|
||||
use lemmy_db_schema_file::enums::PostSortType;
|
||||
use lemmy_db_views::post::post_view::PostQuery;
|
||||
use lemmy_utils::error::{LemmyError, LemmyResult};
|
||||
use url::Url;
|
||||
|
@ -9,7 +9,7 @@ use activitypub_federation::{
|
||||
};
|
||||
use chrono::{DateTime, Utc};
|
||||
use lemmy_api_common::context::LemmyContext;
|
||||
use lemmy_db_schema::source::activity::ActorType;
|
||||
use lemmy_db_schema_file::enums::ActorType;
|
||||
use lemmy_utils::error::{LemmyError, LemmyResult};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use url::Url;
|
||||
|
@ -22,7 +22,8 @@ use actix_web::{
|
||||
HttpResponse,
|
||||
};
|
||||
use lemmy_api_common::context::LemmyContext;
|
||||
use lemmy_db_schema::{source::community::Community, traits::ApubActor, CommunityVisibility};
|
||||
use lemmy_db_schema::{source::community::Community, traits::ApubActor};
|
||||
use lemmy_db_schema_file::enums::CommunityVisibility;
|
||||
use lemmy_db_views::structs::CommunityFollowerView;
|
||||
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
|
||||
use serde::Deserialize;
|
||||
@ -173,7 +174,6 @@ pub(crate) mod tests {
|
||||
site::{Site, SiteInsertForm},
|
||||
},
|
||||
traits::Crud,
|
||||
CommunityVisibility,
|
||||
};
|
||||
use serde::de::DeserializeOwned;
|
||||
use serial_test::serial;
|
||||
|
@ -16,8 +16,8 @@ use lemmy_api_common::context::LemmyContext;
|
||||
use lemmy_db_schema::{
|
||||
newtypes::DbUrl,
|
||||
source::{activity::SentActivity, community::Community},
|
||||
CommunityVisibility,
|
||||
};
|
||||
use lemmy_db_schema_file::enums::CommunityVisibility;
|
||||
use lemmy_db_views::structs::CommunityFollowerView;
|
||||
use lemmy_utils::error::{FederationError, LemmyErrorExt, LemmyErrorType, LemmyResult};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
@ -36,13 +36,12 @@ use lemmy_api_common::{
|
||||
use lemmy_db_schema::{
|
||||
sensitive::SensitiveString,
|
||||
source::{
|
||||
activity::ActorType,
|
||||
actor_language::CommunityLanguage,
|
||||
community::{Community, CommunityInsertForm, CommunityUpdateForm},
|
||||
},
|
||||
traits::{ApubActor, Crud},
|
||||
CommunityVisibility,
|
||||
};
|
||||
use lemmy_db_schema_file::enums::{ActorType, CommunityVisibility};
|
||||
use lemmy_db_views::structs::SiteView;
|
||||
use lemmy_utils::{
|
||||
error::{LemmyError, LemmyResult},
|
||||
|
@ -28,13 +28,13 @@ use lemmy_db_schema::{
|
||||
newtypes::InstanceId,
|
||||
sensitive::SensitiveString,
|
||||
source::{
|
||||
activity::ActorType,
|
||||
actor_language::SiteLanguage,
|
||||
instance::Instance as DbInstance,
|
||||
site::{Site, SiteInsertForm},
|
||||
},
|
||||
traits::Crud,
|
||||
};
|
||||
use lemmy_db_schema_file::enums::ActorType;
|
||||
use lemmy_utils::{
|
||||
error::{FederationError, LemmyError, LemmyResult},
|
||||
utils::{
|
||||
|
@ -27,12 +27,10 @@ use lemmy_api_common::{
|
||||
};
|
||||
use lemmy_db_schema::{
|
||||
sensitive::SensitiveString,
|
||||
source::{
|
||||
activity::ActorType,
|
||||
person::{Person as DbPerson, PersonInsertForm, PersonUpdateForm},
|
||||
},
|
||||
source::person::{Person as DbPerson, PersonInsertForm, PersonUpdateForm},
|
||||
traits::{ApubActor, Crud},
|
||||
};
|
||||
use lemmy_db_schema_file::enums::ActorType;
|
||||
use lemmy_utils::{
|
||||
error::{LemmyError, LemmyResult},
|
||||
utils::{
|
||||
|
@ -21,5 +21,6 @@ diesel-async = { workspace = true }
|
||||
lemmy_db_schema = { workspace = true }
|
||||
lemmy_db_views = { workspace = true, features = ["full"] }
|
||||
lemmy_utils = { workspace = true, features = ["full"] }
|
||||
lemmy_db_schema_file = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
url = { workspace = true }
|
||||
|
@ -11,7 +11,6 @@ use diesel::{
|
||||
};
|
||||
use diesel_async::{RunQueryDsl, SimpleAsyncConnection};
|
||||
use lemmy_db_schema::{
|
||||
schema::post,
|
||||
source::{
|
||||
community::{Community, CommunityInsertForm},
|
||||
instance::Instance,
|
||||
@ -20,8 +19,8 @@ use lemmy_db_schema::{
|
||||
},
|
||||
traits::Crud,
|
||||
utils::{build_db_pool, get_conn, now},
|
||||
PostSortType,
|
||||
};
|
||||
use lemmy_db_schema_file::{enums::PostSortType, schema::post};
|
||||
use lemmy_db_views::{post::post_view::PostQuery, structs::PostPaginationCursor};
|
||||
use lemmy_utils::error::{LemmyErrorExt2, LemmyResult};
|
||||
use std::num::NonZeroU32;
|
||||
|
@ -21,8 +21,6 @@ full = [
|
||||
"lemmy_utils/full",
|
||||
"diesel",
|
||||
"diesel-derive-newtype",
|
||||
"diesel-derive-enum",
|
||||
"diesel_migrations",
|
||||
"bcrypt",
|
||||
"lemmy_utils",
|
||||
"activitypub_federation",
|
||||
@ -38,6 +36,7 @@ full = [
|
||||
"rustls",
|
||||
"i-love-jesus",
|
||||
"tuplex",
|
||||
"lemmy_db_schema_file/full",
|
||||
]
|
||||
|
||||
[dependencies]
|
||||
@ -49,17 +48,10 @@ strum = { workspace = true }
|
||||
serde_json = { workspace = true, optional = true }
|
||||
activitypub_federation = { workspace = true, optional = true }
|
||||
lemmy_utils = { workspace = true, optional = true }
|
||||
lemmy_db_schema_file = { workspace = true }
|
||||
bcrypt = { workspace = true, optional = true }
|
||||
diesel = { workspace = true, features = [
|
||||
"chrono",
|
||||
"postgres",
|
||||
"serde_json",
|
||||
"uuid",
|
||||
"64-column-tables",
|
||||
], optional = true }
|
||||
diesel = { workspace = true, optional = true }
|
||||
diesel-derive-newtype = { workspace = true, optional = true }
|
||||
diesel-derive-enum = { workspace = true, optional = true }
|
||||
diesel_migrations = { workspace = true, optional = true }
|
||||
diesel-async = { workspace = true, features = [
|
||||
"deadpool",
|
||||
"postgres",
|
||||
@ -76,11 +68,9 @@ tokio-postgres-rustls = { workspace = true, optional = true }
|
||||
rustls = { workspace = true, optional = true }
|
||||
uuid.workspace = true
|
||||
i-love-jesus = { workspace = true, optional = true }
|
||||
anyhow = { workspace = true }
|
||||
derive-new.workspace = true
|
||||
tuplex = { workspace = true, optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
serial_test = { workspace = true }
|
||||
pretty_assertions = { workspace = true }
|
||||
diffutils = "0.4.2"
|
||||
|
@ -14,7 +14,7 @@ use diesel_async::RunQueryDsl;
|
||||
|
||||
impl SentActivity {
|
||||
pub async fn create(pool: &mut DbPool<'_>, form: SentActivityForm) -> Result<Self, Error> {
|
||||
use crate::schema::sent_activity::dsl::sent_activity;
|
||||
use lemmy_db_schema_file::schema::sent_activity::dsl::sent_activity;
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
insert_into(sent_activity)
|
||||
.values(form)
|
||||
@ -23,12 +23,12 @@ impl SentActivity {
|
||||
}
|
||||
|
||||
pub async fn read_from_apub_id(pool: &mut DbPool<'_>, object_id: &DbUrl) -> Result<Self, Error> {
|
||||
use crate::schema::sent_activity::dsl::{ap_id, sent_activity};
|
||||
use lemmy_db_schema_file::schema::sent_activity::dsl::{ap_id, sent_activity};
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
sent_activity.filter(ap_id.eq(object_id)).first(conn).await
|
||||
}
|
||||
pub async fn read(pool: &mut DbPool<'_>, object_id: ActivityId) -> Result<Self, Error> {
|
||||
use crate::schema::sent_activity::dsl::sent_activity;
|
||||
use lemmy_db_schema_file::schema::sent_activity::dsl::sent_activity;
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
sent_activity.find(object_id).first(conn).await
|
||||
}
|
||||
@ -36,7 +36,7 @@ impl SentActivity {
|
||||
|
||||
impl ReceivedActivity {
|
||||
pub async fn create(pool: &mut DbPool<'_>, ap_id_: &DbUrl) -> Result<(), Error> {
|
||||
use crate::schema::received_activity::dsl::{ap_id, received_activity};
|
||||
use lemmy_db_schema_file::schema::received_activity::dsl::{ap_id, received_activity};
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
let rows_affected = insert_into(received_activity)
|
||||
.values(ap_id.eq(ap_id_))
|
||||
@ -61,7 +61,8 @@ impl ReceivedActivity {
|
||||
mod tests {
|
||||
|
||||
use super::*;
|
||||
use crate::{source::activity::ActorType, utils::build_db_pool_for_tests};
|
||||
use crate::utils::build_db_pool_for_tests;
|
||||
use lemmy_db_schema_file::enums::ActorType;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
use pretty_assertions::assert_eq;
|
||||
use serde_json::json;
|
||||
|
@ -1,7 +1,6 @@
|
||||
use crate::{
|
||||
diesel::JoinOnDsl,
|
||||
newtypes::{CommunityId, InstanceId, LanguageId, LocalUserId, SiteId},
|
||||
schema::{community_language, local_site, local_user_language, site, site_language},
|
||||
source::{
|
||||
actor_language::{
|
||||
CommunityLanguage,
|
||||
@ -31,6 +30,13 @@ use diesel_async::{
|
||||
AsyncPgConnection,
|
||||
RunQueryDsl,
|
||||
};
|
||||
use lemmy_db_schema_file::schema::{
|
||||
community_language,
|
||||
local_site,
|
||||
local_user_language,
|
||||
site,
|
||||
site_language,
|
||||
};
|
||||
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
|
||||
use tokio::sync::OnceCell;
|
||||
|
||||
@ -186,7 +192,7 @@ impl CommunityLanguage {
|
||||
for_language_id: LanguageId,
|
||||
for_community_id: CommunityId,
|
||||
) -> LemmyResult<()> {
|
||||
use crate::schema::community_language::dsl::community_language;
|
||||
use lemmy_db_schema_file::schema::community_language::dsl::community_language;
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
|
||||
let is_allowed = select(exists(
|
||||
@ -210,7 +216,7 @@ impl CommunityLanguage {
|
||||
conn: &mut AsyncPgConnection,
|
||||
for_instance_id: InstanceId,
|
||||
) -> Result<(), Error> {
|
||||
use crate::schema::{
|
||||
use lemmy_db_schema_file::schema::{
|
||||
community::dsl as c,
|
||||
community_language::dsl as cl,
|
||||
site_language::dsl as sl,
|
||||
@ -236,7 +242,11 @@ impl CommunityLanguage {
|
||||
pool: &mut DbPool<'_>,
|
||||
for_community_id: CommunityId,
|
||||
) -> Result<Vec<LanguageId>, Error> {
|
||||
use crate::schema::community_language::dsl::{community_id, community_language, language_id};
|
||||
use lemmy_db_schema_file::schema::community_language::dsl::{
|
||||
community_id,
|
||||
community_language,
|
||||
language_id,
|
||||
};
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
let langs = community_language
|
||||
.filter(community_id.eq(for_community_id))
|
||||
@ -305,7 +315,10 @@ pub async fn validate_post_language(
|
||||
community_id: CommunityId,
|
||||
local_user_id: LocalUserId,
|
||||
) -> LemmyResult<LanguageId> {
|
||||
use crate::schema::{community_language::dsl as cl, local_user_language::dsl as ul};
|
||||
use lemmy_db_schema_file::schema::{
|
||||
community_language::dsl as cl,
|
||||
local_user_language::dsl as ul,
|
||||
};
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
let language_id = match language_id {
|
||||
None | Some(LanguageId(0)) => {
|
||||
@ -360,7 +373,7 @@ async fn convert_read_languages(
|
||||
static ALL_LANGUAGES_COUNT: OnceCell<usize> = OnceCell::const_new();
|
||||
let count = ALL_LANGUAGES_COUNT
|
||||
.get_or_init(|| async {
|
||||
use crate::schema::language::dsl::{id, language};
|
||||
use lemmy_db_schema_file::schema::language::dsl::{id, language};
|
||||
let count: i64 = language
|
||||
.select(count(id))
|
||||
.first(conn)
|
||||
@ -446,7 +459,7 @@ mod tests {
|
||||
#[tokio::test]
|
||||
#[serial]
|
||||
async fn test_convert_read_languages() -> Result<(), Error> {
|
||||
use crate::schema::language::dsl::{id, language};
|
||||
use lemmy_db_schema_file::schema::language::dsl::{id, language};
|
||||
let pool = &build_db_pool_for_tests();
|
||||
let pool = &mut pool.into();
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
use crate::{
|
||||
schema::captcha_answer::dsl::{answer, captcha_answer},
|
||||
source::captcha_answer::{CaptchaAnswer, CaptchaAnswerForm, CheckCaptchaAnswer},
|
||||
utils::{functions::lower, get_conn, DbPool},
|
||||
};
|
||||
@ -13,6 +12,7 @@ use diesel::{
|
||||
QueryDsl,
|
||||
};
|
||||
use diesel_async::RunQueryDsl;
|
||||
use lemmy_db_schema_file::schema::captcha_answer::dsl::{answer, captcha_answer};
|
||||
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
|
||||
|
||||
impl CaptchaAnswer {
|
||||
|
@ -1,7 +1,6 @@
|
||||
use crate::{
|
||||
diesel::{DecoratableTarget, OptionalExtension},
|
||||
newtypes::{CommentId, DbUrl, InstanceId, PersonId},
|
||||
schema::{comment, comment_actions, community, post},
|
||||
source::comment::{
|
||||
Comment,
|
||||
CommentActions,
|
||||
@ -31,6 +30,7 @@ use diesel::{
|
||||
};
|
||||
use diesel_async::RunQueryDsl;
|
||||
use diesel_ltree::Ltree;
|
||||
use lemmy_db_schema_file::schema::{comment, comment_actions, community, post};
|
||||
use lemmy_utils::{
|
||||
error::{LemmyErrorExt, LemmyErrorType, LemmyResult},
|
||||
settings::structs::Settings,
|
||||
|
@ -1,13 +1,13 @@
|
||||
use crate::{
|
||||
diesel::OptionalExtension,
|
||||
newtypes::{CommentId, CommentReplyId, PersonId},
|
||||
schema::comment_reply,
|
||||
source::comment_reply::{CommentReply, CommentReplyInsertForm, CommentReplyUpdateForm},
|
||||
traits::Crud,
|
||||
utils::{get_conn, DbPool},
|
||||
};
|
||||
use diesel::{dsl::insert_into, result::Error, ExpressionMethods, QueryDsl};
|
||||
use diesel_async::RunQueryDsl;
|
||||
use lemmy_db_schema_file::schema::comment_reply;
|
||||
|
||||
impl Crud for CommentReply {
|
||||
type InsertForm = CommentReplyInsertForm;
|
||||
|
@ -1,6 +1,5 @@
|
||||
use crate::{
|
||||
newtypes::{CommentId, CommentReportId, PersonId},
|
||||
schema::comment_report,
|
||||
source::comment_report::{CommentReport, CommentReportForm},
|
||||
traits::Reportable,
|
||||
utils::{get_conn, DbPool},
|
||||
@ -13,6 +12,7 @@ use diesel::{
|
||||
QueryDsl,
|
||||
};
|
||||
use diesel_async::RunQueryDsl;
|
||||
use lemmy_db_schema_file::schema::comment_report;
|
||||
use lemmy_utils::error::{LemmyErrorExt, LemmyErrorType, LemmyResult};
|
||||
|
||||
impl Reportable for CommentReport {
|
||||
|
@ -1,7 +1,6 @@
|
||||
use crate::{
|
||||
diesel::{DecoratableTarget, OptionalExtension},
|
||||
newtypes::{CommunityId, DbUrl, PersonId},
|
||||
schema::{community, community_actions, instance, post},
|
||||
source::{
|
||||
actor_language::CommunityLanguage,
|
||||
community::{
|
||||
@ -9,7 +8,6 @@ use crate::{
|
||||
CommunityActions,
|
||||
CommunityBlockForm,
|
||||
CommunityFollowerForm,
|
||||
CommunityFollowerState,
|
||||
CommunityInsertForm,
|
||||
CommunityModeratorForm,
|
||||
CommunityPersonBanForm,
|
||||
@ -24,8 +22,6 @@ use crate::{
|
||||
uplete,
|
||||
DbPool,
|
||||
},
|
||||
CommunityVisibility,
|
||||
ListingType,
|
||||
};
|
||||
use chrono::{DateTime, Utc};
|
||||
use diesel::{
|
||||
@ -40,6 +36,10 @@ use diesel::{
|
||||
QueryDsl,
|
||||
};
|
||||
use diesel_async::RunQueryDsl;
|
||||
use lemmy_db_schema_file::{
|
||||
enums::{CommunityFollowerState, CommunityVisibility, ListingType},
|
||||
schema::{community, community_actions, instance, post},
|
||||
};
|
||||
use lemmy_utils::{
|
||||
error::{LemmyErrorExt, LemmyErrorType, LemmyResult},
|
||||
settings::structs::Settings,
|
||||
@ -585,6 +585,7 @@ impl ApubActor for Community {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::{
|
||||
source::{
|
||||
comment::{Comment, CommentInsertForm},
|
||||
@ -592,7 +593,6 @@ mod tests {
|
||||
Community,
|
||||
CommunityActions,
|
||||
CommunityFollowerForm,
|
||||
CommunityFollowerState,
|
||||
CommunityInsertForm,
|
||||
CommunityModeratorForm,
|
||||
CommunityPersonBanForm,
|
||||
@ -605,7 +605,6 @@ mod tests {
|
||||
},
|
||||
traits::{Bannable, Crud, Followable, Joinable},
|
||||
utils::{build_db_pool_for_tests, uplete, RANK_DEFAULT},
|
||||
CommunityVisibility,
|
||||
};
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
use pretty_assertions::assert_eq;
|
||||
|
@ -1,6 +1,5 @@
|
||||
use crate::{
|
||||
newtypes::{CommunityId, CommunityReportId, PersonId},
|
||||
schema::community_report,
|
||||
source::community_report::{CommunityReport, CommunityReportForm},
|
||||
traits::Reportable,
|
||||
utils::{get_conn, DbPool},
|
||||
@ -13,6 +12,7 @@ use diesel::{
|
||||
QueryDsl,
|
||||
};
|
||||
use diesel_async::RunQueryDsl;
|
||||
use lemmy_db_schema_file::schema::community_report;
|
||||
use lemmy_utils::error::{LemmyErrorExt, LemmyErrorType, LemmyResult};
|
||||
|
||||
impl Reportable for CommunityReport {
|
||||
|
@ -1,9 +1,5 @@
|
||||
use crate::{
|
||||
newtypes::CustomEmojiId,
|
||||
schema::{
|
||||
custom_emoji::dsl::custom_emoji,
|
||||
custom_emoji_keyword::dsl::{custom_emoji_id, custom_emoji_keyword},
|
||||
},
|
||||
source::{
|
||||
custom_emoji::{CustomEmoji, CustomEmojiInsertForm, CustomEmojiUpdateForm},
|
||||
custom_emoji_keyword::{CustomEmojiKeyword, CustomEmojiKeywordInsertForm},
|
||||
@ -13,6 +9,10 @@ use crate::{
|
||||
};
|
||||
use diesel::{dsl::insert_into, result::Error, ExpressionMethods, QueryDsl};
|
||||
use diesel_async::RunQueryDsl;
|
||||
use lemmy_db_schema_file::schema::{
|
||||
custom_emoji::dsl::custom_emoji,
|
||||
custom_emoji_keyword::dsl::{custom_emoji_id, custom_emoji_keyword},
|
||||
};
|
||||
|
||||
impl Crud for CustomEmoji {
|
||||
type InsertForm = CustomEmojiInsertForm;
|
||||
|
@ -1,11 +1,5 @@
|
||||
use crate::{
|
||||
newtypes::LocalUserId,
|
||||
schema::email_verification::dsl::{
|
||||
email_verification,
|
||||
local_user_id,
|
||||
published,
|
||||
verification_token,
|
||||
},
|
||||
source::email_verification::{EmailVerification, EmailVerificationForm},
|
||||
utils::{get_conn, DbPool},
|
||||
};
|
||||
@ -19,6 +13,12 @@ use diesel::{
|
||||
QueryDsl,
|
||||
};
|
||||
use diesel_async::RunQueryDsl;
|
||||
use lemmy_db_schema_file::schema::email_verification::dsl::{
|
||||
email_verification,
|
||||
local_user_id,
|
||||
published,
|
||||
verification_token,
|
||||
};
|
||||
|
||||
impl EmailVerification {
|
||||
pub async fn create(pool: &mut DbPool<'_>, form: &EmailVerificationForm) -> Result<Self, Error> {
|
||||
|
@ -1,11 +1,11 @@
|
||||
use crate::{
|
||||
newtypes::InstanceId,
|
||||
schema::federation_allowlist,
|
||||
source::federation_allowlist::{FederationAllowList, FederationAllowListForm},
|
||||
utils::{get_conn, DbPool},
|
||||
};
|
||||
use diesel::{delete, dsl::insert_into, result::Error, ExpressionMethods, QueryDsl};
|
||||
use diesel_async::RunQueryDsl;
|
||||
use lemmy_db_schema_file::schema::federation_allowlist;
|
||||
|
||||
impl FederationAllowList {
|
||||
pub async fn allow(pool: &mut DbPool<'_>, form: &FederationAllowListForm) -> Result<Self, Error> {
|
||||
|
@ -1,11 +1,11 @@
|
||||
use crate::{
|
||||
newtypes::InstanceId,
|
||||
schema::federation_blocklist,
|
||||
source::federation_blocklist::{FederationBlockList, FederationBlockListForm},
|
||||
utils::{get_conn, DbPool},
|
||||
};
|
||||
use diesel::{delete, dsl::insert_into, result::Error, ExpressionMethods, QueryDsl};
|
||||
use diesel_async::RunQueryDsl;
|
||||
use lemmy_db_schema_file::schema::federation_blocklist;
|
||||
|
||||
impl FederationBlockList {
|
||||
pub async fn block(pool: &mut DbPool<'_>, form: &FederationBlockListForm) -> Result<Self, Error> {
|
||||
|
@ -12,7 +12,10 @@ impl FederationQueueState {
|
||||
pool: &mut DbPool<'_>,
|
||||
instance_id_: InstanceId,
|
||||
) -> Result<FederationQueueState, Error> {
|
||||
use crate::schema::federation_queue_state::dsl::{federation_queue_state, instance_id};
|
||||
use lemmy_db_schema_file::schema::federation_queue_state::dsl::{
|
||||
federation_queue_state,
|
||||
instance_id,
|
||||
};
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
Ok(
|
||||
federation_queue_state
|
||||
@ -31,7 +34,10 @@ impl FederationQueueState {
|
||||
)
|
||||
}
|
||||
pub async fn upsert(pool: &mut DbPool<'_>, state: &FederationQueueState) -> Result<(), Error> {
|
||||
use crate::schema::federation_queue_state::dsl::{federation_queue_state, instance_id};
|
||||
use lemmy_db_schema_file::schema::federation_queue_state::dsl::{
|
||||
federation_queue_state,
|
||||
instance_id,
|
||||
};
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
|
||||
state
|
||||
|
@ -1,6 +1,5 @@
|
||||
use crate::{
|
||||
newtypes::{DbUrl, LocalUserId},
|
||||
schema::{image_details, local_image, remote_image},
|
||||
source::images::{ImageDetails, ImageDetailsInsertForm, LocalImage, LocalImageForm, RemoteImage},
|
||||
utils::{get_conn, DbPool},
|
||||
};
|
||||
@ -15,6 +14,7 @@ use diesel::{
|
||||
QueryDsl,
|
||||
};
|
||||
use diesel_async::{scoped_futures::ScopedFutureExt, AsyncConnection, RunQueryDsl};
|
||||
use lemmy_db_schema_file::schema::{image_details, local_image, remote_image};
|
||||
use url::Url;
|
||||
|
||||
impl LocalImage {
|
||||
|
@ -1,15 +1,6 @@
|
||||
use crate::{
|
||||
diesel::dsl::IntervalDsl,
|
||||
newtypes::{InstanceId, PersonId},
|
||||
schema::{
|
||||
federation_allowlist,
|
||||
federation_blocklist,
|
||||
federation_queue_state,
|
||||
instance,
|
||||
instance_actions,
|
||||
local_site,
|
||||
site,
|
||||
},
|
||||
source::{
|
||||
federation_queue_state::FederationQueueState,
|
||||
instance::{Instance, InstanceActions, InstanceBanForm, InstanceBlockForm, InstanceForm},
|
||||
@ -34,13 +25,22 @@ use diesel::{
|
||||
SelectableHelper,
|
||||
};
|
||||
use diesel_async::RunQueryDsl;
|
||||
use lemmy_db_schema_file::schema::{
|
||||
federation_allowlist,
|
||||
federation_blocklist,
|
||||
federation_queue_state,
|
||||
instance,
|
||||
instance_actions,
|
||||
local_site,
|
||||
site,
|
||||
};
|
||||
use lemmy_utils::error::{LemmyErrorExt, LemmyErrorType, LemmyResult};
|
||||
|
||||
impl Instance {
|
||||
/// Attempt to read Instance column for the given domain. If it doesn't exist, insert a new one.
|
||||
/// There is no need for update as the domain of an existing instance cant change.
|
||||
pub async fn read_or_create(pool: &mut DbPool<'_>, domain_: String) -> Result<Self, Error> {
|
||||
use crate::schema::instance::domain;
|
||||
use lemmy_db_schema_file::schema::instance::domain;
|
||||
let conn = &mut get_conn(pool).await?;
|
||||
|
||||
// First try to read the instance row and return directly if found
|
||||
|
@ -2,12 +2,12 @@ use super::actor_language::UNDETERMINED_ID;
|
||||
use crate::{
|
||||
diesel::ExpressionMethods,
|
||||
newtypes::LanguageId,
|
||||
schema::language,
|
||||
source::language::Language,
|
||||
utils::{get_conn, DbPool},
|
||||
};
|
||||
use diesel::{result::Error, QueryDsl};
|
||||
use diesel_async::RunQueryDsl;
|
||||
use lemmy_db_schema_file::schema::language;
|
||||
|
||||
impl Language {
|
||||
pub async fn read_all(pool: &mut DbPool<'_>) -> Result<Vec<Self>, Error> {
|
||||
|
@ -1,10 +1,10 @@
|
||||
use crate::{
|
||||
schema::local_site,
|
||||
source::local_site::{LocalSite, LocalSiteInsertForm, LocalSiteUpdateForm},
|
||||
utils::{get_conn, DbPool},
|
||||
};
|
||||
use diesel::{dsl::insert_into, result::Error};
|
||||
use diesel_async::RunQueryDsl;
|
||||
use lemmy_db_schema_file::schema::local_site;
|
||||
|
||||
impl LocalSite {
|
||||
pub async fn create(pool: &mut DbPool<'_>, form: &LocalSiteInsertForm) -> Result<Self, Error> {
|
||||
|
@ -1,6 +1,5 @@
|
||||
use crate::{
|
||||
diesel::OptionalExtension,
|
||||
schema::local_site_rate_limit,
|
||||
source::local_site_rate_limit::{
|
||||
LocalSiteRateLimit,
|
||||
LocalSiteRateLimitInsertForm,
|
||||
@ -10,6 +9,7 @@ use crate::{
|
||||
};
|
||||
use diesel::{dsl::insert_into, result::Error};
|
||||
use diesel_async::RunQueryDsl;
|
||||
use lemmy_db_schema_file::schema::local_site_rate_limit;
|
||||
|
||||
impl LocalSiteRateLimit {
|
||||
pub async fn read(pool: &mut DbPool<'_>) -> Result<Option<Self>, Error> {
|
||||
|
@ -1,5 +1,4 @@
|
||||
use crate::{
|
||||
schema::local_site_url_blocklist,
|
||||
source::local_site_url_blocklist::{LocalSiteUrlBlocklist, LocalSiteUrlBlocklistForm},
|
||||
utils::{get_conn, DbPool},
|
||||
};
|
||||
@ -10,6 +9,7 @@ use diesel_async::{
|
||||
AsyncPgConnection,
|
||||
RunQueryDsl,
|
||||
};
|
||||
use lemmy_db_schema_file::schema::local_site_url_blocklist;
|
||||
|
||||
impl LocalSiteUrlBlocklist {
|
||||
pub async fn replace(pool: &mut DbPool<'_>, url_blocklist: Vec<String>) -> Result<usize, Error> {
|
||||
|
@ -1,6 +1,5 @@
|
||||
use crate::{
|
||||
newtypes::{CommunityId, DbUrl, LanguageId, LocalUserId, PersonId},
|
||||
schema::{community, community_actions, local_user, person, registration_application},
|
||||
source::{
|
||||
actor_language::LocalUserLanguage,
|
||||
local_user::{LocalUser, LocalUserInsertForm, LocalUserUpdateForm},
|
||||
@ -12,7 +11,6 @@ use crate::{
|
||||
now,
|
||||
DbPool,
|
||||
},
|
||||
CommunityVisibility,
|
||||
};
|
||||
use bcrypt::{hash, DEFAULT_COST};
|
||||
use diesel::{
|
||||
@ -24,6 +22,10 @@ use diesel::{
|
||||
QueryDsl,
|
||||
};
|
||||
use diesel_async::RunQueryDsl;
|
||||
use lemmy_db_schema_file::{
|
||||
enums::CommunityVisibility,
|
||||
schema::{community, community_actions, local_user, person, registration_application},
|
||||
};
|
||||
use lemmy_utils::error::{LemmyErrorExt, LemmyErrorType, LemmyResult};
|
||||
|
||||
impl LocalUser {
|
||||
@ -149,7 +151,7 @@ impl LocalUser {
|
||||
pool: &mut DbPool<'_>,
|
||||
person_id_: PersonId,
|
||||
) -> Result<UserBackupLists, Error> {
|
||||
use crate::schema::{
|
||||
use lemmy_db_schema_file::schema::{
|
||||
comment,
|
||||
comment_actions,
|
||||
community,
|
||||
|
@ -1,12 +1,12 @@
|
||||
use crate::{
|
||||
diesel::{ExpressionMethods, QueryDsl},
|
||||
newtypes::LocalUserId,
|
||||
schema::login_token::{dsl::login_token, user_id},
|
||||
source::login_token::{LoginToken, LoginTokenCreateForm},
|
||||
utils::{get_conn, DbPool},
|
||||
};
|
||||
use diesel::{delete, dsl::exists, insert_into, result::Error, select};
|
||||
use diesel_async::RunQueryDsl;
|
||||
use lemmy_db_schema_file::schema::login_token::{dsl::login_token, user_id};
|
||||
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
|
||||
|
||||
impl LoginToken {
|
||||
|
@ -7,14 +7,6 @@ use crate::{
|
||||
AdminPurgePersonId,
|
||||
AdminPurgePostId,
|
||||
},
|
||||
schema::{
|
||||
admin_allow_instance,
|
||||
admin_block_instance,
|
||||
admin_purge_comment,
|
||||
admin_purge_community,
|
||||
admin_purge_person,
|
||||
admin_purge_post,
|
||||
},
|
||||
source::mod_log::admin::{
|
||||
AdminAllowInstance,
|
||||
AdminAllowInstanceForm,
|
||||
@ -34,6 +26,14 @@ use crate::{
|
||||
};
|
||||
use diesel::{dsl::insert_into, result::Error, QueryDsl};
|
||||
use diesel_async::RunQueryDsl;
|
||||
use lemmy_db_schema_file::schema::{
|
||||
admin_allow_instance,
|
||||
admin_block_instance,
|
||||
admin_purge_comment,
|
||||
admin_purge_community,
|
||||
admin_purge_person,
|
||||
admin_purge_post,
|
||||
};
|
||||
|
||||
impl Crud for AdminPurgePerson {
|
||||
type InsertForm = AdminPurgePersonForm;
|
||||
|
@ -12,19 +12,6 @@ use crate::{
|
||||
ModRemovePostId,
|
||||
ModTransferCommunityId,
|
||||
},
|
||||
schema::{
|
||||
mod_add,
|
||||
mod_add_community,
|
||||
mod_ban,
|
||||
mod_ban_from_community,
|
||||
mod_change_community_visibility,
|
||||
mod_feature_post,
|
||||
mod_lock_post,
|
||||
mod_remove_comment,
|
||||
mod_remove_community,
|
||||
mod_remove_post,
|
||||
mod_transfer_community,
|
||||
},
|
||||
source::mod_log::moderator::{
|
||||
ModAdd,
|
||||
ModAddCommunity,
|
||||
@ -54,6 +41,19 @@ use crate::{
|
||||
};
|
||||
use diesel::{dsl::insert_into, result::Error, QueryDsl};
|
||||
use diesel_async::RunQueryDsl;
|
||||
use lemmy_db_schema_file::schema::{
|
||||
mod_add,
|
||||
mod_add_community,
|
||||
mod_ban,
|
||||
mod_ban_from_community,
|
||||
mod_change_community_visibility,
|
||||
mod_feature_post,
|
||||
mod_lock_post,
|
||||
mod_remove_comment,
|
||||
mod_remove_community,
|
||||
mod_remove_post,
|
||||
mod_transfer_community,
|
||||
};
|
||||
|
||||
impl Crud for ModRemovePost {
|
||||
type InsertForm = ModRemovePostForm;
|
||||
|
@ -1,11 +1,11 @@
|
||||
use crate::{
|
||||
newtypes::LocalUserId,
|
||||
schema::{oauth_account, oauth_account::dsl::local_user_id},
|
||||
source::oauth_account::{OAuthAccount, OAuthAccountInsertForm},
|
||||
utils::{get_conn, DbPool},
|
||||
};
|
||||
use diesel::{insert_into, result::Error, ExpressionMethods, QueryDsl};
|
||||
use diesel_async::RunQueryDsl;
|
||||
use lemmy_db_schema_file::schema::{oauth_account, oauth_account::dsl::local_user_id};
|
||||
|
||||
impl OAuthAccount {
|
||||
pub async fn create(pool: &mut DbPool<'_>, form: &OAuthAccountInsertForm) -> Result<Self, Error> {
|
||||
|
@ -1,6 +1,5 @@
|
||||
use crate::{
|
||||
newtypes::OAuthProviderId,
|
||||
schema::oauth_provider,
|
||||
source::oauth_provider::{
|
||||
OAuthProvider,
|
||||
OAuthProviderInsertForm,
|
||||
@ -12,6 +11,7 @@ use crate::{
|
||||
};
|
||||
use diesel::{dsl::insert_into, result::Error, QueryDsl};
|
||||
use diesel_async::RunQueryDsl;
|
||||
use lemmy_db_schema_file::schema::oauth_provider;
|
||||
|
||||
impl Crud for OAuthProvider {
|
||||
type InsertForm = OAuthProviderInsertForm;
|
||||
|
@ -1,6 +1,5 @@
|
||||
use crate::{
|
||||
newtypes::LocalUserId,
|
||||
schema::password_reset_request::dsl::{password_reset_request, published, token},
|
||||
source::password_reset_request::{PasswordResetRequest, PasswordResetRequestForm},
|
||||
utils::{get_conn, DbPool},
|
||||
};
|
||||
@ -13,6 +12,11 @@ use diesel::{
|
||||
IntoSql,
|
||||
};
|
||||
use diesel_async::RunQueryDsl;
|
||||
use lemmy_db_schema_file::schema::password_reset_request::dsl::{
|
||||
password_reset_request,
|
||||
published,
|
||||
token,
|
||||
};
|
||||
|
||||
impl PasswordResetRequest {
|
||||
pub async fn create(
|
||||
|
@ -1,7 +1,6 @@
|
||||
use crate::{
|
||||
diesel::OptionalExtension,
|
||||
newtypes::{CommunityId, DbUrl, InstanceId, PersonId},
|
||||
schema::{instance, local_user, person, person_actions},
|
||||
source::person::{
|
||||
Person,
|
||||
PersonActions,
|
||||
@ -23,6 +22,7 @@ use diesel::{
|
||||
QueryDsl,
|
||||
};
|
||||
use diesel_async::RunQueryDsl;
|
||||
use lemmy_db_schema_file::schema::{instance, local_user, person, person_actions};
|
||||
use lemmy_utils::{
|
||||
error::{LemmyErrorExt, LemmyErrorType, LemmyResult},
|
||||
settings::structs::Settings,
|
||||
|
@ -1,7 +1,6 @@
|
||||
use crate::{
|
||||
diesel::OptionalExtension,
|
||||
newtypes::{CommentId, PersonCommentMentionId, PersonId},
|
||||
schema::person_comment_mention,
|
||||
source::person_comment_mention::{
|
||||
PersonCommentMention,
|
||||
PersonCommentMentionInsertForm,
|
||||
@ -12,6 +11,7 @@ use crate::{
|
||||
};
|
||||
use diesel::{dsl::insert_into, result::Error, ExpressionMethods, QueryDsl};
|
||||
use diesel_async::RunQueryDsl;
|
||||
use lemmy_db_schema_file::schema::person_comment_mention;
|
||||
|
||||
impl Crud for PersonCommentMention {
|
||||
type InsertForm = PersonCommentMentionInsertForm;
|
||||
|
@ -1,7 +1,6 @@
|
||||
use crate::{
|
||||
diesel::OptionalExtension,
|
||||
newtypes::{PersonId, PersonPostMentionId, PostId},
|
||||
schema::person_post_mention,
|
||||
source::person_post_mention::{
|
||||
PersonPostMention,
|
||||
PersonPostMentionInsertForm,
|
||||
@ -12,6 +11,7 @@ use crate::{
|
||||
};
|
||||
use diesel::{dsl::insert_into, result::Error, ExpressionMethods, QueryDsl};
|
||||
use diesel_async::RunQueryDsl;
|
||||
use lemmy_db_schema_file::schema::person_post_mention;
|
||||
|
||||
impl Crud for PersonPostMention {
|
||||
type InsertForm = PersonPostMentionInsertForm;
|
||||
|
@ -1,6 +1,5 @@
|
||||
use crate::{
|
||||
newtypes::{CommunityId, DbUrl, InstanceId, PersonId, PostId},
|
||||
schema::{community, person, post, post_actions},
|
||||
source::post::{
|
||||
Post,
|
||||
PostActions,
|
||||
@ -42,6 +41,7 @@ use diesel::{
|
||||
QueryDsl,
|
||||
};
|
||||
use diesel_async::RunQueryDsl;
|
||||
use lemmy_db_schema_file::schema::{community, person, post, post_actions};
|
||||
use lemmy_utils::{
|
||||
error::{LemmyErrorExt, LemmyErrorType, LemmyResult},
|
||||
settings::structs::Settings,
|
||||
|
@ -1,6 +1,5 @@
|
||||
use crate::{
|
||||
newtypes::{PersonId, PostId, PostReportId},
|
||||
schema::post_report,
|
||||
source::post_report::{PostReport, PostReportForm},
|
||||
traits::Reportable,
|
||||
utils::{get_conn, DbPool},
|
||||
@ -13,6 +12,7 @@ use diesel::{
|
||||
QueryDsl,
|
||||
};
|
||||
use diesel_async::RunQueryDsl;
|
||||
use lemmy_db_schema_file::schema::post_report;
|
||||
use lemmy_utils::error::{LemmyErrorExt, LemmyErrorType, LemmyResult};
|
||||
|
||||
impl Reportable for PostReport {
|
||||
|
@ -1,7 +1,6 @@
|
||||
use crate::{
|
||||
diesel::{DecoratableTarget, OptionalExtension},
|
||||
newtypes::{DbUrl, PersonId, PrivateMessageId},
|
||||
schema::private_message,
|
||||
source::private_message::{PrivateMessage, PrivateMessageInsertForm, PrivateMessageUpdateForm},
|
||||
traits::Crud,
|
||||
utils::{functions::coalesce, get_conn, DbPool},
|
||||
@ -9,6 +8,7 @@ use crate::{
|
||||
use chrono::{DateTime, Utc};
|
||||
use diesel::{dsl::insert_into, result::Error, ExpressionMethods, QueryDsl};
|
||||
use diesel_async::RunQueryDsl;
|
||||
use lemmy_db_schema_file::schema::private_message;
|
||||
use lemmy_utils::{error::LemmyResult, settings::structs::Settings};
|
||||
use url::Url;
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
use crate::{
|
||||
newtypes::{PersonId, PrivateMessageId, PrivateMessageReportId},
|
||||
schema::private_message_report::dsl::{private_message_report, resolved, resolver_id, updated},
|
||||
source::private_message_report::{PrivateMessageReport, PrivateMessageReportForm},
|
||||
traits::Reportable,
|
||||
utils::{get_conn, DbPool},
|
||||
@ -12,6 +11,12 @@ use diesel::{
|
||||
QueryDsl,
|
||||
};
|
||||
use diesel_async::RunQueryDsl;
|
||||
use lemmy_db_schema_file::schema::private_message_report::dsl::{
|
||||
private_message_report,
|
||||
resolved,
|
||||
resolver_id,
|
||||
updated,
|
||||
};
|
||||
use lemmy_utils::error::{FederationError, LemmyErrorExt, LemmyErrorType, LemmyResult};
|
||||
|
||||
impl Reportable for PrivateMessageReport {
|
||||
|
@ -1,6 +1,5 @@
|
||||
use crate::{
|
||||
newtypes::{LocalUserId, RegistrationApplicationId},
|
||||
schema::registration_application,
|
||||
source::registration_application::{
|
||||
RegistrationApplication,
|
||||
RegistrationApplicationInsertForm,
|
||||
@ -11,6 +10,7 @@ use crate::{
|
||||
};
|
||||
use diesel::{insert_into, result::Error, ExpressionMethods, QueryDsl};
|
||||
use diesel_async::RunQueryDsl;
|
||||
use lemmy_db_schema_file::schema::registration_application;
|
||||
|
||||
impl Crud for RegistrationApplication {
|
||||
type InsertForm = RegistrationApplicationInsertForm;
|
||||
|
@ -1,10 +1,10 @@
|
||||
use crate::{
|
||||
schema::secret::dsl::secret,
|
||||
source::secret::Secret,
|
||||
utils::{get_conn, DbPool},
|
||||
};
|
||||
use diesel::result::Error;
|
||||
use diesel_async::RunQueryDsl;
|
||||
use lemmy_db_schema_file::schema::secret::dsl::secret;
|
||||
|
||||
impl Secret {
|
||||
/// Initialize the Secrets from the DB.
|
||||
|
@ -1,6 +1,5 @@
|
||||
use crate::{
|
||||
newtypes::{DbUrl, InstanceId, SiteId},
|
||||
schema::{local_site, site},
|
||||
source::{
|
||||
actor_language::SiteLanguage,
|
||||
site::{Site, SiteInsertForm, SiteUpdateForm},
|
||||
@ -10,6 +9,7 @@ use crate::{
|
||||
};
|
||||
use diesel::{dsl::insert_into, result::Error, ExpressionMethods, OptionalExtension, QueryDsl};
|
||||
use diesel_async::RunQueryDsl;
|
||||
use lemmy_db_schema_file::schema::{local_site, site};
|
||||
use lemmy_utils::error::{LemmyErrorExt, LemmyErrorType, LemmyResult};
|
||||
use url::Url;
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
use crate::{
|
||||
newtypes::TagId,
|
||||
schema::{post_tag, tag},
|
||||
source::tag::{PostTagInsertForm, Tag, TagInsertForm},
|
||||
traits::Crud,
|
||||
utils::{get_conn, DbPool},
|
||||
};
|
||||
use diesel::{insert_into, result::Error, QueryDsl};
|
||||
use diesel_async::RunQueryDsl;
|
||||
use lemmy_db_schema_file::schema::{post_tag, tag};
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
impl Crud for Tag {
|
||||
|
@ -1,12 +1,12 @@
|
||||
use crate::{
|
||||
newtypes::TaglineId,
|
||||
schema::tagline::dsl::{published, tagline},
|
||||
source::tagline::{Tagline, TaglineInsertForm, TaglineUpdateForm},
|
||||
traits::Crud,
|
||||
utils::{functions::random, get_conn, limit_and_offset, DbPool},
|
||||
};
|
||||
use diesel::{insert_into, result::Error, ExpressionMethods, QueryDsl};
|
||||
use diesel_async::RunQueryDsl;
|
||||
use lemmy_db_schema_file::schema::tagline::dsl::{published, tagline};
|
||||
|
||||
impl Crud for Tagline {
|
||||
type InsertForm = TaglineInsertForm;
|
||||
|
@ -5,20 +5,13 @@ extern crate diesel;
|
||||
#[macro_use]
|
||||
extern crate diesel_derive_newtype;
|
||||
|
||||
#[cfg(feature = "full")]
|
||||
#[macro_use]
|
||||
extern crate diesel_derive_enum;
|
||||
|
||||
#[cfg(feature = "full")]
|
||||
pub mod impls;
|
||||
pub mod newtypes;
|
||||
pub mod sensitive;
|
||||
#[cfg(feature = "full")]
|
||||
#[rustfmt::skip]
|
||||
pub mod schema;
|
||||
#[cfg(feature = "full")]
|
||||
pub mod aliases {
|
||||
use crate::schema::{community_actions, instance_actions, local_user, person};
|
||||
use lemmy_db_schema_file::schema::{community_actions, instance_actions, local_user, person};
|
||||
diesel::alias!(
|
||||
community_actions as creator_community_actions: CreatorCommunityActions,
|
||||
instance_actions as creator_home_instance_actions: CreatorHomeInstanceActions,
|
||||
@ -34,63 +27,15 @@ pub mod traits;
|
||||
#[cfg(feature = "full")]
|
||||
pub mod utils;
|
||||
|
||||
#[cfg(feature = "full")]
|
||||
pub mod schema_setup;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use strum::{Display, EnumString};
|
||||
#[cfg(feature = "full")]
|
||||
use {
|
||||
diesel::query_source::AliasedField,
|
||||
schema::{community_actions, instance_actions, person},
|
||||
lemmy_db_schema_file::schema::{community_actions, instance_actions, person},
|
||||
ts_rs::TS,
|
||||
};
|
||||
|
||||
#[derive(
|
||||
EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Default, Hash,
|
||||
)]
|
||||
#[cfg_attr(feature = "full", derive(DbEnum, TS))]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
ExistingTypePath = "crate::schema::sql_types::PostSortTypeEnum"
|
||||
)]
|
||||
#[cfg_attr(feature = "full", DbValueStyle = "verbatim")]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
// TODO add the controversial and scaled rankings to the doc below
|
||||
/// The post sort types. See here for descriptions: https://join-lemmy.org/docs/en/users/03-votes-and-ranking.html
|
||||
pub enum PostSortType {
|
||||
#[default]
|
||||
Active,
|
||||
Hot,
|
||||
New,
|
||||
Old,
|
||||
Top,
|
||||
MostComments,
|
||||
NewComments,
|
||||
Controversial,
|
||||
Scaled,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Default, Hash,
|
||||
)]
|
||||
#[cfg_attr(feature = "full", derive(DbEnum, TS))]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
ExistingTypePath = "crate::schema::sql_types::CommentSortTypeEnum"
|
||||
)]
|
||||
#[cfg_attr(feature = "full", DbValueStyle = "verbatim")]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
/// The comment sort types. See here for descriptions: https://join-lemmy.org/docs/en/users/03-votes-and-ranking.html
|
||||
pub enum CommentSortType {
|
||||
#[default]
|
||||
Hot,
|
||||
Top,
|
||||
New,
|
||||
Old,
|
||||
Controversial,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Default, Hash,
|
||||
)]
|
||||
@ -104,71 +49,6 @@ pub enum SearchSortType {
|
||||
Old,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Default, Hash,
|
||||
)]
|
||||
#[cfg_attr(feature = "full", derive(DbEnum, TS))]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
ExistingTypePath = "crate::schema::sql_types::ListingTypeEnum"
|
||||
)]
|
||||
#[cfg_attr(feature = "full", DbValueStyle = "verbatim")]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
/// A listing type for post and comment list fetches.
|
||||
pub enum ListingType {
|
||||
/// Content from your own site, as well as all connected / federated sites.
|
||||
All,
|
||||
/// Content from your site only.
|
||||
#[default]
|
||||
Local,
|
||||
/// Content only from communities you've subscribed to.
|
||||
Subscribed,
|
||||
/// Content that you can moderate (because you are a moderator of the community it is posted to)
|
||||
ModeratorView,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Default, Hash,
|
||||
)]
|
||||
#[cfg_attr(feature = "full", derive(DbEnum, TS))]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
ExistingTypePath = "crate::schema::sql_types::RegistrationModeEnum"
|
||||
)]
|
||||
#[cfg_attr(feature = "full", DbValueStyle = "verbatim")]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
/// The registration mode for your site. Determines what happens after a user signs up.
|
||||
pub enum RegistrationMode {
|
||||
/// Closed to public.
|
||||
Closed,
|
||||
/// Open, but pending approval of a registration application.
|
||||
RequireApplication,
|
||||
/// Open to all.
|
||||
#[default]
|
||||
Open,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
EnumString, Display, Debug, Serialize, Deserialize, Default, Clone, Copy, PartialEq, Eq, Hash,
|
||||
)]
|
||||
#[cfg_attr(feature = "full", derive(DbEnum, TS))]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
ExistingTypePath = "crate::schema::sql_types::PostListingModeEnum"
|
||||
)]
|
||||
#[cfg_attr(feature = "full", DbValueStyle = "verbatim")]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
/// A post-view mode that changes how multiple post listings look.
|
||||
pub enum PostListingMode {
|
||||
/// A compact, list-type view.
|
||||
#[default]
|
||||
List,
|
||||
/// A larger card-type view.
|
||||
Card,
|
||||
/// A smaller card-type view, usually with images as thumbnails
|
||||
SmallCard,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
EnumString, Display, Debug, Serialize, Deserialize, Default, Clone, Copy, PartialEq, Eq, Hash,
|
||||
)]
|
||||
@ -257,64 +137,6 @@ pub enum PostFeatureType {
|
||||
Community,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Default, Hash,
|
||||
)]
|
||||
#[cfg_attr(feature = "full", derive(DbEnum, TS))]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
ExistingTypePath = "crate::schema::sql_types::CommunityVisibility"
|
||||
)]
|
||||
#[cfg_attr(feature = "full", DbValueStyle = "verbatim")]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
/// Defines who can browse and interact with content in a community.
|
||||
pub enum CommunityVisibility {
|
||||
/// Public community, any local or federated user can interact.
|
||||
#[default]
|
||||
Public,
|
||||
/// Community is unlisted/hidden and doesn't appear in community list. Posts from the community
|
||||
/// are not shown in Local and All feeds, except for subscribed users.
|
||||
Unlisted,
|
||||
/// Unfederated community, only local users can interact (with or without login).
|
||||
LocalOnlyPublic,
|
||||
/// Unfederated community, only logged-in local users can interact.
|
||||
LocalOnlyPrivate,
|
||||
/// Users need to be approved by mods before they are able to browse or post.
|
||||
Private,
|
||||
}
|
||||
|
||||
impl CommunityVisibility {
|
||||
pub fn can_federate(&self) -> bool {
|
||||
use CommunityVisibility::*;
|
||||
self != &LocalOnlyPublic && self != &LocalOnlyPrivate
|
||||
}
|
||||
pub fn can_view_without_login(&self) -> bool {
|
||||
use CommunityVisibility::*;
|
||||
self == &Public || self == &LocalOnlyPublic
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(
|
||||
EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Default, Hash,
|
||||
)]
|
||||
#[cfg_attr(feature = "full", derive(DbEnum, TS))]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
ExistingTypePath = "crate::schema::sql_types::FederationModeEnum"
|
||||
)]
|
||||
#[cfg_attr(feature = "full", DbValueStyle = "verbatim")]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
/// The federation mode for an item
|
||||
pub enum FederationMode {
|
||||
#[default]
|
||||
/// Allows all
|
||||
All,
|
||||
/// Allows only local
|
||||
Local,
|
||||
/// Disables
|
||||
Disable,
|
||||
}
|
||||
|
||||
/// Wrapper for assert_eq! macro. Checks that vec matches the given length, and prints the
|
||||
/// vec on failure.
|
||||
#[macro_export]
|
||||
|
@ -1,9 +1,10 @@
|
||||
use crate::{
|
||||
newtypes::{ActivityId, CommunityId, DbUrl},
|
||||
use crate::newtypes::{ActivityId, CommunityId, DbUrl};
|
||||
use chrono::{DateTime, Utc};
|
||||
use diesel::Queryable;
|
||||
use lemmy_db_schema_file::{
|
||||
enums::ActorType,
|
||||
schema::{received_activity, sent_activity},
|
||||
};
|
||||
use chrono::{DateTime, Utc};
|
||||
use diesel::{sql_types::Nullable, Queryable};
|
||||
use serde_json::Value;
|
||||
use std::{collections::HashSet, fmt::Debug};
|
||||
use url::Url;
|
||||
@ -81,14 +82,6 @@ pub struct SentActivityForm {
|
||||
pub actor_apub_id: DbUrl,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, diesel_derive_enum::DbEnum, PartialEq, Eq)]
|
||||
#[ExistingTypePath = "crate::schema::sql_types::ActorTypeEnum"]
|
||||
pub enum ActorType {
|
||||
Site,
|
||||
Community,
|
||||
Person,
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Eq, Debug)]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
|
||||
#[cfg_attr(feature = "full", diesel(primary_key(ap_id)))]
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::newtypes::{CommunityId, LanguageId, LocalUserId, SiteId};
|
||||
#[cfg(feature = "full")]
|
||||
use crate::schema::local_user_language;
|
||||
use lemmy_db_schema_file::schema::local_user_language;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
@ -22,7 +22,7 @@ pub struct LocalUserLanguageForm {
|
||||
}
|
||||
|
||||
#[cfg(feature = "full")]
|
||||
use crate::schema::community_language;
|
||||
use lemmy_db_schema_file::schema::community_language;
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
|
||||
@ -43,7 +43,7 @@ pub struct CommunityLanguageForm {
|
||||
}
|
||||
|
||||
#[cfg(feature = "full")]
|
||||
use crate::schema::site_language;
|
||||
use lemmy_db_schema_file::schema::site_language;
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
|
||||
|
@ -1,6 +1,6 @@
|
||||
#[cfg(feature = "full")]
|
||||
use crate::schema::captcha_answer;
|
||||
use chrono::{DateTime, Utc};
|
||||
#[cfg(feature = "full")]
|
||||
use lemmy_db_schema_file::schema::captcha_answer;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
use uuid::Uuid;
|
||||
|
@ -5,11 +5,11 @@ use crate::newtypes::{
|
||||
PersonPostMentionId,
|
||||
PrivateMessageId,
|
||||
};
|
||||
#[cfg(feature = "full")]
|
||||
use crate::schema::inbox_combined;
|
||||
use chrono::{DateTime, Utc};
|
||||
#[cfg(feature = "full")]
|
||||
use i_love_jesus::CursorKeysModule;
|
||||
#[cfg(feature = "full")]
|
||||
use lemmy_db_schema_file::schema::inbox_combined;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
|
||||
|
@ -18,11 +18,11 @@ use crate::newtypes::{
|
||||
ModTransferCommunityId,
|
||||
ModlogCombinedId,
|
||||
};
|
||||
#[cfg(feature = "full")]
|
||||
use crate::schema::modlog_combined;
|
||||
use chrono::{DateTime, Utc};
|
||||
#[cfg(feature = "full")]
|
||||
use i_love_jesus::CursorKeysModule;
|
||||
#[cfg(feature = "full")]
|
||||
use lemmy_db_schema_file::schema::modlog_combined;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(PartialEq, Eq, Serialize, Deserialize, Debug, Clone)]
|
||||
|
@ -1,9 +1,9 @@
|
||||
use crate::newtypes::{CommentId, PersonContentCombinedId, PostId};
|
||||
#[cfg(feature = "full")]
|
||||
use crate::schema::person_content_combined;
|
||||
use chrono::{DateTime, Utc};
|
||||
#[cfg(feature = "full")]
|
||||
use i_love_jesus::CursorKeysModule;
|
||||
#[cfg(feature = "full")]
|
||||
use lemmy_db_schema_file::schema::person_content_combined;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
use crate::newtypes::{CommentId, PersonId, PersonSavedCombinedId, PostId};
|
||||
#[cfg(feature = "full")]
|
||||
use crate::schema::person_saved_combined;
|
||||
use chrono::{DateTime, Utc};
|
||||
#[cfg(feature = "full")]
|
||||
use i_love_jesus::CursorKeysModule;
|
||||
#[cfg(feature = "full")]
|
||||
use lemmy_db_schema_file::schema::person_saved_combined;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
|
||||
|
@ -5,11 +5,11 @@ use crate::newtypes::{
|
||||
PrivateMessageReportId,
|
||||
ReportCombinedId,
|
||||
};
|
||||
#[cfg(feature = "full")]
|
||||
use crate::schema::report_combined;
|
||||
use chrono::{DateTime, Utc};
|
||||
#[cfg(feature = "full")]
|
||||
use i_love_jesus::CursorKeysModule;
|
||||
#[cfg(feature = "full")]
|
||||
use lemmy_db_schema_file::schema::report_combined;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
use crate::newtypes::{CommentId, CommunityId, PersonId, PostId, SearchCombinedId};
|
||||
#[cfg(feature = "full")]
|
||||
use crate::schema::search_combined;
|
||||
use chrono::{DateTime, Utc};
|
||||
#[cfg(feature = "full")]
|
||||
use i_love_jesus::CursorKeysModule;
|
||||
#[cfg(feature = "full")]
|
||||
use lemmy_db_schema_file::schema::search_combined;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
#[cfg(feature = "full")]
|
||||
use crate::newtypes::LtreeDef;
|
||||
use crate::newtypes::{CommentId, DbUrl, LanguageId, PersonId, PostId};
|
||||
#[cfg(feature = "full")]
|
||||
use crate::schema::{comment, comment_actions};
|
||||
use chrono::{DateTime, Utc};
|
||||
#[cfg(feature = "full")]
|
||||
use diesel_ltree::Ltree;
|
||||
#[cfg(feature = "full")]
|
||||
use lemmy_db_schema_file::schema::{comment, comment_actions};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::newtypes::{CommentId, CommentReplyId, PersonId};
|
||||
#[cfg(feature = "full")]
|
||||
use crate::schema::comment_reply;
|
||||
use chrono::{DateTime, Utc};
|
||||
#[cfg(feature = "full")]
|
||||
use lemmy_db_schema_file::schema::comment_reply;
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::newtypes::{CommentId, CommentReportId, PersonId};
|
||||
#[cfg(feature = "full")]
|
||||
use crate::schema::comment_report;
|
||||
use chrono::{DateTime, Utc};
|
||||
#[cfg(feature = "full")]
|
||||
use lemmy_db_schema_file::schema::comment_report;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
|
@ -1,15 +1,14 @@
|
||||
#[cfg(feature = "full")]
|
||||
use crate::schema::{community, community_actions};
|
||||
use crate::{
|
||||
newtypes::{CommunityId, DbUrl, InstanceId, PersonId},
|
||||
sensitive::SensitiveString,
|
||||
source::placeholder_apub_url,
|
||||
CommunityVisibility,
|
||||
};
|
||||
use chrono::{DateTime, Utc};
|
||||
use lemmy_db_schema_file::enums::{CommunityFollowerState, CommunityVisibility};
|
||||
#[cfg(feature = "full")]
|
||||
use lemmy_db_schema_file::schema::{community, community_actions};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
use strum::{Display, EnumString};
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
||||
@ -236,20 +235,6 @@ pub struct CommunityPersonBanForm {
|
||||
pub received_ban: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[derive(EnumString, Display, Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "full", derive(DbEnum, TS))]
|
||||
#[cfg_attr(
|
||||
feature = "full",
|
||||
ExistingTypePath = "crate::schema::sql_types::CommunityFollowerState"
|
||||
)]
|
||||
#[cfg_attr(feature = "full", DbValueStyle = "verbatim")]
|
||||
#[cfg_attr(feature = "full", ts(export))]
|
||||
pub enum CommunityFollowerState {
|
||||
Accepted,
|
||||
Pending,
|
||||
ApprovalRequired,
|
||||
}
|
||||
|
||||
#[derive(Clone, derive_new::new)]
|
||||
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = community_actions))]
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::newtypes::{CommunityId, CommunityReportId, DbUrl, PersonId};
|
||||
#[cfg(feature = "full")]
|
||||
use crate::schema::community_report;
|
||||
use chrono::{DateTime, Utc};
|
||||
#[cfg(feature = "full")]
|
||||
use lemmy_db_schema_file::schema::community_report;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::newtypes::{CustomEmojiId, DbUrl};
|
||||
#[cfg(feature = "full")]
|
||||
use crate::schema::custom_emoji;
|
||||
use chrono::{DateTime, Utc};
|
||||
#[cfg(feature = "full")]
|
||||
use lemmy_db_schema_file::schema::custom_emoji;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::newtypes::CustomEmojiId;
|
||||
#[cfg(feature = "full")]
|
||||
use crate::schema::custom_emoji_keyword;
|
||||
use lemmy_db_schema_file::schema::custom_emoji_keyword;
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::newtypes::LocalUserId;
|
||||
#[cfg(feature = "full")]
|
||||
use crate::schema::email_verification;
|
||||
use chrono::{DateTime, Utc};
|
||||
#[cfg(feature = "full")]
|
||||
use lemmy_db_schema_file::schema::email_verification;
|
||||
|
||||
#[derive(Clone)]
|
||||
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable))]
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::newtypes::InstanceId;
|
||||
#[cfg(feature = "full")]
|
||||
use crate::schema::federation_allowlist;
|
||||
use chrono::{DateTime, Utc};
|
||||
#[cfg(feature = "full")]
|
||||
use lemmy_db_schema_file::schema::federation_allowlist;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt::Debug;
|
||||
|
||||
|
@ -3,7 +3,7 @@ use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt::Debug;
|
||||
#[cfg(feature = "full")]
|
||||
use {crate::schema::federation_blocklist, ts_rs::TS};
|
||||
use {lemmy_db_schema_file::schema::federation_blocklist, ts_rs::TS};
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(
|
||||
|
@ -14,7 +14,7 @@ use ts_rs::TS;
|
||||
derive(Queryable, Selectable, Insertable, AsChangeset)
|
||||
)]
|
||||
#[cfg_attr(feature = "full", derive(TS))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = crate::schema::federation_queue_state))]
|
||||
#[cfg_attr(feature = "full", diesel(table_name = lemmy_db_schema_file::schema::federation_queue_state))]
|
||||
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
||||
pub struct FederationQueueState {
|
||||
pub instance_id: InstanceId,
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::newtypes::{DbUrl, LocalUserId};
|
||||
#[cfg(feature = "full")]
|
||||
use crate::schema::{image_details, local_image, remote_image};
|
||||
use chrono::{DateTime, Utc};
|
||||
#[cfg(feature = "full")]
|
||||
use lemmy_db_schema_file::schema::{image_details, local_image, remote_image};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
use std::fmt::Debug;
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::newtypes::{InstanceId, PersonId};
|
||||
#[cfg(feature = "full")]
|
||||
use crate::schema::{instance, instance_actions};
|
||||
use chrono::{DateTime, Utc};
|
||||
#[cfg(feature = "full")]
|
||||
use lemmy_db_schema_file::schema::{instance, instance_actions};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
use std::fmt::Debug;
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::newtypes::LanguageId;
|
||||
#[cfg(feature = "full")]
|
||||
use crate::schema::language;
|
||||
use lemmy_db_schema_file::schema::language;
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[cfg(feature = "full")]
|
||||
use ts_rs::TS;
|
||||
|
@ -1,7 +1,6 @@
|
||||
#[cfg(feature = "full")]
|
||||
use crate::schema::local_site;
|
||||
use crate::{
|
||||
newtypes::{LocalSiteId, SiteId},
|
||||
use crate::newtypes::{LocalSiteId, SiteId};
|
||||
use chrono::{DateTime, Utc};
|
||||
use lemmy_db_schema_file::enums::{
|
||||
CommentSortType,
|
||||
FederationMode,
|
||||
ListingType,
|
||||
@ -9,7 +8,8 @@ use crate::{
|
||||
PostSortType,
|
||||
RegistrationMode,
|
||||
};
|
||||
use chrono::{DateTime, Utc};
|
||||
#[cfg(feature = "full")]
|
||||
use lemmy_db_schema_file::schema::local_site;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::newtypes::LocalSiteId;
|
||||
#[cfg(feature = "full")]
|
||||
use crate::schema::local_site_rate_limit;
|
||||
use chrono::{DateTime, Utc};
|
||||
#[cfg(feature = "full")]
|
||||
use lemmy_db_schema_file::schema::local_site_rate_limit;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
#[cfg(feature = "full")]
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user