//! `/api/team-templates/*` — expose builtin + workspace team templates //! to the wizard's team-picker step. use axum::{ extract::{Path, State}, Json, }; use cm_db::repo::team_templates::{TeamTemplate, TeamTemplateDetail}; use uuid::Uuid; use crate::{ApiError, AppState, Authed}; pub async fn list( State(state): State, Authed(_user): Authed, ) -> Result>, ApiError> { // Builtins are cross-workspace; workspace-authored templates are // filtered by the repo layer (this route only exposes builtins for // now — Slice 3 doesn't ship a workspace template editor yet). let rows = cm_db::repo::team_templates::list_all(&state.pool).await?; Ok(Json(rows)) } pub async fn get( State(state): State, Authed(_user): Authed, Path(id): Path, ) -> Result, ApiError> { let d = cm_db::repo::team_templates::get(&state.pool, id) .await? .ok_or(ApiError::NotFound)?; Ok(Json(d)) }