30 lines
757 B
Rust
30 lines
757 B
Rust
use crate::{DateTimeUtc, ModelProviderId};
|
|
use sea_orm::entity::prelude::*;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
use super::ModelStatus;
|
|
|
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
|
|
#[sea_orm(table_name = "ai_model_provider")]
|
|
pub struct Model {
|
|
#[sea_orm(primary_key)]
|
|
pub id: ModelProviderId,
|
|
pub name: String,
|
|
pub display_name: String,
|
|
pub website: Option<String>,
|
|
pub status: String,
|
|
pub created_at: DateTimeUtc,
|
|
pub updated_at: DateTimeUtc,
|
|
}
|
|
|
|
impl Model {
|
|
pub fn status_enum(&self) -> Result<ModelStatus, &'static str> {
|
|
self.status.parse()
|
|
}
|
|
}
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
pub enum Relation {}
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|