add: layouts api

This commit is contained in:
trisua 2025-07-02 20:14:04 -04:00
parent c83d0a9fc0
commit b493b2ade8
10 changed files with 353 additions and 22 deletions

View file

@ -3,6 +3,7 @@ pub mod auth;
pub mod channels;
pub mod communities;
pub mod journals;
pub mod layouts;
pub mod notes;
pub mod notifications;
pub mod reactions;
@ -26,6 +27,7 @@ use tetratto_core::model::{
},
communities_permissions::CommunityPermission,
journals::JournalPrivacyPermission,
layouts::{CustomizablePage, LayoutPage, LayoutPrivacy},
oauth::AppScope,
permissions::{FinePermission, SecondaryPermission},
reactions::AssetType,
@ -612,6 +614,17 @@ pub fn routes() -> Router {
// uploads
.route("/uploads/{id}", get(uploads::get_request))
.route("/uploads/{id}", delete(uploads::delete_request))
// layouts
.route("/layouts", get(layouts::list_request))
.route("/layouts", post(layouts::create_request))
.route("/layouts/{id}", get(layouts::get_request))
.route("/layouts/{id}", delete(layouts::delete_request))
.route("/layouts/{id}/title", post(layouts::update_name_request))
.route(
"/layouts/{id}/privacy",
post(layouts::update_privacy_request),
)
.route("/layouts/{id}/pages", post(layouts::update_pages_request))
}
#[derive(Deserialize)]
@ -993,3 +1006,24 @@ pub struct UpdateNoteTags {
pub struct AwardAchievement {
pub name: AchievementName,
}
#[derive(Deserialize)]
pub struct CreateLayout {
pub name: String,
pub replaces: CustomizablePage,
}
#[derive(Deserialize)]
pub struct UpdateLayoutName {
pub name: String,
}
#[derive(Deserialize)]
pub struct UpdateLayoutPrivacy {
pub privacy: LayoutPrivacy,
}
#[derive(Deserialize)]
pub struct UpdateLayoutPages {
pub pages: Vec<LayoutPage>,
}