Skip to main content

FileComment

Struct FileComment 

Source
pub struct FileComment {
    pub id: Uuid,
    pub file_id: Uuid,
    pub user_id: Uuid,
    pub parent_id: Option<Uuid>,
    pub content: String,
    pub annotation_region: Option<Value>,
    pub mentions: Vec<Uuid>,
    pub resolved: bool,
    pub resolved_by: Option<Uuid>,
    pub resolved_at: Option<DateTime<Utc>>,
    pub metadata: AuditMetadata,
    /* private fields */
}

Fields§

§id: Uuid§file_id: Uuid§user_id: Uuid§parent_id: Option<Uuid>§content: String§annotation_region: Option<Value>§mentions: Vec<Uuid>§resolved: bool§resolved_by: Option<Uuid>§resolved_at: Option<DateTime<Utc>>§metadata: AuditMetadata

Implementations§

Source§

impl FileComment

Source

pub fn is_reply(&self) -> bool

Check if this is a reply to another comment

Source

pub fn has_annotations(&self) -> bool

Check if comment has region annotations

Source

pub fn get_replies(&self) -> Vec<FileComment>

Get reply comments (aggregate pattern - replies loaded separately via repository)

Source

pub fn resolve(&mut self, by_user_id: Uuid) -> Result<(), CommentError>

Mark comment as resolved

Source

pub fn unresolve(&mut self) -> Result<(), CommentError>

Mark comment as unresolved

Source

pub fn mention_count(&self) -> i32

Count mentioned users

Source

pub fn check_invariants(&self) -> Result<(), Vec<&'static str>>

Check all business invariants

Source§

impl FileComment

Source

pub fn builder() -> FileCommentBuilder

Create a builder for FileComment

Source

pub fn new( file_id: Uuid, user_id: Uuid, content: String, mentions: Vec<Uuid>, resolved: bool, status: CommentStatus, ) -> Self

Create a new FileComment with required fields

Source

pub fn id(&self) -> &Uuid

Get the entity’s unique identifier

Source

pub fn typed_id(&self) -> FileCommentId

Get a strongly-typed ID for this entity

Source

pub fn created_at(&self) -> Option<&DateTime<Utc>>

Get when this entity was created

Source

pub fn updated_at(&self) -> Option<&DateTime<Utc>>

Get when this entity was last updated

Source

pub fn is_deleted(&self) -> bool

Check if this entity is soft deleted

Source

pub fn is_active(&self) -> bool

Check if this entity is active (not deleted)

Source

pub fn deleted_at(&self) -> Option<&DateTime<Utc>>

Get when this entity was deleted

Source

pub fn created_by(&self) -> Option<&Uuid>

Get who created this entity

Source

pub fn updated_by(&self) -> Option<&Uuid>

Get who last updated this entity

Source

pub fn deleted_by(&self) -> Option<&Uuid>

Get who deleted this entity

Source

pub fn status(&self) -> &CommentStatus

Get the current status

Source

pub fn with_parent_id(self, value: Uuid) -> Self

Set the parent_id field (chainable)

Source

pub fn with_annotation_region(self, value: Value) -> Self

Set the annotation_region field (chainable)

Source

pub fn with_resolved_by(self, value: Uuid) -> Self

Set the resolved_by field (chainable)

Source

pub fn with_resolved_at(self, value: DateTime<Utc>) -> Self

Set the resolved_at field (chainable)

Source

pub fn transition_to( &mut self, new_state: FileCommentState, ) -> Result<(), StateMachineError>

Transition to a new state via the status state machine.

Returns Err if the transition is not permitted from the current state. Use this method instead of assigning self.status directly.

Source

pub fn apply_patch(&mut self, fields: HashMap<String, Value>)

Apply partial updates from a map of field name to JSON value

Trait Implementations§

Source§

impl ApplyUpdateDto<UpdateFileCommentDto> for FileComment

Source§

impl Clone for FileComment

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl CrudRepository<FileComment> for FileCommentRepository

Hydrate ?include= relations: fetch rows from table by id list, as JSON (raw row_to_json). table comes from EntityRepoMeta::relations() (generator-emitted), never client input. Default: no expansion. The Postgres-backed generated repos override this via impl_crud_repository!.
Source§

