pub struct TechnicalSpec {Show 14 fields
pub id: Uuid,
pub acp_id: Uuid,
pub building_id: Option<Uuid>,
pub title: String,
pub description: String,
pub version: SemVer,
pub status: TechnicalSpecStatus,
pub deliverables: Vec<String>,
pub required_signatures: Vec<SignatoryRole>,
pub attachments: Vec<String>,
pub previous_version_id: Option<Uuid>,
pub created_by: Uuid,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}Fields§
§id: Uuid§acp_id: Uuid§building_id: Option<Uuid>§title: String§description: String§version: SemVer§status: TechnicalSpecStatus§deliverables: Vec<String>§required_signatures: Vec<SignatoryRole>§attachments: Vec<String>§previous_version_id: Option<Uuid>§created_by: Uuid§created_at: DateTime<Utc>§updated_at: DateTime<Utc>Implementations§
Source§impl TechnicalSpec
impl TechnicalSpec
Sourcepub fn new(
acp_id: Uuid,
building_id: Option<Uuid>,
title: String,
description: String,
version: SemVer,
deliverables: Vec<String>,
required_signatures: Vec<SignatoryRole>,
attachments: Vec<String>,
previous_version_id: Option<Uuid>,
created_by: Uuid,
) -> Result<Self, AppError>
pub fn new( acp_id: Uuid, building_id: Option<Uuid>, title: String, description: String, version: SemVer, deliverables: Vec<String>, required_signatures: Vec<SignatoryRole>, attachments: Vec<String>, previous_version_id: Option<Uuid>, created_by: Uuid, ) -> Result<Self, AppError>
Build a new TechnicalSpec in Draft status.
Invariants (cf. module-level docs): title 5..=200 chars, description 50..=10_000 chars, deliverables non-empty (each non-empty) <= 50, required_signatures non-empty <= 10, attachments <= 20.
Sourcepub fn bump(
&self,
new_version: SemVer,
new_title: Option<String>,
new_description: Option<String>,
new_deliverables: Option<Vec<String>>,
new_required_signatures: Option<Vec<SignatoryRole>>,
new_attachments: Option<Vec<String>>,
) -> Result<Self, AppError>
pub fn bump( &self, new_version: SemVer, new_title: Option<String>, new_description: Option<String>, new_deliverables: Option<Vec<String>>, new_required_signatures: Option<Vec<SignatoryRole>>, new_attachments: Option<Vec<String>>, ) -> Result<Self, AppError>
Build the next version of this spec — keeps the same ACP / building /
(optionally overridden) deliverables / signatures, increments the
version and chains via previous_version_id. The result is always a
fresh TechnicalSpecStatus::Draft.
Errors:
AppError::Validationif the new version is not strictly greater than the current one.
Sourcepub fn is_strictly_greater(new: &SemVer, old: &SemVer) -> bool
pub fn is_strictly_greater(new: &SemVer, old: &SemVer) -> bool
True iff new is strictly greater than old (lexicographic on the
SemVer triple).
Sourcepub fn requires_resignature(&self, new: &SemVer) -> bool
pub fn requires_resignature(&self, new: &SemVer) -> bool
True iff bumping from self.version to new requires every
previously collected signature to be re-collected. Currently any
major increment triggers this — minor / patch do not.
Sourcepub fn submit_for_signatures(&mut self) -> Result<(), AppError>
pub fn submit_for_signatures(&mut self) -> Result<(), AppError>
Transition Draft -> PendingSignatures. Idempotent on PendingSignatures.
Sourcepub fn mark_approved(&mut self)
pub fn mark_approved(&mut self)
Promote to Approved once every required signature has been collected.
Caller is responsible for verifying the signature set actually covers
required_signatures.
Sourcepub fn has_all_required_signatures(
&self,
collected_roles: &[SignatoryRole],
) -> bool
pub fn has_all_required_signatures( &self, collected_roles: &[SignatoryRole], ) -> bool
Whether all required signatures are present in collected_roles.
Trait Implementations§
Source§impl Clone for TechnicalSpec
impl Clone for TechnicalSpec
Source§fn clone(&self) -> TechnicalSpec
fn clone(&self) -> TechnicalSpec
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TechnicalSpec
impl Debug for TechnicalSpec
Source§impl<'de> Deserialize<'de> for TechnicalSpec
impl<'de> Deserialize<'de> for TechnicalSpec
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>,
impl Eq for TechnicalSpec
Source§impl From<TechnicalSpec> for TechnicalSpecDto
impl From<TechnicalSpec> for TechnicalSpecDto
Source§fn from(s: TechnicalSpec) -> Self
fn from(s: TechnicalSpec) -> Self
Source§impl PartialEq for TechnicalSpec
impl PartialEq for TechnicalSpec
Source§fn eq(&self, other: &TechnicalSpec) -> bool
fn eq(&self, other: &TechnicalSpec) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for TechnicalSpec
impl Serialize for TechnicalSpec
impl StructuralPartialEq for TechnicalSpec
Auto Trait Implementations§
impl Freeze for TechnicalSpec
impl RefUnwindSafe for TechnicalSpec
impl Send for TechnicalSpec
impl Sync for TechnicalSpec
impl Unpin for TechnicalSpec
impl UnsafeUnpin for TechnicalSpec
impl UnwindSafe for TechnicalSpec
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
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Fake for T
impl<T> Fake for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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