pub struct ApprovalWorkflow {
pub status: ApprovalStatus,
pub actions: Vec<ApprovalAction>,
pub required_levels: u8,
pub current_level: u8,
pub preparer_id: String,
pub preparer_name: String,
pub submitted_at: Option<DateTime<Utc>>,
pub approved_at: Option<DateTime<Utc>>,
pub amount: Decimal,
}Expand description
Complete approval workflow for a journal entry.
Fields§
§status: ApprovalStatusCurrent status of the workflow
actions: Vec<ApprovalAction>All actions taken in this workflow
required_levels: u8Number of approval levels required
current_level: u8Current approval level achieved
preparer_id: StringUser ID of the preparer
preparer_name: StringDisplay name of the preparer
submitted_at: Option<DateTime<Utc>>When the entry was submitted for approval
approved_at: Option<DateTime<Utc>>When the entry was finally approved
amount: DecimalTransaction amount (for threshold calculation)
Implementations§
Source§impl ApprovalWorkflow
impl ApprovalWorkflow
Sourcepub fn new(preparer_id: String, preparer_name: String, amount: Decimal) -> Self
pub fn new(preparer_id: String, preparer_name: String, amount: Decimal) -> Self
Create a new draft workflow.
Sourcepub fn auto_approved(
preparer_id: String,
preparer_name: String,
amount: Decimal,
timestamp: DateTime<Utc>,
) -> Self
pub fn auto_approved( preparer_id: String, preparer_name: String, amount: Decimal, timestamp: DateTime<Utc>, ) -> Self
Create an auto-approved workflow.
Sourcepub fn approve(
&mut self,
approver_id: String,
approver_name: String,
approver_role: UserPersona,
timestamp: DateTime<Utc>,
comment: Option<String>,
)
pub fn approve( &mut self, approver_id: String, approver_name: String, approver_role: UserPersona, timestamp: DateTime<Utc>, comment: Option<String>, )
Add an approval action.
Sourcepub fn reject(
&mut self,
rejector_id: String,
rejector_name: String,
rejector_role: UserPersona,
timestamp: DateTime<Utc>,
reason: &str,
)
pub fn reject( &mut self, rejector_id: String, rejector_name: String, rejector_role: UserPersona, timestamp: DateTime<Utc>, reason: &str, )
Reject the workflow.
Sourcepub fn request_revision(
&mut self,
reviewer_id: String,
reviewer_name: String,
reviewer_role: UserPersona,
timestamp: DateTime<Utc>,
reason: &str,
)
pub fn request_revision( &mut self, reviewer_id: String, reviewer_name: String, reviewer_role: UserPersona, timestamp: DateTime<Utc>, reason: &str, )
Request revision.
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Check if workflow is complete.
Sourcepub fn final_approver(&self) -> Option<&ApprovalAction>
pub fn final_approver(&self) -> Option<&ApprovalAction>
Get the final approver (if approved).
Trait Implementations§
Source§impl Clone for ApprovalWorkflow
impl Clone for ApprovalWorkflow
Source§fn clone(&self) -> ApprovalWorkflow
fn clone(&self) -> ApprovalWorkflow
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ApprovalWorkflow
impl Debug for ApprovalWorkflow
Source§impl<'de> Deserialize<'de> for ApprovalWorkflow
impl<'de> Deserialize<'de> for ApprovalWorkflow
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ApprovalWorkflow
impl RefUnwindSafe for ApprovalWorkflow
impl Send for ApprovalWorkflow
impl Sync for ApprovalWorkflow
impl Unpin for ApprovalWorkflow
impl UnwindSafe for ApprovalWorkflow
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