🐸 Frogue(Fed)

~ololduck/Frogue

Raw

//! Entity representing an outbound ticket/merge request to a remote tracker.
//!
//! When a local user opens a ticket or merge request on a remote forge,
//! we track it here: the Offer activity we sent, the tracker we sent it to,
//! and the status (pending/accepted/rejected) with the assigned URL if accepted.

use sea_orm::entity::prelude::*;
use serde::Serialize;

#[sea_orm::model]
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, Serialize)]
#[sea_orm(table_name = "ap_remote_tickets")]
pub struct Model {
    #[sea_orm(primary_key)]
    pub id: i64,
    #[sea_orm(unique)]
    pub uuid: Uuid,
    /// The local user who opened this ticket/merge request.
    pub author_id: i64,
    /// The kind of object: 'ticket' or 'mr'.
    pub kind: String,
    /// The tracker actor URL we sent the Offer to.
    pub tracker_url: String,
    /// The Offer activity URL (unique, for idempotency and correlation).
    pub offer_activity_url: String,
    /// The status: 'pending', 'accepted', or 'rejected'.
    pub status: String,
    /// The assigned URL from Accept.result (only set when status = 'accepted').
    pub assigned_url: Option<String>,
    /// The summary of the ticket/merge request (for display in lists).
    pub summary: String,
    pub created_at: DateTimeWithTimeZone,
}

impl ActiveModelBehavior for ActiveModel {}