mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-05-14 07:52:39 +00:00
d8722b6e91
* Adding diesel enums for SortType and ListingType - Uses diesel-derive-enum. - Adds diesel.toml , so we can again use the auto-generated schema.rs - Fixes a lot of DB null issues and column ordering issues. - Fixes #1136 - Also replaces RegistrationMode boilerplate. * Fixing unit tests 1. * Remove comment line. * Before patch. * Before again. * Using patch file to fix diesel_ltree issue with diesel.toml * Adding some yalc ignores * Fixing RegistrationMode enums * Adding woodpecker diesel schema check. * Try adding openssl 1. * Try using diesel-cli image 1 * Try using diesel-cli image 2 * Try using diesel-cli image 3 * Try using diesel-cli image 4 * Try using diesel-cli image 5 * Try using diesel-cli image 6 * Try using diesel-cli image 7 * Try using diesel-cli image 8 * Try using diesel-cli image 9 * Try using diesel-cli image 10 * Try using diesel-cli image 11 * Try using diesel-cli image 12 * Try using diesel-cli image 13
101 lines
3.6 KiB
Rust
101 lines
3.6 KiB
Rust
#[cfg(feature = "full")]
|
|
use crate::schema::local_site;
|
|
use crate::{
|
|
newtypes::{LocalSiteId, SiteId},
|
|
ListingType,
|
|
RegistrationMode,
|
|
};
|
|
use serde::{Deserialize, Serialize};
|
|
use typed_builder::TypedBuilder;
|
|
|
|
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
|
|
#[cfg_attr(feature = "full", derive(Queryable, Identifiable))]
|
|
#[cfg_attr(feature = "full", diesel(table_name = local_site))]
|
|
#[cfg_attr(feature = "full", diesel(belongs_to(crate::source::site::Site)))]
|
|
pub struct LocalSite {
|
|
pub id: LocalSiteId,
|
|
pub site_id: SiteId,
|
|
pub site_setup: bool,
|
|
pub enable_downvotes: bool,
|
|
pub enable_nsfw: bool,
|
|
pub community_creation_admin_only: bool,
|
|
pub require_email_verification: bool,
|
|
pub application_question: Option<String>,
|
|
pub private_instance: bool,
|
|
pub default_theme: String,
|
|
pub default_post_listing_type: ListingType,
|
|
pub legal_information: Option<String>,
|
|
pub hide_modlog_mod_names: bool,
|
|
pub application_email_admins: bool,
|
|
pub slur_filter_regex: Option<String>,
|
|
pub actor_name_max_length: i32,
|
|
pub federation_enabled: bool,
|
|
pub federation_debug: bool,
|
|
pub federation_worker_count: i32,
|
|
pub captcha_enabled: bool,
|
|
pub captcha_difficulty: String,
|
|
pub published: chrono::NaiveDateTime,
|
|
pub updated: Option<chrono::NaiveDateTime>,
|
|
pub registration_mode: RegistrationMode,
|
|
pub reports_email_admins: bool,
|
|
}
|
|
|
|
#[derive(Clone, TypedBuilder)]
|
|
#[builder(field_defaults(default))]
|
|
#[cfg_attr(feature = "full", derive(Insertable))]
|
|
#[cfg_attr(feature = "full", diesel(table_name = local_site))]
|
|
pub struct LocalSiteInsertForm {
|
|
#[builder(!default)]
|
|
pub site_id: SiteId,
|
|
pub site_setup: Option<bool>,
|
|
pub enable_downvotes: Option<bool>,
|
|
pub enable_nsfw: Option<bool>,
|
|
pub community_creation_admin_only: Option<bool>,
|
|
pub require_email_verification: Option<bool>,
|
|
pub application_question: Option<String>,
|
|
pub private_instance: Option<bool>,
|
|
pub default_theme: Option<String>,
|
|
pub default_post_listing_type: Option<ListingType>,
|
|
pub legal_information: Option<String>,
|
|
pub hide_modlog_mod_names: Option<bool>,
|
|
pub application_email_admins: Option<bool>,
|
|
pub slur_filter_regex: Option<String>,
|
|
pub actor_name_max_length: Option<i32>,
|
|
pub federation_enabled: Option<bool>,
|
|
pub federation_debug: Option<bool>,
|
|
pub federation_worker_count: Option<i32>,
|
|
pub captcha_enabled: Option<bool>,
|
|
pub captcha_difficulty: Option<String>,
|
|
pub registration_mode: Option<RegistrationMode>,
|
|
pub reports_email_admins: Option<bool>,
|
|
}
|
|
|
|
#[derive(Clone, TypedBuilder)]
|
|
#[builder(field_defaults(default))]
|
|
#[cfg_attr(feature = "full", derive(AsChangeset))]
|
|
#[cfg_attr(feature = "full", diesel(table_name = local_site))]
|
|
pub struct LocalSiteUpdateForm {
|
|
pub site_setup: Option<bool>,
|
|
pub enable_downvotes: Option<bool>,
|
|
pub enable_nsfw: Option<bool>,
|
|
pub community_creation_admin_only: Option<bool>,
|
|
pub require_email_verification: Option<bool>,
|
|
pub application_question: Option<Option<String>>,
|
|
pub private_instance: Option<bool>,
|
|
pub default_theme: Option<String>,
|
|
pub default_post_listing_type: Option<ListingType>,
|
|
pub legal_information: Option<Option<String>>,
|
|
pub hide_modlog_mod_names: Option<bool>,
|
|
pub application_email_admins: Option<bool>,
|
|
pub slur_filter_regex: Option<Option<String>>,
|
|
pub actor_name_max_length: Option<i32>,
|
|
pub federation_enabled: Option<bool>,
|
|
pub federation_debug: Option<bool>,
|
|
pub federation_worker_count: Option<i32>,
|
|
pub captcha_enabled: Option<bool>,
|
|
pub captcha_difficulty: Option<String>,
|
|
pub registration_mode: Option<RegistrationMode>,
|
|
pub reports_email_admins: Option<bool>,
|
|
pub updated: Option<Option<chrono::NaiveDateTime>>,
|
|
}
|