use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; use time::OffsetDateTime; use uuid::Uuid; #[derive( Debug, Clone, Copy, PartialEq, Eq, Default, EnumIter, DeriveActiveEnum, Serialize, Deserialize, utoipa::ToSchema, )] #[sea_orm(rs_type = "i16", db_type = "SmallInteger")] pub enum ReminderStatus { #[default] #[sea_orm(num_value = 0)] Pending, #[sea_orm(num_value = 1)] Done, #[sea_orm(num_value = 2)] Cancelled, #[sea_orm(num_value = 3)] Delivering, } #[sea_orm::model] #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "chat_message_reminder")] pub struct Model { #[sea_orm(primary_key, auto_increment = false)] pub id: Uuid, #[sea_orm(indexed)] pub user_id: i64, pub room_id: Uuid, pub message_id: Uuid, pub remind_at: OffsetDateTime, pub note: Option, #[sea_orm(default_value = 0)] pub status: ReminderStatus, pub created_at: OffsetDateTime, #[sea_orm(belongs_to, from = "user_id", to = "uid")] pub user: BelongsTo, } impl ActiveModelBehavior for ActiveModel {}