1.0 KiB · text History 94679c7
//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.16

use sea_orm::entity::prelude::*;
use serde::{Serialize, Deserialize};

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
#[sea_orm(table_name = "ai_descriptions")]
pub struct Model {
    #[sea_orm(primary_key, auto_increment = false)]
    pub id: Uuid,
    pub upload_id: Uuid,
    #[sea_orm(column_type = "Text")]
    pub description: String,
    pub model_used: Option<String>,
    #[sea_orm(column_type = "Float", nullable)]
    pub confidence: Option<f32>,
    pub processed_at: DateTimeWithTimeZone,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
    #[sea_orm(
        belongs_to = "super::uploads::Entity",
        from = "Column::UploadId",
        to = "super::uploads::Column::Id",
        on_update = "Cascade",
        on_delete = "Cascade"
    )]
    Uploads,
}

impl Related<super::uploads::Entity> for Entity {
    fn to() -> RelationDef {
        Relation::Uploads.def()
    }
}

impl ActiveModelBehavior for ActiveModel {}