feat: implement audit logging and add certificate template field to courses

This commit is contained in:
2025-12-23 11:04:36 -03:00
parent 72ddb43fd7
commit f695ed7213
14 changed files with 417 additions and 35 deletions
+14
View File
@@ -11,6 +11,7 @@ pub struct Course {
pub start_date: Option<DateTime<Utc>>,
pub end_date: Option<DateTime<Utc>>,
pub passing_percentage: i32,
pub certificate_template: Option<String>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}
@@ -74,6 +75,18 @@ pub struct AuditLog {
pub created_at: DateTime<Utc>,
}
#[derive(Debug, Serialize, Deserialize, sqlx::FromRow)]
pub struct AuditLogResponse {
pub id: Uuid,
pub user_id: Uuid,
pub user_full_name: Option<String>,
pub action: String,
pub entity_type: String,
pub entity_id: Uuid,
pub changes: serde_json::Value,
pub created_at: DateTime<Utc>,
}
#[derive(Debug, Serialize, Deserialize, sqlx::FromRow)]
pub struct Enrollment {
pub id: Uuid,
@@ -204,6 +217,7 @@ mod tests {
start_date: None,
end_date: None,
passing_percentage: 70,
certificate_template: None,
created_at: Utc::now(),
updated_at: Utc::now(),
},