provider.rs

 1use sea_orm::entity::prelude::*;
 2
 3use crate::llm::db::ProviderId;
 4
 5/// An LLM provider.
 6#[derive(Clone, Debug, PartialEq, DeriveEntityModel)]
 7#[sea_orm(table_name = "providers")]
 8pub struct Model {
 9    #[sea_orm(primary_key)]
10    pub id: ProviderId,
11    pub name: String,
12}
13
14#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
15pub enum Relation {
16    #[sea_orm(has_many = "super::model::Entity")]
17    Models,
18}
19
20impl Related<super::model::Entity> for Entity {
21    fn to() -> RelationDef {
22        Relation::Models.def()
23    }
24}
25
26impl ActiveModelBehavior for ActiveModel {}