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 = "String", db_type = "String(StringLen::N(16))")] pub enum PushSubscriptionPlatform { #[default] #[sea_orm(string_value = "web_push")] WebPush, #[sea_orm(string_value = "android_fcm")] AndroidFcm, #[sea_orm(string_value = "ios_apns")] IosApns, } #[sea_orm::model] #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "user_push_subscription")] pub struct Model { #[sea_orm(primary_key, auto_increment = false)] pub id: Uuid, pub user_id: i64, pub endpoint: String, pub p256dh_key: String, pub auth_key: String, pub platform: PushSubscriptionPlatform, pub user_agent: Option, pub created_at: OffsetDateTime, pub updated_at: Option, #[sea_orm(belongs_to, from = "user_id", to = "uid")] pub user: BelongsTo, } impl ActiveModelBehavior for ActiveModel {}