ff2747eb7785ad4f822b379b83077153498504d9 / frogue / src / entities / ap_remote_notes.rs
Raw
//! Entity representing a remote ActivityPub note.
//!
//! Stores notes from remote actors that we follow. 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 {}