fmt: apply cargo fmt to team template + loader
This commit is contained in:
@@ -406,10 +406,7 @@ pub fn router(state: AppState) -> Router {
|
|||||||
// builtins from TOML on boot; workspace-authored templates
|
// builtins from TOML on boot; workspace-authored templates
|
||||||
// land here in a later slice.
|
// land here in a later slice.
|
||||||
.route("/api/team-templates", get(routes::team_templates::list))
|
.route("/api/team-templates", get(routes::team_templates::list))
|
||||||
.route(
|
.route("/api/team-templates/{id}", get(routes::team_templates::get))
|
||||||
"/api/team-templates/{id}",
|
|
||||||
get(routes::team_templates::get),
|
|
||||||
)
|
|
||||||
// Missions — Slice 1 skeleton. Runs in parallel with the
|
// Missions — Slice 1 skeleton. Runs in parallel with the
|
||||||
// legacy research/loops routes until Slice 9's cutover.
|
// legacy research/loops routes until Slice 9's cutover.
|
||||||
.route(
|
.route(
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ pub mod health;
|
|||||||
pub mod identity;
|
pub mod identity;
|
||||||
pub mod loops;
|
pub mod loops;
|
||||||
pub mod missions;
|
pub mod missions;
|
||||||
pub mod team_templates;
|
|
||||||
pub mod nodes;
|
pub mod nodes;
|
||||||
pub mod oauth;
|
pub mod oauth;
|
||||||
pub mod orgs;
|
pub mod orgs;
|
||||||
@@ -31,6 +30,7 @@ pub mod slack;
|
|||||||
pub mod structure;
|
pub mod structure;
|
||||||
pub mod tailscale;
|
pub mod tailscale;
|
||||||
pub mod team;
|
pub mod team;
|
||||||
|
pub mod team_templates;
|
||||||
pub mod teams;
|
pub mod teams;
|
||||||
pub mod terminal;
|
pub mod terminal;
|
||||||
pub mod topology;
|
pub mod topology;
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
//! to the wizard's team-picker step.
|
//! to the wizard's team-picker step.
|
||||||
|
|
||||||
use axum::{
|
use axum::{
|
||||||
Json,
|
|
||||||
extract::{Path, State},
|
extract::{Path, State},
|
||||||
|
Json,
|
||||||
};
|
};
|
||||||
use cm_db::repo::team_templates::{TeamTemplate, TeamTemplateDetail};
|
use cm_db::repo::team_templates::{TeamTemplate, TeamTemplateDetail};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|||||||
@@ -11,9 +11,7 @@ use sha2::{Digest, Sha256};
|
|||||||
use sqlx::PgPool;
|
use sqlx::PgPool;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use cm_db::repo::team_templates::{
|
use cm_db::repo::team_templates::{upsert_builtin, UpsertBuiltin, UpsertBuiltinRole};
|
||||||
upsert_builtin, UpsertBuiltin, UpsertBuiltinRole,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// Deterministic id per builtin template key. Rolling to sha256 of a
|
/// Deterministic id per builtin template key. Rolling to sha256 of a
|
||||||
/// stable namespace + the key gives us a v4-shaped id that never
|
/// stable namespace + the key gives us a v4-shaped id that never
|
||||||
@@ -118,10 +116,10 @@ pub async fn load_builtins(pool: &PgPool) -> usize {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn load_one(pool: &PgPool, path: &std::path::Path) -> Result<String, String> {
|
async fn load_one(pool: &PgPool, path: &std::path::Path) -> Result<String, String> {
|
||||||
let text = std::fs::read_to_string(path)
|
let text =
|
||||||
.map_err(|e| format!("read {}: {e}", path.display()))?;
|
std::fs::read_to_string(path).map_err(|e| format!("read {}: {e}", path.display()))?;
|
||||||
let file: TemplateFile = toml::from_str(&text)
|
let file: TemplateFile =
|
||||||
.map_err(|e| format!("parse {}: {e}", path.display()))?;
|
toml::from_str(&text).map_err(|e| format!("parse {}: {e}", path.display()))?;
|
||||||
let key = file.key.clone();
|
let key = file.key.clone();
|
||||||
|
|
||||||
let roles: Vec<UpsertBuiltinRole<'_>> = file
|
let roles: Vec<UpsertBuiltinRole<'_>> = file
|
||||||
|
|||||||
Reference in New Issue
Block a user