fn create<'life0, 'async_trait>( &'life0 self, entity: FileComment, ) -> Pin<Box<dyn Future<Output = Result<FileComment, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Create a new entity
Source§

fn find_by_id<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<FileComment>, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Find entity by ID (excluding soft-deleted)
Source§

fn find_by_id_including_deleted<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<FileComment>, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Find entity by ID (including soft-deleted, for trash operations)
Source§

fn update<'life0, 'async_trait>( &'life0 self, entity: FileComment, ) -> Pin<Box<dyn Future<Output = Result<FileComment, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Update an existing entity
Source§

fn soft_delete<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Soft delete an entity
Source§

fn restore<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<FileComment>, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Restore a soft-deleted entity
Source§

fn hard_delete<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Permanently delete an entity
Source§

fn list<'life0, 'async_trait>( &'life0 self, page: u32, limit: u32, ) -> Pin<Box<dyn Future<Output = Result<(Vec<FileComment>, u64), RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List entities with pagination (excluding soft-deleted)
Source§

fn list_filtered<'life0, 'async_trait>( &'life0 self, page: u32, limit: u32, filters: HashMap<String, String>, ) -> Pin<Box<dyn Future<Output = Result<(Vec<FileComment>, u64), RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List entities with pagination and filters (excluding soft-deleted) Read more
Source§

fn list_filtered_with_info<'life0, 'async_trait>( &'life0 self, page: u32, limit: u32, filters: HashMap<String, String>, ) -> Pin<Box<dyn Future<Output = Result<(Vec<FileComment>, PaginationInfo), RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

list_filtered, carrying the pagination info (cursor positions included) so the HTTP layer can surface keyset paging. Default: the tuple form with the cursor fields absent; the generated Postgres repositories override this with the real keyset walk.
Source§

fn table_name(&self) -> Option<&str>

Group and reduce entities under the same filters as list_filtered. Read more
Source§

fn aggregate_filtered<'life0, 'life1, 'async_trait>( &'life0 self, spec: &'life1 AggregateSpec, filters: HashMap<String, String>, ) -> Pin<Box<dyn Future<Output = Result<AggregateResult, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn list_deleted<'life0, 'async_trait>( &'life0 self, page: u32, limit: u32, ) -> Pin<Box<dyn Future<Output = Result<(Vec<FileComment>, u64), RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List soft-deleted entities with pagination
Source§

fn count<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<u64, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Count all entities (excluding soft-deleted)
Source§

fn count_deleted<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<u64, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Count soft-deleted entities
Source§

fn bulk_create<'life0, 'async_trait>( &'life0 self, entities: Vec<FileComment>, ) -> Pin<Box<dyn Future<Output = Result<Vec<FileComment>, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Bulk create entities
Source§

fn empty_trash<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<u64, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Permanently delete all soft-deleted entities
Source§

fn bulk_soft_delete<'life0, 'life1, 'async_trait>( &'life0 self, ids: &'life1 [String], ) -> Pin<Box<dyn Future<Output = Result<u64, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Soft-delete many entities by id. Returns the number affected.
Source§

fn bulk_restore<'life0, 'life1, 'async_trait>( &'life0 self, ids: &'life1 [String], ) -> Pin<Box<dyn Future<Output = Result<Vec<FileComment>, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Restore many soft-deleted entities by id. Returns the restored entities.
Source§

fn bulk_hard_delete<'life0, 'life1, 'async_trait>( &'life0 self, ids: &'life1 [String], ) -> Pin<Box<dyn Future<Output = Result<u64, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Permanently delete many entities by id. Returns the number affected.
Source§

fn restore_all<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<FileComment>, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Restore every soft-deleted entity. Returns the restored entities.
Source§

fn bulk_update<'life0, 'async_trait>( &'life0 self, entities: Vec<FileComment>, ) -> Pin<Box<dyn Future<Output = Result<Vec<FileComment>, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Update many entities atomically. Returns the updated entities.
Source§

fn exists<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, RepositoryError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Check if an entity exists by ID
Source§

impl Debug for FileComment

Source§

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

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

impl<'de> Deserialize<'de> for FileComment

Source§

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

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

impl DomainPolicy<FileComment> for FileCommentDomainPolicy

Source§

fn can_create<'life0, 'life1, 'async_trait>( &'life0 self, _entity: &'life1 E, ) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Can a new entity in the given state be persisted?
Source§

fn can_update<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _current: &'life1 E, _updated: &'life2 E, ) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Can the entity transition from current to updated state?
Source§

fn can_delete<'life0, 'life1, 'async_trait>( &'life0 self, _entity: &'life1 E, ) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Can the entity be soft-deleted?
Source§

fn can_restore<'life0, 'life1, 'async_trait>( &'life0 self, _entity: &'life1 E, ) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Can a soft-deleted entity be restored?
Source§

fn enforce_create<'life0, 'life1, 'async_trait>( &'life0 self, entity: &'life1 E, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Convenience: enforce can_create and map to Ok(()) or Err(reason).
Source§

fn enforce_delete<'life0, 'life1, 'async_trait>( &'life0 self, entity: &'life1 E, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Convenience: enforce can_delete and map to Ok(()) or Err(reason).
Source§

impl Entity for FileComment

Source§

type Id = Uuid

The type of the entity’s unique identifier
Source§

fn entity_id(&self) -> &Self::Id

Get the entity’s unique identifier
Source§

fn entity_type() -> &'static str

Get the entity type name
Source§

impl EntityRepoMeta for FileComment

Source§

fn column_types() -> HashMap<String, String>

PostgreSQL type hints for filter/sort (e.g. {"id": "uuid"}).
Source§

fn search_fields() -> &'static [&'static str]

Text columns to include in full-text / ILIKE search.
Source§

fn private_fields() -> &'static [&'static str]

Response fields visible only to the row owner and platform/root callers (@private). Stripped for everyone else.
Source§

fn secret_fields() -> &'static [&'static str]

Response fields (camelCase) that never leave the server (@sensitive): no caller is served them, a platform caller or the row’s owner included.
Source§

fn relation_secret_fields(_relation: &str) -> &'static [&'static str]

The @sensitive fields (camelCase response keys) of the model a to-one relation points at, stripped from the related row an ?include= expands. Keyed by the relation name of relations. Default: none.
Source§

fn owner_field() -> Option<&'static str>

The response field (camelCase) holding the owner/company id (@owner), compared against the caller’s access scope to decide private-field visibility. None = the entity has no owner concept.
Source§

fn company_field() -> Option<&'static str>

The DB column that scopes rows to a company (snake_case, e.g. company_id). None = the entity is global (reference data) and is not fenced. Read more
Source§

fn relations() -> &'static [(&'static str, &'static str, &'static str)]

