text-document-direct-access 1.5.2

Entity CRUD controllers and DTOs for text-document
Documentation
// Generated by Qleany v1.5.0 from entity_dtos.tera

pub use common::entities::Alignment;
use common::entities::Block;
pub use common::entities::CharVerticalAlignment;
pub use common::entities::MarkerType;
pub use common::entities::TextDirection;
pub use common::entities::UnderlineStyle;
pub use common::format_runs::InlineContent;
use common::types::EntityId;
use serde::{Deserialize, Serialize};
use std::convert::From;

#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
pub struct BlockDto {
    pub id: EntityId,
    pub created_at: chrono::DateTime<chrono::Utc>,
    pub updated_at: chrono::DateTime<chrono::Utc>,
    pub list: Option<EntityId>,
    pub document_position: i64,
    pub fmt_alignment: Option<Alignment>,
    pub fmt_top_margin: Option<i64>,
    pub fmt_bottom_margin: Option<i64>,
    pub fmt_left_margin: Option<i64>,
    pub fmt_right_margin: Option<i64>,
    pub fmt_heading_level: Option<i64>,
    pub fmt_indent: Option<i64>,
    pub fmt_text_indent: Option<i64>,
    pub fmt_marker: Option<MarkerType>,
    pub fmt_tab_positions: Vec<i64>,
    pub fmt_line_height: Option<i64>,
    pub fmt_non_breakable_lines: Option<bool>,
    pub fmt_direction: Option<TextDirection>,
    pub fmt_background_color: Option<String>,
    pub fmt_is_code_block: Option<bool>,
    pub fmt_code_language: Option<String>,
}

impl From<BlockDto> for Block {
    fn from(dto: BlockDto) -> Self {
        Block {
            id: dto.id,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
            list: dto.list,
            document_position: dto.document_position,
            fmt_alignment: dto.fmt_alignment,
            fmt_top_margin: dto.fmt_top_margin,
            fmt_bottom_margin: dto.fmt_bottom_margin,
            fmt_left_margin: dto.fmt_left_margin,
            fmt_right_margin: dto.fmt_right_margin,
            fmt_heading_level: dto.fmt_heading_level,
            fmt_indent: dto.fmt_indent,
            fmt_text_indent: dto.fmt_text_indent,
            fmt_marker: dto.fmt_marker,
            fmt_tab_positions: dto.fmt_tab_positions,
            fmt_line_height: dto.fmt_line_height,
            fmt_non_breakable_lines: dto.fmt_non_breakable_lines,
            fmt_direction: dto.fmt_direction,
            fmt_background_color: dto.fmt_background_color,
            fmt_is_code_block: dto.fmt_is_code_block,
            fmt_code_language: dto.fmt_code_language,
        }
    }
}

impl From<&BlockDto> for Block {
    fn from(dto: &BlockDto) -> Self {
        Block {
            id: dto.id,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
            list: dto.list,
            document_position: dto.document_position,
            fmt_alignment: dto.fmt_alignment.clone(),
            fmt_top_margin: dto.fmt_top_margin,
            fmt_bottom_margin: dto.fmt_bottom_margin,
            fmt_left_margin: dto.fmt_left_margin,
            fmt_right_margin: dto.fmt_right_margin,
            fmt_heading_level: dto.fmt_heading_level,
            fmt_indent: dto.fmt_indent,
            fmt_text_indent: dto.fmt_text_indent,
            fmt_marker: dto.fmt_marker.clone(),
            fmt_tab_positions: dto.fmt_tab_positions.clone(),
            fmt_line_height: dto.fmt_line_height,
            fmt_non_breakable_lines: dto.fmt_non_breakable_lines,
            fmt_direction: dto.fmt_direction.clone(),
            fmt_background_color: dto.fmt_background_color.clone(),
            fmt_is_code_block: dto.fmt_is_code_block,
            fmt_code_language: dto.fmt_code_language.clone(),
        }
    }
}

