WP-20/21: contract and failing tests for vulnerability management
Some checks failed
CI / backend (push) Has been cancelled
CI / frontend (push) Has been cancelled
CI / ui (push) Has been cancelled

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Dennis Nemec
2026-09-02 22:40:48 +02:00
parent e6ef9b21d3
commit 5c6e09ad10
17 changed files with 1530 additions and 1 deletions

View File

@ -6,6 +6,8 @@ use domain::settings::{SmtpSettings, KEY_SMTP, SECRET_KEYS};
use domain::DomainError;
use crate::scheduler::validate_cron;
use crate::vuln_service::{DEFAULT_NOTIFY_MIN_SEVERITY, KEY_NOTIFY_MIN_SEVERITY};
use domain::vuln::Severity;
pub struct SettingsService {
repo: Arc<dyn SettingsRepository>,
@ -104,6 +106,20 @@ impl SettingsService {
}
}
impl SettingsService {
pub async fn notify_min_severity(&self) -> Result<Severity, DomainError> {
Ok(self
.get(KEY_NOTIFY_MIN_SEVERITY)
.await?
.map(|s| Severity::parse(&s))
.unwrap_or(DEFAULT_NOTIFY_MIN_SEVERITY))
}
pub async fn set_notify_min_severity(&self, severity: Severity) -> Result<(), DomainError> {
self.set(KEY_NOTIFY_MIN_SEVERITY, severity.as_str()).await
}
}
fn schedule_key(kind: JobKind) -> String {
format!("schedule.{}", kind.as_str())
}