- Add gitignore and prettier configuration files for project scaffolding - Implement room access control service with project member verification - Create user access key management with CRUD operations and activity logging - Add accordion UI component for frontend expandable sections - Implement room AI configuration with list, upsert, and delete operations - Add AI event types for agent join/leave/status change tracking - Create streaming AI processing services for mode and react patterns - Build room AI service with model detection and idempotency handling - Integrate chat service orchestration for AI message processing - Add typing indicators and stream cancellation for AI interactions - Implement mention parsing and context extraction for AI agents
63 lines
1.6 KiB
Rust
63 lines
1.6 KiB
Rust
use crate::{DateTimeUtc, MessageId, RoomId, UserId};
|
|
use sea_orm::entity::prelude::*;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
|
|
#[sea_orm(table_name = "room_message_reaction")]
|
|
pub struct Model {
|
|
#[sea_orm(primary_key)]
|
|
pub id: Uuid,
|
|
pub room: RoomId,
|
|
pub message: MessageId,
|
|
pub user: UserId,
|
|
pub emoji: String,
|
|
pub created_at: DateTimeUtc,
|
|
}
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
pub enum Relation {
|
|
#[sea_orm(
|
|
belongs_to = "super::room::Entity",
|
|
from = "Column::Room",
|
|
to = "super::room::Column::Id"
|
|
)]
|
|
Room,
|
|
#[sea_orm(
|
|
belongs_to = "super::room_message::Entity",
|
|
from = "Column::Message",
|
|
to = "super::room_message::Column::Id"
|
|
)]
|
|
Message,
|
|
}
|
|
|
|
impl Related<super::room::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::Room.def()
|
|
}
|
|
}
|
|
|
|
impl Related<super::room_message::Entity> for Entity {
|
|
fn to() -> RelationDef {
|
|
Relation::Message.def()
|
|
}
|
|
}
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|
|
|
|
/// Aggregated reaction counts per message for API responses
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct MessageReactionSummary {
|
|
pub message_id: UserId,
|
|
/// emoji -> { count, reacted_by_current_user }
|
|
pub reactions: Vec<ReactionGroup>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct ReactionGroup {
|
|
pub emoji: String,
|
|
pub count: i64,
|
|
pub reacted_by_me: bool,
|
|
/// Sample of users who reacted (first 3)
|
|
pub users: Vec<UserId>,
|
|
}
|