28 lines
1.0 KiB
Rust
28 lines
1.0 KiB
Rust
use axum::{Router, extract::DefaultBodyLimit, middleware, routing::post};
|
|
|
|
use crate::{
|
|
auth::require_bearer_auth, edutainment_baby_drawing::create_baby_love_drawing_magic,
|
|
edutainment_baby_object::generate_baby_object_match_assets, state::AppState,
|
|
};
|
|
|
|
const BABY_LOVE_DRAWING_MAGIC_BODY_LIMIT_BYTES: usize = 8 * 1024 * 1024;
|
|
|
|
pub fn router(state: AppState) -> Router<AppState> {
|
|
Router::new()
|
|
.route(
|
|
"/api/creation/edutainment/baby-object-match/assets",
|
|
post(generate_baby_object_match_assets).route_layer(middleware::from_fn_with_state(
|
|
state.clone(),
|
|
require_bearer_auth,
|
|
)),
|
|
)
|
|
.route(
|
|
"/api/creation/edutainment/baby-love-drawing/magic",
|
|
post(create_baby_love_drawing_magic)
|
|
.layer(DefaultBodyLimit::max(
|
|
BABY_LOVE_DRAWING_MAGIC_BODY_LIMIT_BYTES,
|
|
))
|
|
.route_layer(middleware::from_fn_with_state(state, require_bearer_auth)),
|
|
)
|
|
}
|