pub struct JournalWorkflowService { /* private fields */ }Expand description
The manual-journal workflow service.
Implementations§
Source§impl JournalWorkflowService
impl JournalWorkflowService
pub fn new( posting_repo: Arc<dyn PostingRepository>, workflow: Arc<dyn JournalWorkflowRepository>, ) -> Self
Sourcepub fn with_budget_control_if_set(
self,
port: Option<Arc<dyn BudgetControlPort>>,
) -> Self
pub fn with_budget_control_if_set( self, port: Option<Arc<dyn BudgetControlPort>>, ) -> Self
Arm the budget-control consult on the inner posting service (consuming
builder; None leaves it unarmed). Hosts that compose a budget module
thread the port here so journal-approval posts are controlled too.
Sourcepub async fn submit(&self, journal_id: Uuid) -> Result<(), JournalWorkflowError>
pub async fn submit(&self, journal_id: Uuid) -> Result<(), JournalWorkflowError>
draft → pending_approval. Rejects if the journal is not draft.
Sourcepub async fn submit_as(
&self,
journal_id: Uuid,
submitted_by: Option<Uuid>,
) -> Result<(), JournalWorkflowError>
pub async fn submit_as( &self, journal_id: Uuid, submitted_by: Option<Uuid>, ) -> Result<(), JournalWorkflowError>
draft → pending_approval, recording who submitted it, which the self-approval rule
reads. Rejects if the journal is not draft.
Sourcepub async fn approve(
&self,
journal_id: Uuid,
approved_by: Option<Uuid>,
) -> Result<PostingResult, JournalWorkflowError>
pub async fn approve( &self, journal_id: Uuid, approved_by: Option<Uuid>, ) -> Result<PostingResult, JournalWorkflowError>
pending_approval → approved, then post the journal through PostingService (writes the
ledger, flips the journal to posted). Returns the posting result.
Sourcepub async fn reject(
&self,
journal_id: Uuid,
reason: String,
rejected_by: Option<Uuid>,
) -> Result<(), JournalWorkflowError>
pub async fn reject( &self, journal_id: Uuid, reason: String, rejected_by: Option<Uuid>, ) -> Result<(), JournalWorkflowError>
draft|pending_approval → rejected with a reason. Writes no ledger rows.
Sourcepub async fn void(
&self,
journal_id: Uuid,
voided_by: Option<Uuid>,
reason: String,
) -> Result<PostingResult, JournalWorkflowError>
pub async fn void( &self, journal_id: Uuid, voided_by: Option<Uuid>, reason: String, ) -> Result<PostingResult, JournalWorkflowError>
posted → voided: posts a reversal through PostingService, then stamps the journal voided.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for JournalWorkflowService
impl !UnwindSafe for JournalWorkflowService
impl Freeze for JournalWorkflowService
impl Send for JournalWorkflowService
impl Sync for JournalWorkflowService
impl Unpin for JournalWorkflowService
impl UnsafeUnpin for JournalWorkflowService
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more