feat: complete Epic 1 production foundation
This commit is contained in:
1 parent
767428436d
commit
182bde8ac0
298 files changed
+35711
-5291
No files matched your search
@@ -0,0 +1,59 @@
|
||||
use axum::{
|
||||
Json,
|
||||
extract::{Path, State},
|
||||
};
|
||||
|
||||
use crate::{
|
||||
error::ApiError,
|
||||
service::{
|
||||
OnboardingEventPayload, OnboardingEventResponse, OnboardingResponse,
|
||||
ResetOnboardingSelectionPayload, ResetOnboardingSelectionResponse,
|
||||
},
|
||||
state::AppState,
|
||||
};
|
||||
|
||||
#[derive(serde::Deserialize)]
|
||||
pub struct WorkspaceOnboardingPath {
|
||||
pub workspace_id: String,
|
||||
}
|
||||
|
||||
pub async fn reset_onboarding_selection(
|
||||
Path(path): Path<WorkspaceOnboardingPath>,
|
||||
State(state): State<AppState>,
|
||||
Json(payload): Json<ResetOnboardingSelectionPayload>,
|
||||
) -> Result<Json<ResetOnboardingSelectionResponse>, ApiError> {
|
||||
Ok(Json(
|
||||
state
|
||||
.service
|
||||
.reset_onboarding_selection(
|
||||
&path.workspace_id.as_str().into(),
|
||||
payload.expected_revision,
|
||||
)
|
||||
.await?,
|
||||
))
|
||||
}
|
||||
|
||||
pub async fn get_onboarding(
|
||||
Path(path): Path<WorkspaceOnboardingPath>,
|
||||
State(state): State<AppState>,
|
||||
) -> Result<Json<OnboardingResponse>, ApiError> {
|
||||
Ok(Json(
|
||||
state
|
||||
.service
|
||||
.get_onboarding(&path.workspace_id.as_str().into())
|
||||
.await?,
|
||||
))
|
||||
}
|
||||
|
||||
pub async fn record_onboarding_event(
|
||||
Path(path): Path<WorkspaceOnboardingPath>,
|
||||
State(state): State<AppState>,
|
||||
Json(payload): Json<OnboardingEventPayload>,
|
||||
) -> Result<Json<OnboardingEventResponse>, ApiError> {
|
||||
Ok(Json(
|
||||
state
|
||||
.service
|
||||
.record_onboarding_event(&path.workspace_id.as_str().into(), payload)
|
||||
.await?,
|
||||
))
|
||||
}
|
||||
Reference in new issue
Block a user