text-document-direct-access 1.4.0

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

use common::entities::Root;
use common::types::EntityId;
use serde::{Deserialize, Serialize};
use std::convert::From;

#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
pub struct RootDto {
    pub id: EntityId,
    pub created_at: chrono::DateTime<chrono::Utc>,
    pub updated_at: chrono::DateTime<chrono::Utc>,
    pub document: EntityId,
}

impl From<RootDto> for Root {
    fn from(dto: RootDto) -> Self {
        Root {
            id: dto.id,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
            document: dto.document,
        }
    }
}

impl From<&RootDto> for Root {
    fn from(dto: &RootDto) -> Self {
        Root {
            id: dto.id,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
            document: dto.document,
        }
    }
}

impl From<Root> for RootDto {
    fn from(entity: Root) -> Self {
        RootDto {
            id: entity.id,
            created_at: entity.created_at,
            updated_at: entity.updated_at,
            document: entity.document,
        }
    }
}

#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
pub struct CreateRootDto {
    pub created_at: chrono::DateTime<chrono::Utc>,
    pub updated_at: chrono::DateTime<chrono::Utc>,
    pub document: EntityId,
}

impl From<CreateRootDto> for Root {
    fn from(dto: CreateRootDto) -> Self {
        Root {
            id: 0,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
            document: dto.document,
        }
    }
}

impl From<&CreateRootDto> for Root {
    fn from(dto: &CreateRootDto) -> Self {
        Root {
            id: 0,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
            document: dto.document,
        }
    }
}

impl From<Root> for CreateRootDto {
    fn from(entity: Root) -> Self {
        CreateRootDto {
            created_at: entity.created_at,
            updated_at: entity.updated_at,
            document: entity.document,
        }
    }
}

#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
pub struct UpdateRootDto {
    pub id: EntityId,
    pub created_at: chrono::DateTime<chrono::Utc>,
    pub updated_at: chrono::DateTime<chrono::Utc>,
}

impl From<UpdateRootDto> for Root {
    fn from(dto: UpdateRootDto) -> Self {
        Root {
            id: dto.id,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
            document: Default::default(),
        }
    }
}

impl From<&UpdateRootDto> for Root {
    fn from(dto: &UpdateRootDto) -> Self {
        Root {
            id: dto.id,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
            document: Default::default(),
        }
    }
}

impl From<Root> for UpdateRootDto {
    fn from(entity: Root) -> Self {
        UpdateRootDto {
            id: entity.id,
            created_at: entity.created_at,
            updated_at: entity.updated_at,
        }
    }
}

impl From<RootDto> for UpdateRootDto {
    fn from(dto: RootDto) -> Self {
        UpdateRootDto {
            id: dto.id,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
        }
    }
}
pub use common::direct_access::root::RootRelationshipField;

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