To-one relations expandable via ?include=<name>, as (relation_name, target_table, local_fk_field) — all response keys (relation_name/local_fk in camelCase; target_table is the DB table). Default: none.
Source§

impl From<&FileComment> for FileCommentResponseDto

Source§

fn from(entity: &FileComment) -> Self

Converts to this type from the input type.
Source§

impl From<CreateFileCommentDto> for FileComment

Source§

fn from(dto: CreateFileCommentDto) -> Self

Converts to this type from the input type.
Source§

impl From<FileComment> for FileCommentResponseDto

Source§

fn from(entity: FileComment) -> Self

Converts to this type from the input type.
Source§

impl From<FileComment> for FileCommentSummaryDto

Source§

fn from(entity: FileComment) -> Self

Converts to this type from the input type.
Source§

impl FromCreateDto<CreateFileCommentDto> for FileComment

Source§

impl<'a, R: Row> FromRow<'a, R> for FileComment

Source§

fn from_row(__row: &'a R) -> Result<Self>

Source§

impl HasComputedFields for FileComment

Computed fields for FileComment entity

Source§

fn computed_fields(&self) -> ComputedFieldValues

Get all computed field values
Source§

fn computed_field(&self, name: &str) -> Option<Value>

Get a specific computed field value
Source§

impl PersistentEntity for FileComment

Source§

fn entity_id(&self) -> String

Get the entity’s unique identifier
Source§

fn set_entity_id(&mut self, id: String)

Set the entity’s unique identifier
Source§

fn created_at(&self) -> Option<DateTime<Utc>>

Get creation timestamp
Source§

fn set_created_at(&mut self, ts: DateTime<Utc>)

Set creation timestamp
Source§

fn updated_at(&self) -> Option<DateTime<Utc>>

Get last update timestamp
Source§

fn set_updated_at(&mut self, ts: DateTime<Utc>)

Set last update timestamp
Source§

fn deleted_at(&self) -> Option<DateTime<Utc>>

Get soft delete timestamp (None if not deleted)
Source§

fn set_deleted_at(&mut self, ts: Option<DateTime<Utc>>)

Set soft delete timestamp
Source§

fn is_deleted(&self) -> bool

Check if entity is soft-deleted
Source§

fn mark_deleted(&mut self)

Mark entity as deleted (soft delete)
Source§

fn restore(&mut self)

Restore a soft-deleted entity
Source§

fn touch(&mut self)

Touch the entity (update timestamp)
Source§

fn generate_id() -> String

Generate a new ID for this entity type
Source§

fn write_protected_fields() -> &'static [&'static str]

Fields that a generic write (PUT, PATCH and their bulk forms) may not change, by their serialized name. Read more
Source§

impl Serialize for FileComment

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl WriteGuard<FileComment> for FileCommentRowRules

Source§

fn check<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ctx: &'life1 WriteCtx<'life2, FileComment>, ) -> Pin<Box<dyn Future<Output = GuardOutcome> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
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> IntoEither for T

Source§

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

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = !

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

fn try_from(value: U) -> Result<T, !>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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