gitdataai/libs/transport/event/attachment.rs
ZhenYi 14f6e1e500 feat(core): initialize project with access control and AI integration
- 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
2026-05-03 06:04:31 +08:00

51 lines
1.3 KiB
Rust

use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use models::{MessageId, RoomId, Uuid};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum AttachmentEventType {
Uploaded,
ThumbnailGenerated,
Deleted,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "type", rename_all = "snake_case")]
pub enum AttachmentEvent {
Uploaded(AttachmentUploadedService),
ThumbnailGenerated(AttachmentThumbnailService),
Deleted(AttachmentDeletedService),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AttachmentUploadedService {
pub id: Uuid,
pub room: RoomId,
pub message: Option<MessageId>,
pub filename: String,
pub content_type: String,
pub size: i64,
pub url: String,
pub uploaded_by: Uuid,
pub uploaded_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AttachmentThumbnailService {
pub id: Uuid,
pub room: RoomId,
pub thumbnail_url: String,
pub width: Option<i32>,
pub height: Option<i32>,
pub generated_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AttachmentDeletedService {
pub id: Uuid,
pub room: RoomId,
pub deleted_by: Uuid,
pub deleted_at: DateTime<Utc>,
}