app: add sidecar sync commands (export, detect, import, resolve, full export/import)

This commit is contained in:
2026-05-31 05:29:03 +02:00
parent d1394ce7bb
commit 4b31a0f74b
43 changed files with 1685 additions and 6 deletions

View File

@@ -0,0 +1 @@
pub mod report_batch_progress;

View File

@@ -0,0 +1,36 @@
use std::sync::Arc;
use domain::{
entities::{Job, JobBatch},
errors::DomainError,
ports::{JobBatchRepository, JobRepository},
value_objects::SystemId,
};
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct ReportBatchProgressQuery {
pub batch_id: SystemId,
}
#[derive(Debug, Clone)]
pub struct BatchProgress {
pub batch: JobBatch,
pub jobs: Vec<Job>,
}
pub struct ReportBatchProgressHandler {
batch_repo: Arc<dyn JobBatchRepository>,
job_repo: Arc<dyn JobRepository>,
}
impl ReportBatchProgressHandler {
pub fn new(batch_repo: Arc<dyn JobBatchRepository>, job_repo: Arc<dyn JobRepository>) -> Self {
Self { batch_repo, job_repo }
}
pub async fn execute(&self, query: ReportBatchProgressQuery) -> Result<BatchProgress, DomainError> {
let batch = self.batch_repo.find_by_id(&query.batch_id).await?
.ok_or_else(|| DomainError::NotFound(format!("Batch {} not found", query.batch_id)))?;
let jobs = self.job_repo.find_by_batch(&query.batch_id).await?;
Ok(BatchProgress { batch, jobs })
}
}