Large update across server and web clients: regenerated/added many spacetime-client module bindings and input types (including new delete/work_delete input types and numerous procedure/reducer files), updates to server-rs API modules (bark_battle, jump_hop, wooden_fish, auth, module-runtime and shared contracts), and fixes in module-runtime behavior and domain logic. Frontend changes include new/updated components and tests (creative audio helpers, bark-battle/jump-hop/wooden-fish clients and views, unified generation pages, RPG entry views, and runtime shells), plus CSS and service updates. Documentation and operational notes updated (.hermes pitfalls and multiple PRD/docs) to cover daily-task refresh, banner asset fallback, recommend-key bug, and other platform behaviors. Tests and verification steps added/updated alongside these changes.
92 lines
3.1 KiB
Rust
92 lines
3.1 KiB
Rust
use axum::{
|
|
Router, middleware,
|
|
routing::{delete, get, post},
|
|
};
|
|
|
|
use crate::{
|
|
auth::require_bearer_auth,
|
|
bark_battle::{
|
|
create_bark_battle_draft, delete_bark_battle_work, finish_bark_battle_run,
|
|
generate_bark_battle_image_asset, get_bark_battle_run, get_bark_battle_runtime_config,
|
|
list_bark_battle_gallery, list_bark_battle_works, publish_bark_battle_work,
|
|
start_bark_battle_run, update_bark_battle_draft_config,
|
|
},
|
|
state::AppState,
|
|
};
|
|
|
|
pub fn router(state: AppState) -> Router<AppState> {
|
|
Router::new()
|
|
.route(
|
|
"/api/creation/bark-battle/drafts",
|
|
post(create_bark_battle_draft).route_layer(middleware::from_fn_with_state(
|
|
state.clone(),
|
|
require_bearer_auth,
|
|
)),
|
|
)
|
|
.route(
|
|
"/api/creation/bark-battle/drafts/{draft_id}/config",
|
|
post(update_bark_battle_draft_config).route_layer(middleware::from_fn_with_state(
|
|
state.clone(),
|
|
require_bearer_auth,
|
|
)),
|
|
)
|
|
.route(
|
|
"/api/creation/bark-battle/images/generate",
|
|
post(generate_bark_battle_image_asset).route_layer(middleware::from_fn_with_state(
|
|
state.clone(),
|
|
require_bearer_auth,
|
|
)),
|
|
)
|
|
.route(
|
|
"/api/creation/bark-battle/works/publish",
|
|
post(publish_bark_battle_work).route_layer(middleware::from_fn_with_state(
|
|
state.clone(),
|
|
require_bearer_auth,
|
|
)),
|
|
)
|
|
.route(
|
|
"/api/runtime/bark-battle/works",
|
|
get(list_bark_battle_works).route_layer(middleware::from_fn_with_state(
|
|
state.clone(),
|
|
require_bearer_auth,
|
|
)),
|
|
)
|
|
.route(
|
|
"/api/runtime/bark-battle/works/{work_id}",
|
|
delete(delete_bark_battle_work).route_layer(middleware::from_fn_with_state(
|
|
state.clone(),
|
|
require_bearer_auth,
|
|
)),
|
|
)
|
|
.route(
|
|
"/api/runtime/bark-battle/gallery",
|
|
get(list_bark_battle_gallery),
|
|
)
|
|
.route(
|
|
"/api/runtime/bark-battle/works/{work_id}/config",
|
|
get(get_bark_battle_runtime_config).route_layer(middleware::from_fn_with_state(
|
|
state.clone(),
|
|
require_bearer_auth,
|
|
)),
|
|
)
|
|
.route(
|
|
"/api/runtime/bark-battle/works/{work_id}/runs",
|
|
post(start_bark_battle_run).route_layer(middleware::from_fn_with_state(
|
|
state.clone(),
|
|
require_bearer_auth,
|
|
)),
|
|
)
|
|
.route(
|
|
"/api/runtime/bark-battle/runs/{run_id}",
|
|
get(get_bark_battle_run).route_layer(middleware::from_fn_with_state(
|
|
state.clone(),
|
|
require_bearer_auth,
|
|
)),
|
|
)
|
|
.route(
|
|
"/api/runtime/bark-battle/runs/{run_id}/finish",
|
|
post(finish_bark_battle_run)
|
|
.route_layer(middleware::from_fn_with_state(state, require_bearer_auth)),
|
|
)
|
|
}
|