refactor(db): name audit entity_type constants for vocab/term/authority (#21)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-04 22:05:06 +02:00
parent 984be697ac
commit 146e0164e7
2 changed files with 8 additions and 3 deletions
+3 -1
View File
@@ -8,6 +8,8 @@ use sqlx::Row;
use crate::audit;
const AUTHORITY_ENTITY_TYPE: &str = "authority";
/// Labels aggregated per row as JSON, to read an authority and its labels in one query.
const LABELS_JSON: &str = "COALESCE(json_agg(json_build_object('lang', al.lang, 'label', al.label) \
ORDER BY al.lang) FILTER (WHERE al.authority_id IS NOT NULL), '[]'::json)";
@@ -43,7 +45,7 @@ pub async fn create_authority(
&NewAuditEvent {
actor,
action: AuditAction::Created,
entity_type: "authority".to_owned(),
entity_type: AUTHORITY_ENTITY_TYPE.to_owned(),
entity_id: id.to_uuid(),
changes: Vec::new(),
},