impl From<Block> for BlockDto {
    fn from(entity: Block) -> Self {
        BlockDto {
            id: entity.id,
            created_at: entity.created_at,
            updated_at: entity.updated_at,
            list: entity.list,
            document_position: entity.document_position,
            fmt_alignment: entity.fmt_alignment,
            fmt_top_margin: entity.fmt_top_margin,
            fmt_bottom_margin: entity.fmt_bottom_margin,
            fmt_left_margin: entity.fmt_left_margin,
            fmt_right_margin: entity.fmt_right_margin,
            fmt_heading_level: entity.fmt_heading_level,
            fmt_indent: entity.fmt_indent,
            fmt_text_indent: entity.fmt_text_indent,
            fmt_marker: entity.fmt_marker,
            fmt_tab_positions: entity.fmt_tab_positions,
            fmt_line_height: entity.fmt_line_height,
            fmt_non_breakable_lines: entity.fmt_non_breakable_lines,
            fmt_direction: entity.fmt_direction,
            fmt_background_color: entity.fmt_background_color,
            fmt_is_code_block: entity.fmt_is_code_block,
            fmt_code_language: entity.fmt_code_language,
        }
    }
}

#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
pub struct CreateBlockDto {
    pub created_at: chrono::DateTime<chrono::Utc>,
    pub updated_at: chrono::DateTime<chrono::Utc>,
    pub list: Option<EntityId>,
    pub document_position: i64,
    pub fmt_alignment: Option<Alignment>,
    pub fmt_top_margin: Option<i64>,
    pub fmt_bottom_margin: Option<i64>,
    pub fmt_left_margin: Option<i64>,
    pub fmt_right_margin: Option<i64>,
    pub fmt_heading_level: Option<i64>,
    pub fmt_indent: Option<i64>,
    pub fmt_text_indent: Option<i64>,
    pub fmt_marker: Option<MarkerType>,
    pub fmt_tab_positions: Vec<i64>,
    pub fmt_line_height: Option<i64>,
    pub fmt_non_breakable_lines: Option<bool>,
    pub fmt_direction: Option<TextDirection>,
    pub fmt_background_color: Option<String>,
    pub fmt_is_code_block: Option<bool>,
    pub fmt_code_language: Option<String>,
}

impl From<CreateBlockDto> for Block {
    fn from(dto: CreateBlockDto) -> Self {
        Block {
            id: 0,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
            list: dto.list,
            document_position: dto.document_position,
            fmt_alignment: dto.fmt_alignment,
            fmt_top_margin: dto.fmt_top_margin,
            fmt_bottom_margin: dto.fmt_bottom_margin,
            fmt_left_margin: dto.fmt_left_margin,
            fmt_right_margin: dto.fmt_right_margin,
            fmt_heading_level: dto.fmt_heading_level,
            fmt_indent: dto.fmt_indent,
            fmt_text_indent: dto.fmt_text_indent,
            fmt_marker: dto.fmt_marker,
            fmt_tab_positions: dto.fmt_tab_positions,
            fmt_line_height: dto.fmt_line_height,
            fmt_non_breakable_lines: dto.fmt_non_breakable_lines,
            fmt_direction: dto.fmt_direction,
            fmt_background_color: dto.fmt_background_color,
            fmt_is_code_block: dto.fmt_is_code_block,
            fmt_code_language: dto.fmt_code_language,
        }
    }
}

