use super::version::Version;
use async_trait::async_trait;
use serde::{Deserialize, Serialize};
pub mod manager;
#[async_trait]
pub trait Manager {
async fn find_all_document_versions_by_mpath_and_publication(
&self,
mpath: &str,
publication: &str,
) -> anyhow::Result<Vec<Version>>;
}
#[async_trait]
pub trait TxManager {
async fn insert_bulk(&mut self, document_changes: Vec<DocumentChange>) -> anyhow::Result<()>;
}
#[derive(sqlx::FromRow, Deserialize, Serialize)]
pub struct DocumentChange {
pub id: String,
pub status: i64,
pub change_reason: Option<String>,
pub publication_version_id: String,
pub doc_mpath: String,
}
impl DocumentChange {
#[must_use]
pub const fn new(
id: String,
status: i64,
change_reason: Option<String>,
publication_version_id: String,
doc_mpath: String,
) -> Self {
Self {
id,
status,
change_reason,
publication_version_id,
doc_mpath,
}
}
}