Skip to main content

Sketch

Struct Sketch 

Source
pub struct Sketch {
Show 20 fields pub id: Uuid, pub number: u64, pub title: String, pub sketch_type: SketchType, pub status: SketchStatus, pub domain: Option<String>, pub domain_id: Option<Uuid>, pub workspace_id: Option<Uuid>, pub description: Option<String>, pub excalidraw_data: String, pub thumbnail_path: Option<String>, pub authors: Vec<String>, pub linked_assets: Vec<AssetLink>, pub linked_decisions: Vec<Uuid>, pub linked_knowledge: Vec<Uuid>, pub related_sketches: Vec<Uuid>, pub tags: Vec<Tag>, pub notes: Option<String>, pub created_at: DateTime<Utc>, pub updated_at: DateTime<Utc>,
}
Expand description

Excalidraw Sketch

Represents an Excalidraw sketch that can be categorized by domain, type, and linked to other assets.

Fields§

§id: Uuid

Unique identifier for the sketch

§number: u64

Sketch number - can be sequential (1, 2, 3) or timestamp-based (YYMMDDHHmm format) Timestamp format prevents merge conflicts in distributed Git workflows

§title: String

Sketch title

§sketch_type: SketchType

Type of sketch

§status: SketchStatus

Publication status

§domain: Option<String>

Domain this sketch belongs to (optional, string name)

§domain_id: Option<Uuid>

Domain UUID reference (optional)

§workspace_id: Option<Uuid>

Workspace UUID reference (optional)

§description: Option<String>

Brief description of the sketch

§excalidraw_data: String

Excalidraw scene data as JSON string

§thumbnail_path: Option<String>

Optional path to PNG thumbnail (relative path, e.g., “thumbnails/sketch-0001.png”)

§authors: Vec<String>

Sketch authors (emails or names)

§linked_assets: Vec<AssetLink>

Assets referenced by this sketch

§linked_decisions: Vec<Uuid>

UUIDs of related decisions

§linked_knowledge: Vec<Uuid>

UUIDs of related knowledge articles

§related_sketches: Vec<Uuid>

UUIDs of related sketches

§tags: Vec<Tag>

Tags for categorization

§notes: Option<String>

Additional notes

§created_at: DateTime<Utc>

Creation timestamp

§updated_at: DateTime<Utc>

Last modification timestamp

Implementations§

Source§

impl Sketch

Source

pub fn new( number: u64, title: impl Into<String>, excalidraw_data: impl Into<String>, ) -> Sketch

Create a new sketch with required fields

Source

pub fn new_with_timestamp( title: impl Into<String>, excalidraw_data: impl Into<String>, ) -> Sketch

Create a new sketch with a timestamp-based number (YYMMDDHHmm format) This format prevents merge conflicts in distributed Git workflows

Source

pub fn generate_timestamp_number(dt: &DateTime<Utc>) -> u64

Generate a timestamp-based sketch number in YYMMDDHHmm format

Source

pub fn generate_id(number: u64) -> Uuid

Generate a deterministic UUID for a sketch based on its number

Source

pub fn is_timestamp_number(&self) -> bool

Check if the sketch number is timestamp-based (YYMMDDHHmm format - 10 digits)

Source

pub fn formatted_number(&self) -> String

Format the sketch number for display Returns “SKETCH-0001” for sequential or “SKETCH-2601101234” for timestamp-based

Source

pub fn filename(&self, workspace_name: &str) -> String

Generate the YAML filename for this sketch

Source

pub fn thumbnail_filename(&self) -> String

Generate the thumbnail filename for this sketch

Source

pub fn with_type(self, sketch_type: SketchType) -> Sketch

Set the sketch type

Source

pub fn with_status(self, status: SketchStatus) -> Sketch

Set the sketch status

Source

pub fn with_domain(self, domain: impl Into<String>) -> Sketch

Set the domain

Source

pub fn with_domain_id(self, domain_id: Uuid) -> Sketch

Set the domain ID

Source

pub fn with_workspace_id(self, workspace_id: Uuid) -> Sketch

Set the workspace ID

Source

pub fn with_description(self, description: impl Into<String>) -> Sketch

Set the description

Source

pub fn with_thumbnail(self, thumbnail_path: impl Into<String>) -> Sketch

Set the thumbnail path

Source

pub fn add_author(self, author: impl Into<String>) -> Sketch

Add an author

Add an asset link

Link to a decision

Link to a knowledge article

Add a related sketch

Source

pub fn add_tag(self, tag: Tag) -> Sketch

Add a tag

Source

pub fn with_notes(self, notes: impl Into<String>) -> Sketch

Set notes

Source

pub fn from_yaml(yaml_content: &str) -> Result<Sketch, Error>

Import from YAML

Source

pub fn to_yaml(&self) -> Result<String, Error>

Export to YAML

Trait Implementations§

Source§

impl Clone for Sketch

Source§

fn clone(&self) -> Sketch

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Sketch

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Sketch

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<Sketch, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<&Sketch> for SketchIndexEntry

Source§

fn from(sketch: &Sketch) -> SketchIndexEntry

Converts to this type from the input type.
Source§

impl PartialEq for Sketch

Source§

fn eq(&self, other: &Sketch) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Sketch

Source§

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
Source§

impl StructuralPartialEq for Sketch

Auto Trait Implementations§

§

impl Freeze for Sketch

§

impl RefUnwindSafe for Sketch

§

impl Send for Sketch

§

impl Sync for Sketch

§

impl Unpin for Sketch

§

impl UnwindSafe for Sketch

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,