impl From<&CreateBlockDto> for Block {
    fn from(dto: &CreateBlockDto) -> Self {
        Block {
            id: 0,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
            list: dto.list,
            document_position: dto.document_position,
            fmt_alignment: dto.fmt_alignment.clone(),
            fmt_top_margin: dto.fmt_top_margin,
            fmt_bottom_margin: dto.fmt_bottom_margin,
            fmt_left_margin: dto.fmt_left_margin,
            fmt_right_margin: dto.fmt_right_margin,
            fmt_heading_level: dto.fmt_heading_level,
            fmt_indent: dto.fmt_indent,
            fmt_text_indent: dto.fmt_text_indent,
            fmt_marker: dto.fmt_marker.clone(),
            fmt_tab_positions: dto.fmt_tab_positions.clone(),
            fmt_line_height: dto.fmt_line_height,
            fmt_non_breakable_lines: dto.fmt_non_breakable_lines,
            fmt_direction: dto.fmt_direction.clone(),
            fmt_background_color: dto.fmt_background_color.clone(),
            fmt_is_code_block: dto.fmt_is_code_block,
            fmt_code_language: dto.fmt_code_language.clone(),
        }
    }
}

impl From<Block> for CreateBlockDto {
    fn from(entity: Block) -> Self {
        CreateBlockDto {
            created_at: entity.created_at,
            updated_at: entity.updated_at,
            list: entity.list,
            document_position: entity.document_position,
            fmt_alignment: entity.fmt_alignment,
            fmt_top_margin: entity.fmt_top_margin,
            fmt_bottom_margin: entity.fmt_bottom_margin,
            fmt_left_margin: entity.fmt_left_margin,
            fmt_right_margin: entity.fmt_right_margin,
            fmt_heading_level: entity.fmt_heading_level,
            fmt_indent: entity.fmt_indent,
            fmt_text_indent: entity.fmt_text_indent,
            fmt_marker: entity.fmt_marker,
            fmt_tab_positions: entity.fmt_tab_positions,
            fmt_line_height: entity.fmt_line_height,
            fmt_non_breakable_lines: entity.fmt_non_breakable_lines,
            fmt_direction: entity.fmt_direction,
            fmt_background_color: entity.fmt_background_color,
            fmt_is_code_block: entity.fmt_is_code_block,
            fmt_code_language: entity.fmt_code_language,
        }
    }
}

#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
pub struct UpdateBlockDto {
    pub id: EntityId,
    pub created_at: chrono::DateTime<chrono::Utc>,
    pub updated_at: chrono::DateTime<chrono::Utc>,
    pub document_position: i64,
    pub fmt_alignment: Option<Alignment>,
    pub fmt_top_margin: Option<i64>,
    pub fmt_bottom_margin: Option<i64>,
    pub fmt_left_margin: Option<i64>,
    pub fmt_right_margin: Option<i64>,
    pub fmt_heading_level: Option<i64>,
    pub fmt_indent: Option<i64>,
    pub fmt_text_indent: Option<i64>,
    pub fmt_marker: Option<MarkerType>,
    pub fmt_tab_positions: Vec<i64>,
    pub fmt_line_height: Option<i64>,
    pub fmt_non_breakable_lines: Option<bool>,
    pub fmt_direction: Option<TextDirection>,
    pub fmt_background_color: Option<String>,
    pub fmt_is_code_block: Option<bool>,
    pub fmt_code_language: Option<String>,
}

impl From<UpdateBlockDto> for Block {
    fn from(dto: UpdateBlockDto) -> Self {
        Block {
            id: dto.id,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
            document_position: dto.document_position,
            fmt_alignment: dto.fmt_alignment,
            fmt_top_margin: dto.fmt_top_margin,
            fmt_bottom_margin: dto.fmt_bottom_margin,
            fmt_left_margin: dto.fmt_left_margin,
            fmt_right_margin: dto.fmt_right_margin,
            fmt_heading_level: dto.fmt_heading_level,
            fmt_indent: dto.fmt_indent,
            fmt_text_indent: dto.fmt_text_indent,
            fmt_marker: dto.fmt_marker,
            fmt_tab_positions: dto.fmt_tab_positions,
            fmt_line_height: dto.fmt_line_height,
            fmt_non_breakable_lines: dto.fmt_non_breakable_lines,
            fmt_direction: dto.fmt_direction,
            fmt_background_color: dto.fmt_background_color,
            fmt_is_code_block: dto.fmt_is_code_block,
            fmt_code_language: dto.fmt_code_language,
            list: Default::default(),
        }
    }
}

