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
@@ -8,7 +8,8 @@ use serde_json::{Value, json};
|
||||
use crate::{
|
||||
auth::AuthenticatedSession,
|
||||
error::ApiError,
|
||||
service::{RotateSecretPayload, SecretPayload},
|
||||
request_context::RequestContext,
|
||||
service::{AdminAuditContext, RotateSecretPayload, SecretPayload},
|
||||
state::AppState,
|
||||
};
|
||||
|
||||
@@ -38,14 +39,18 @@ pub async fn create_secret(
|
||||
Path(path): Path<WorkspacePath>,
|
||||
State(state): State<AppState>,
|
||||
Extension(session): Extension<AuthenticatedSession>,
|
||||
Extension(request_context): Extension<RequestContext>,
|
||||
Json(payload): Json<SecretPayload>,
|
||||
) -> Result<Json<Value>, ApiError> {
|
||||
let audit_context =
|
||||
AdminAuditContext::from_session_and_correlation(&session, &request_context.correlation);
|
||||
let secret = state
|
||||
.service
|
||||
.create_secret(
|
||||
&path.workspace_id.as_str().into(),
|
||||
Some(&session.user.id),
|
||||
payload,
|
||||
Some(&audit_context),
|
||||
)
|
||||
.await?;
|
||||
Ok(Json(json!(secret)))
|
||||
@@ -69,8 +74,11 @@ pub async fn rotate_secret(
|
||||
Path(path): Path<WorkspaceSecretPath>,
|
||||
State(state): State<AppState>,
|
||||
Extension(session): Extension<AuthenticatedSession>,
|
||||
Extension(request_context): Extension<RequestContext>,
|
||||
Json(payload): Json<RotateSecretPayload>,
|
||||
) -> Result<Json<Value>, ApiError> {
|
||||
let audit_context =
|
||||
AdminAuditContext::from_session_and_correlation(&session, &request_context.correlation);
|
||||
let secret = state
|
||||
.service
|
||||
.rotate_secret(
|
||||
@@ -78,6 +86,7 @@ pub async fn rotate_secret(
|
||||
&path.secret_id.as_str().into(),
|
||||
Some(&session.user.id),
|
||||
payload,
|
||||
Some(&audit_context),
|
||||
)
|
||||
.await?;
|
||||
Ok(Json(json!(secret)))
|
||||
@@ -86,12 +95,17 @@ pub async fn rotate_secret(
|
||||
pub async fn delete_secret(
|
||||
Path(path): Path<WorkspaceSecretPath>,
|
||||
State(state): State<AppState>,
|
||||
Extension(session): Extension<AuthenticatedSession>,
|
||||
Extension(request_context): Extension<RequestContext>,
|
||||
) -> Result<Json<Value>, ApiError> {
|
||||
let audit_context =
|
||||
AdminAuditContext::from_session_and_correlation(&session, &request_context.correlation);
|
||||
state
|
||||
.service
|
||||
.delete_secret(
|
||||
&path.workspace_id.as_str().into(),
|
||||
&path.secret_id.as_str().into(),
|
||||
Some(&audit_context),
|
||||
)
|
||||
.await?;
|
||||
Ok(Json(json!({ "ok": true })))
|
||||
|
||||
Reference in new issue
Block a user