fediverse_pending_invite.rs
49 lignes · 1815 octets
//! SeaORM entity for `fediverse_pending_invites` (RFC 0009). //! //! Persistent record of cross-instance team-membership invitations //! issued by a Rustwarden host (`b.tld`) towards a remote user //! (`alice@a.tld`). The activity reference (`activity_id`) lets the //! AP `Accept{Invite}` / `Reject{Invite}` callbacks find the right //! row without ambiguity. use chrono::{DateTime, Utc}; use sea_orm::entity::prelude::*; use serde::{Deserialize, Serialize}; use uuid::Uuid; /// Persistent record of one in-flight invitation. #[derive(Clone, Debug, Serialize, Deserialize, DeriveEntityModel)] #[sea_orm(table_name = "fediverse_pending_invites")] pub struct Model { /// Stable PK. #[sea_orm(primary_key, auto_increment = false)] pub id: Uuid, /// AP `Invite` activity id (e.g. `https://b.tld/invites/<uuid>`). #[sea_orm(unique)] pub activity_id: String, /// FK to `teams.id`. pub team_id: Uuid, /// `@user@domain` handle invited. pub invited_handle: String, /// FK to `remote_identities.id`, populated when the AP `Accept` /// arrives and the remote actor is fully resolved. pub invited_remote_identity_id: Option<Uuid>, /// Team role to assign on accept (`"member"`, `"admin"`). pub role: String, /// FK to `users.id` of the inviter. pub invited_by_user_id: Uuid, /// `pending`, `accepted`, `rejected`, `revoked`, or `expired`. pub status: String, /// Insertion timestamp. pub created_at: DateTime<Utc>, /// Hard deadline. pub expires_at: DateTime<Utc>, /// Set when the invite reaches a terminal state. pub decided_at: Option<DateTime<Utc>>, } /// SeaORM relations (none modelled here). #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] pub enum Relation {} impl ActiveModelBehavior for ActiveModel {}
GitRust