talbe definition web

This commit is contained in:
Priec
2026-08-06 17:47:53 +02:00
parent f13def52c1
commit 5f4b026624
14 changed files with 870 additions and 273 deletions

View File

@@ -7,12 +7,14 @@ use crate::{
use super::{draft::TableDraft, state::AddTablePageState};
/// Loads everything the builder needs around the draft: the profiles that can
/// be picked, and — for whichever profile the table will belong to — the tables
/// that are link targets and the names the new table may not reuse.
/// Loads everything the builder needs around the draft: the column-type
/// vocabulary, the profiles that can be picked, and — for whichever profile the
/// table will belong to — the tables that are link targets and the names the
/// new table may not reuse.
///
/// The link targets and reserved names always come from the live profile tree,
/// never from the posted form, so they cannot be spoofed by a crafted request.
/// The vocabulary, link targets and reserved names always come from the live
/// backend, never from the posted form, so they cannot be spoofed by a crafted
/// request.
pub(crate) async fn load_page(
state: AppState,
headers: &HeaderMap,
@@ -36,6 +38,19 @@ pub(crate) async fn load_page(
}
let mut definitions = state.definitions;
// What a column may be is the backend's to say; the picker and every rule
// the draft applies are read from this.
draft.columns.catalog = crate::schema::column_catalog(
definitions
.list_column_types(
authenticated_request(headers, Empty {}).map_err(|_| LoadError::Unauthenticated)?,
)
.await
.map_err(|error| LoadError::Backend(error.message().to_string()))?
.into_inner()
.column_types,
);
let tree = definitions
.get_profile_tree(
authenticated_request(headers, Empty {}).map_err(|_| LoadError::Unauthenticated)?,