pub struct ScenarioPromotion {Show 16 fields
pub id: Uuid,
pub scenario_id: Uuid,
pub scenario_version: String,
pub workspace_id: Uuid,
pub from_environment: String,
pub to_environment: String,
pub promoted_by: Uuid,
pub approved_by: Option<Uuid>,
pub status: String,
pub requires_approval: bool,
pub approval_required_reason: Option<String>,
pub comments: Option<String>,
pub approval_comments: Option<String>,
pub completed_at: Option<DateTime<Utc>>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}Expand description
Scenario promotion model
Fields§
§id: UuidUnique identifier
scenario_id: UuidScenario ID being promoted
scenario_version: StringScenario version being promoted
workspace_id: UuidWorkspace ID where promotion occurs
from_environment: StringSource environment (dev or test)
to_environment: StringTarget environment (test or prod)
promoted_by: UuidUser who initiated the promotion
approved_by: Option<Uuid>User who approved the promotion (nullable)
status: StringPromotion status
requires_approval: boolWhether this promotion requires approval
approval_required_reason: Option<String>Reason why approval is required
comments: Option<String>Comments from promoter
approval_comments: Option<String>Comments from approver
completed_at: Option<DateTime<Utc>>When promotion was completed
created_at: DateTime<Utc>Creation timestamp
updated_at: DateTime<Utc>Last update timestamp
Implementations§
Source§impl ScenarioPromotion
impl ScenarioPromotion
Sourcepub fn status_enum(&self) -> Option<PromotionStatus>
pub fn status_enum(&self) -> Option<PromotionStatus>
Get status as enum
Sourcepub async fn create(
pool: &Pool<Postgres>,
scenario_id: Uuid,
scenario_version: &str,
workspace_id: Uuid,
from_environment: &str,
to_environment: &str,
promoted_by: Uuid,
requires_approval: bool,
approval_required_reason: Option<&str>,
comments: Option<&str>,
) -> Result<ScenarioPromotion, Error>
pub async fn create( pool: &Pool<Postgres>, scenario_id: Uuid, scenario_version: &str, workspace_id: Uuid, from_environment: &str, to_environment: &str, promoted_by: Uuid, requires_approval: bool, approval_required_reason: Option<&str>, comments: Option<&str>, ) -> Result<ScenarioPromotion, Error>
Create a new promotion request
Sourcepub async fn find_by_id(
pool: &Pool<Postgres>,
id: Uuid,
) -> Result<Option<ScenarioPromotion>, Error>
pub async fn find_by_id( pool: &Pool<Postgres>, id: Uuid, ) -> Result<Option<ScenarioPromotion>, Error>
Find by ID
Sourcepub async fn list_by_workspace(
pool: &Pool<Postgres>,
workspace_id: Uuid,
status: Option<PromotionStatus>,
) -> Result<Vec<ScenarioPromotion>, Error>
pub async fn list_by_workspace( pool: &Pool<Postgres>, workspace_id: Uuid, status: Option<PromotionStatus>, ) -> Result<Vec<ScenarioPromotion>, Error>
List promotions for a workspace
Sourcepub async fn list_by_scenario(
pool: &Pool<Postgres>,
scenario_id: Uuid,
) -> Result<Vec<ScenarioPromotion>, Error>
pub async fn list_by_scenario( pool: &Pool<Postgres>, scenario_id: Uuid, ) -> Result<Vec<ScenarioPromotion>, Error>
List promotions for a scenario
Sourcepub async fn approve(
&self,
pool: &Pool<Postgres>,
approved_by: Uuid,
approval_comments: Option<&str>,
) -> Result<ScenarioPromotion, Error>
pub async fn approve( &self, pool: &Pool<Postgres>, approved_by: Uuid, approval_comments: Option<&str>, ) -> Result<ScenarioPromotion, Error>
Approve a promotion
Sourcepub async fn reject(
&self,
pool: &Pool<Postgres>,
rejected_by: Uuid,
rejection_reason: &str,
) -> Result<ScenarioPromotion, Error>
pub async fn reject( &self, pool: &Pool<Postgres>, rejected_by: Uuid, rejection_reason: &str, ) -> Result<ScenarioPromotion, Error>
Reject a promotion
Sourcepub async fn mark_completed(
pool: &Pool<Postgres>,
id: Uuid,
) -> Result<ScenarioPromotion, Error>
pub async fn mark_completed( pool: &Pool<Postgres>, id: Uuid, ) -> Result<ScenarioPromotion, Error>
Mark promotion as completed
Sourcepub async fn mark_failed(
pool: &Pool<Postgres>,
id: Uuid,
error_message: &str,
) -> Result<ScenarioPromotion, Error>
pub async fn mark_failed( pool: &Pool<Postgres>, id: Uuid, error_message: &str, ) -> Result<ScenarioPromotion, Error>
Mark promotion as failed
Trait Implementations§
Source§impl Clone for ScenarioPromotion
impl Clone for ScenarioPromotion
Source§fn clone(&self) -> ScenarioPromotion
fn clone(&self) -> ScenarioPromotion
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 ScenarioPromotion
impl Debug for ScenarioPromotion
Source§impl<'de> Deserialize<'de> for ScenarioPromotion
impl<'de> Deserialize<'de> for ScenarioPromotion
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ScenarioPromotion, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ScenarioPromotion, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<'a, R> FromRow<'a, R> for ScenarioPromotionwhere
R: Row,
&'a str: ColumnIndex<R>,
Uuid: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
String: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Option<Uuid>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
bool: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Option<String>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Option<DateTime<Utc>>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
DateTime<Utc>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
impl<'a, R> FromRow<'a, R> for ScenarioPromotionwhere
R: Row,
&'a str: ColumnIndex<R>,
Uuid: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
String: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Option<Uuid>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
bool: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Option<String>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Option<DateTime<Utc>>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
DateTime<Utc>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Source§impl Serialize for ScenarioPromotion
impl Serialize for ScenarioPromotion
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for ScenarioPromotion
impl RefUnwindSafe for ScenarioPromotion
impl Send for ScenarioPromotion
impl Sync for ScenarioPromotion
impl Unpin for ScenarioPromotion
impl UnsafeUnpin for ScenarioPromotion
impl UnwindSafe for ScenarioPromotion
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
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 moreCreates a shared type from an unshared type.