feat(api): admin vocabulary + term management

GET/POST /api/admin/vocabularies and GET/POST /api/admin/vocabularies/{id}/terms;
reads gated on ViewInternal, writes on EditCatalogue; labels round-trip verified.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-02 22:20:47 +02:00
parent 8b929c7180
commit 7a18e0e9bf
5 changed files with 419 additions and 3 deletions
+12
View File
@@ -26,6 +26,18 @@ where
})
}
/// List all vocabularies, ordered by key.
pub async fn list_vocabularies<'e, E>(executor: E) -> Result<Vec<Vocabulary>, sqlx::Error>
where
E: sqlx::PgExecutor<'e>,
{
let rows = sqlx::query("SELECT id, key FROM vocabulary ORDER BY key")
.fetch_all(executor)
.await?;
rows.into_iter().map(map_vocabulary).collect()
}
/// Look up a vocabulary by its key.
pub async fn vocabulary_by_key<'e, E>(
executor: E,