use axum::extract::{Path, State}; use export::data::{AppRequest, AppRequestData, AppResponseData}; use jwt::extractor::AuthUser; use crate::error::ProjectResult; use crate::features::ProjectService; use crate::features::views::{CreateViewCmd, ViewView}; use crate::handler::query::ProjectPath; #[utoipa::path( post, path = "/spaces/{space_id}/projects/{project_id}/views", tag = "project", request_body = AppRequestData, responses((status = 201, description = "Create a view", body = AppResponseData)), security(("bearer_auth" = [])) )] pub(crate) async fn handler( State(svc): State, AuthUser { claims }: AuthUser, Path(path): Path, input: AppRequest, ) -> ProjectResult> { let view = svc .create_view( claims.sub, path.space_id, path.project_id, input.into_inner(), ) .await?; Ok(AppResponseData::ok(view).with_code(201)) }