pub struct OrgTemplate {
pub id: Uuid,
pub org_id: Uuid,
pub name: String,
pub description: Option<String>,
pub blueprint_config: Value,
pub security_baseline: Value,
pub created_by: Uuid,
pub is_default: bool,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}Expand description
Organization template model
Fields§
§id: UuidUnique identifier
org_id: UuidOrganization ID this template belongs to
name: StringTemplate name
description: Option<String>Template description
blueprint_config: ValueBlueprint configuration (personas, reality defaults, flows, etc.)
security_baseline: ValueSecurity baseline configuration (RBAC defaults, validation modes, etc.)
created_by: UuidUser who created this template
is_default: boolWhether this is the default template for the org
created_at: DateTime<Utc>Creation timestamp
updated_at: DateTime<Utc>Last update timestamp
Implementations§
Source§impl OrgTemplate
impl OrgTemplate
Sourcepub async fn create(
pool: &Pool<Postgres>,
org_id: Uuid,
name: &str,
description: Option<&str>,
blueprint_config: Option<Value>,
security_baseline: Option<Value>,
created_by: Uuid,
is_default: bool,
) -> Result<OrgTemplate, Error>
pub async fn create( pool: &Pool<Postgres>, org_id: Uuid, name: &str, description: Option<&str>, blueprint_config: Option<Value>, security_baseline: Option<Value>, created_by: Uuid, is_default: bool, ) -> Result<OrgTemplate, Error>
Create a new organization template
Sourcepub async fn find_by_id(
pool: &Pool<Postgres>,
id: Uuid,
) -> Result<Option<OrgTemplate>, Error>
pub async fn find_by_id( pool: &Pool<Postgres>, id: Uuid, ) -> Result<Option<OrgTemplate>, Error>
Find by ID
Sourcepub async fn list_by_org(
pool: &Pool<Postgres>,
org_id: Uuid,
) -> Result<Vec<OrgTemplate>, Error>
pub async fn list_by_org( pool: &Pool<Postgres>, org_id: Uuid, ) -> Result<Vec<OrgTemplate>, Error>
List all templates for an organization
Sourcepub async fn get_default(
pool: &Pool<Postgres>,
org_id: Uuid,
) -> Result<Option<OrgTemplate>, Error>
pub async fn get_default( pool: &Pool<Postgres>, org_id: Uuid, ) -> Result<Option<OrgTemplate>, Error>
Get the default template for an organization
Sourcepub async fn update(
&self,
pool: &Pool<Postgres>,
name: Option<&str>,
description: Option<&str>,
blueprint_config: Option<Value>,
security_baseline: Option<Value>,
is_default: Option<bool>,
) -> Result<OrgTemplate, Error>
pub async fn update( &self, pool: &Pool<Postgres>, name: Option<&str>, description: Option<&str>, blueprint_config: Option<Value>, security_baseline: Option<Value>, is_default: Option<bool>, ) -> Result<OrgTemplate, Error>
Update template
Sourcepub async fn set_as_default(
pool: &Pool<Postgres>,
id: Uuid,
org_id: Uuid,
) -> Result<OrgTemplate, Error>
pub async fn set_as_default( pool: &Pool<Postgres>, id: Uuid, org_id: Uuid, ) -> Result<OrgTemplate, Error>
Set as default template for the organization
Trait Implementations§
Source§impl Clone for OrgTemplate
impl Clone for OrgTemplate
Source§fn clone(&self) -> OrgTemplate
fn clone(&self) -> OrgTemplate
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 OrgTemplate
impl Debug for OrgTemplate
Source§impl<'de> Deserialize<'de> for OrgTemplate
impl<'de> Deserialize<'de> for OrgTemplate
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<OrgTemplate, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<OrgTemplate, <__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 OrgTemplatewhere
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<String>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Value: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
bool: 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 OrgTemplatewhere
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<String>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Value: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
bool: 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 OrgTemplate
impl Serialize for OrgTemplate
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 OrgTemplate
impl RefUnwindSafe for OrgTemplate
impl Send for OrgTemplate
impl Sync for OrgTemplate
impl Unpin for OrgTemplate
impl UnsafeUnpin for OrgTemplate
impl UnwindSafe for OrgTemplate
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.