provider.rs

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