use sea_orm::entity::prelude::*; use time::OffsetDateTime; use uuid::Uuid; #[sea_orm::model] #[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)] #[sea_orm(table_name = "space_invite")] pub struct Model { #[sea_orm(primary_key, auto_increment = false)] pub id: Uuid, pub space_id: Uuid, pub user_id: Option, pub email: String, // 授予的角色组见 space_invite_groups 关联表 pub accept_code: String, pub created_at: OffsetDateTime, pub expires_at: Option, pub accepted_at: Option, pub revoked_at: Option, #[sea_orm(belongs_to, from = "space_id", to = "id")] pub space: BelongsTo, #[sea_orm(belongs_to, from = "user_id", to = "uid")] pub user: BelongsTo>, } impl ActiveModelBehavior for ActiveModel {}