use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)] #[sea_orm(table_name = "points_checkin")] pub struct Model { #[sea_orm(primary_key, auto_increment = false)] pub id: Uuid, pub tenant_id: Uuid, pub patient_id: Uuid, pub checkin_date: chrono::NaiveDate, pub consecutive_days: i32, pub created_at: DateTimeUtc, } #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] pub enum Relation { #[sea_orm( belongs_to = "super::patient::Entity", from = "Column::PatientId", to = "super::patient::Column::Id" )] Patient, } impl Related for Entity { fn to() -> RelationDef { Relation::Patient.def() } } impl ActiveModelBehavior for ActiveModel {}