feat: audit vocabulary/term/authority creation, attributing the acting user (#21)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -7,7 +7,7 @@ use axum::{
|
||||
http::StatusCode,
|
||||
routing::get,
|
||||
};
|
||||
use domain::{AuthorityKind, LocalizedLabel, NewAuthority};
|
||||
use domain::{AuditActor, AuthorityKind, LocalizedLabel, NewAuthority};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use utoipa::ToSchema;
|
||||
|
||||
@@ -91,7 +91,7 @@ pub(crate) async fn list_authorities(
|
||||
)
|
||||
)]
|
||||
pub(crate) async fn create_authority(
|
||||
_auth: Authorized<EditCatalogue>,
|
||||
auth: Authorized<EditCatalogue>,
|
||||
State(state): State<AppState>,
|
||||
Json(req): Json<NewAuthorityRequest>,
|
||||
) -> Result<(StatusCode, Json<CreatedId>), StatusCode> {
|
||||
@@ -117,9 +117,10 @@ pub(crate) async fn create_authority(
|
||||
.await
|
||||
.map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?;
|
||||
|
||||
let id = db::authority::create_authority(&mut tx, &new)
|
||||
.await
|
||||
.map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?;
|
||||
let id =
|
||||
db::authority::create_authority(&mut tx, AuditActor::User(auth.user.id.to_uuid()), &new)
|
||||
.await
|
||||
.map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?;
|
||||
|
||||
tx.commit()
|
||||
.await
|
||||
|
||||
Reference in New Issue
Block a user