From 9ef0efa420f54c7bba9a80537d7ea965672b9abd Mon Sep 17 00:00:00 2001 From: Nutomic Date: Thu, 19 May 2022 20:32:40 +0000 Subject: [PATCH] Add legal information (fixes #721) (#2273) --- crates/api_common/src/site.rs | 1 + crates/api_crud/src/site/update.rs | 1 + crates/db_schema/src/schema.rs | 1 + crates/db_schema/src/source/site.rs | 2 ++ migrations/2022-05-19-153931_legal-information/down.sql | 1 + migrations/2022-05-19-153931_legal-information/up.sql | 1 + 6 files changed, 7 insertions(+) create mode 100644 migrations/2022-05-19-153931_legal-information/down.sql create mode 100644 migrations/2022-05-19-153931_legal-information/up.sql diff --git a/crates/api_common/src/site.rs b/crates/api_common/src/site.rs index 99c7b4e8e..71b3d0def 100644 --- a/crates/api_common/src/site.rs +++ b/crates/api_common/src/site.rs @@ -133,6 +133,7 @@ pub struct EditSite { pub private_instance: Option, pub default_theme: Option, pub default_post_listing_type: Option, + pub legal_information: Option, pub auth: Sensitive, } diff --git a/crates/api_crud/src/site/update.rs b/crates/api_crud/src/site/update.rs index 0251bddbd..ba0930541 100644 --- a/crates/api_crud/src/site/update.rs +++ b/crates/api_crud/src/site/update.rs @@ -84,6 +84,7 @@ impl PerformCrud for EditSite { private_instance: data.private_instance, default_theme: data.default_theme.clone(), default_post_listing_type: data.default_post_listing_type.clone(), + legal_information: data.legal_information.clone(), ..SiteForm::default() }; diff --git a/crates/db_schema/src/schema.rs b/crates/db_schema/src/schema.rs index 3662d0959..666986a69 100644 --- a/crates/db_schema/src/schema.rs +++ b/crates/db_schema/src/schema.rs @@ -463,6 +463,7 @@ table! { public_key -> Text, default_theme -> Text, default_post_listing_type -> Text, + legal_information -> Nullable, } } diff --git a/crates/db_schema/src/source/site.rs b/crates/db_schema/src/source/site.rs index b43783669..9ba869752 100644 --- a/crates/db_schema/src/source/site.rs +++ b/crates/db_schema/src/source/site.rs @@ -31,6 +31,7 @@ pub struct Site { pub public_key: String, pub default_theme: String, pub default_post_listing_type: String, + pub legal_information: Option, } #[derive(Default)] @@ -59,4 +60,5 @@ pub struct SiteForm { pub public_key: Option, pub default_theme: Option, pub default_post_listing_type: Option, + pub legal_information: Option, } diff --git a/migrations/2022-05-19-153931_legal-information/down.sql b/migrations/2022-05-19-153931_legal-information/down.sql new file mode 100644 index 000000000..0df8c19ef --- /dev/null +++ b/migrations/2022-05-19-153931_legal-information/down.sql @@ -0,0 +1 @@ +alter table site drop column legal_information; \ No newline at end of file diff --git a/migrations/2022-05-19-153931_legal-information/up.sql b/migrations/2022-05-19-153931_legal-information/up.sql new file mode 100644 index 000000000..641fe63f7 --- /dev/null +++ b/migrations/2022-05-19-153931_legal-information/up.sql @@ -0,0 +1 @@ +alter table site add column legal_information text; \ No newline at end of file