WP-02: contracts and failing tests for settings, mail, jobs and scheduler
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:08:23 +02:00
parent 12269051c4
commit 6113af0a19
21 changed files with 1115 additions and 0 deletions

View File

@ -0,0 +1,58 @@
use std::sync::Arc;
use domain::jobs::JobKind;
use domain::ports::{Cipher, Mailer, SettingsRepository};
use domain::settings::SmtpSettings;
use domain::DomainError;
pub struct SettingsService {
repo: Arc<dyn SettingsRepository>,
cipher: Arc<dyn Cipher>,
mailer: Arc<dyn Mailer>,
}
impl SettingsService {
pub fn new(
repo: Arc<dyn SettingsRepository>,
cipher: Arc<dyn Cipher>,
mailer: Arc<dyn Mailer>,
) -> Self {
let _ = (&repo, &cipher, &mailer);
Self {
repo,
cipher,
mailer,
}
}
pub async fn smtp(&self) -> Result<Option<SmtpSettings>, DomainError> {
todo!()
}
pub async fn set_smtp(&self, _smtp: SmtpSettings) -> Result<(), DomainError> {
todo!()
}
/// Send a mail to the configured recipients (or `to` if given) using the stored SMTP settings.
pub async fn send_mail(
&self,
_to: Option<Vec<String>>,
_subject: &str,
_body: &str,
) -> Result<(), DomainError> {
todo!()
}
/// Cron expression (6 fields, seconds first) for a scheduled job kind, or None if disabled.
pub async fn schedule(&self, _kind: JobKind) -> Result<Option<String>, DomainError> {
todo!()
}
pub async fn set_schedule(
&self,
_kind: JobKind,
_cron: Option<String>,
) -> Result<(), DomainError> {
todo!()
}
}