540871a8cdc2c7df89bd3c0f5eb39387359db062 / frogue / src / entities / ap_remote_notes.rs
Raw
// SPDX-FileCopyrightText: 2026 Ololduck <ololduck@vit.am> and contributors
//
// SPDX-License-Identifier: GPL-3.0-or-later
//! Entity representing a remote ActivityPub note.
//!
//! Stores notes from remote actors whose activities we have received. The
//! object_url is the canonical ActivityPub ID, used for idempotent storage.
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
#[sea_orm(table_name = "ap_remote_notes")]
pub struct Model {
#[sea_orm(primary_key)]
pub id: i64,
pub remote_actor_id: i64,
#[sea_orm(unique)]
pub object_url: String,
pub content_html: String,
pub published: DateTimeWithTimeZone,
pub received_at: DateTimeWithTimeZone,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::ap_remote_actors::Entity",
from = "Column::RemoteActorId",
to = "super::ap_remote_actors::Column::Id"
)]
ApRemoteActors,
}
impl Related<super::ap_remote_actors::Entity> for Entity {
fn to() -> RelationDef {
Relation::ApRemoteActors.def()
}
}
impl ActiveModelBehavior for ActiveModel {}