1use crate::db::{BillingPreferencesId, UserId};
2use sea_orm::entity::prelude::*;
3
4#[derive(Clone, Debug, Default, PartialEq, Eq, DeriveEntityModel)]
5#[sea_orm(table_name = "billing_preferences")]
6pub struct Model {
7 #[sea_orm(primary_key)]
8 pub id: BillingPreferencesId,
9 pub created_at: DateTime,
10 pub user_id: UserId,
11 pub max_monthly_llm_usage_spending_in_cents: i32,
12}
13
14#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
15pub enum Relation {
16 #[sea_orm(
17 belongs_to = "super::user::Entity",
18 from = "Column::UserId",
19 to = "super::user::Column::Id"
20 )]
21 User,
22}
23
24impl Related<super::user::Entity> for Entity {
25 fn to() -> RelationDef {
26 Relation::User.def()
27 }
28}
29
30impl ActiveModelBehavior for ActiveModel {}