impl From<&UpdateBlockDto> for Block {
    fn from(dto: &UpdateBlockDto) -> Self {
        Block {
            id: dto.id,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
            document_position: dto.document_position,
            fmt_alignment: dto.fmt_alignment.clone(),
            fmt_top_margin: dto.fmt_top_margin,
            fmt_bottom_margin: dto.fmt_bottom_margin,
            fmt_left_margin: dto.fmt_left_margin,
            fmt_right_margin: dto.fmt_right_margin,
            fmt_heading_level: dto.fmt_heading_level,
            fmt_indent: dto.fmt_indent,
            fmt_text_indent: dto.fmt_text_indent,
            fmt_marker: dto.fmt_marker.clone(),
            fmt_tab_positions: dto.fmt_tab_positions.clone(),
            fmt_line_height: dto.fmt_line_height,
            fmt_non_breakable_lines: dto.fmt_non_breakable_lines,
            fmt_direction: dto.fmt_direction.clone(),
            fmt_background_color: dto.fmt_background_color.clone(),
            fmt_is_code_block: dto.fmt_is_code_block,
            fmt_code_language: dto.fmt_code_language.clone(),
            list: Default::default(),
        }
    }
}

impl From<Block> for UpdateBlockDto {
    fn from(entity: Block) -> Self {
        UpdateBlockDto {
            id: entity.id,
            created_at: entity.created_at,
            updated_at: entity.updated_at,
            document_position: entity.document_position,
            fmt_alignment: entity.fmt_alignment,
            fmt_top_margin: entity.fmt_top_margin,
            fmt_bottom_margin: entity.fmt_bottom_margin,
            fmt_left_margin: entity.fmt_left_margin,
            fmt_right_margin: entity.fmt_right_margin,
            fmt_heading_level: entity.fmt_heading_level,
            fmt_indent: entity.fmt_indent,
            fmt_text_indent: entity.fmt_text_indent,
            fmt_marker: entity.fmt_marker,
            fmt_tab_positions: entity.fmt_tab_positions,
            fmt_line_height: entity.fmt_line_height,
            fmt_non_breakable_lines: entity.fmt_non_breakable_lines,
            fmt_direction: entity.fmt_direction,
            fmt_background_color: entity.fmt_background_color,
            fmt_is_code_block: entity.fmt_is_code_block,
            fmt_code_language: entity.fmt_code_language,
        }
    }
}

impl From<BlockDto> for UpdateBlockDto {
    fn from(dto: BlockDto) -> Self {
        UpdateBlockDto {
            id: dto.id,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
            document_position: dto.document_position,
            fmt_alignment: dto.fmt_alignment,
            fmt_top_margin: dto.fmt_top_margin,
            fmt_bottom_margin: dto.fmt_bottom_margin,
            fmt_left_margin: dto.fmt_left_margin,
            fmt_right_margin: dto.fmt_right_margin,
            fmt_heading_level: dto.fmt_heading_level,
            fmt_indent: dto.fmt_indent,
            fmt_text_indent: dto.fmt_text_indent,
            fmt_marker: dto.fmt_marker,
            fmt_tab_positions: dto.fmt_tab_positions,
            fmt_line_height: dto.fmt_line_height,
            fmt_non_breakable_lines: dto.fmt_non_breakable_lines,
            fmt_direction: dto.fmt_direction,
            fmt_background_color: dto.fmt_background_color,
            fmt_is_code_block: dto.fmt_is_code_block,
            fmt_code_language: dto.fmt_code_language,
        }
    }
}
pub use common::direct_access::block::BlockRelationshipField;

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct BlockRelationshipDto {
    pub id: EntityId,
    pub field: BlockRelationshipField,
    pub right_ids: Vec<EntityId>,
}