gitdataai/libs/transport/event/project.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

115 lines
2.9 KiB
Rust

use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use models::{ProjectId, RoomCategoryId, Uuid};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum ProjectEventType {
RoomCreated,
RoomDeleted,
RoomRenamed,
RoomMoved,
RepoCreated,
RepoUpdated,
RepoDeleted,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "type", rename_all = "snake_case")]
pub enum ProjectEvent {
RoomCreated(ProjectRoomCreatedService),
RoomDeleted(ProjectRoomDeletedService),
RoomRenamed(ProjectRoomRenamedService),
RoomMoved(ProjectRoomMovedService),
RepoCreated(ProjectRepoCreatedService),
RepoUpdated(ProjectRepoUpdatedService),
RepoDeleted(ProjectRepoDeletedService),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ProjectRoomCreatedService {
pub project: ProjectId,
pub room: Uuid,
pub room_name: String,
pub public: bool,
pub category: Option<Uuid>,
pub created_by: Uuid,
pub created_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ProjectRoomDeletedService {
pub project: ProjectId,
pub room: Uuid,
pub deleted_by: Uuid,
pub deleted_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ProjectRoomRenamedService {
pub project: ProjectId,
pub room: Uuid,
pub old_name: String,
pub new_name: String,
pub renamed_by: Uuid,
pub renamed_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ProjectRoomMovedService {
pub project: ProjectId,
pub room: Uuid,
pub old_category: Option<Uuid>,
pub new_category: Option<Uuid>,
pub moved_by: Uuid,
pub moved_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ProjectRepoCreatedService {
pub project: ProjectId,
pub repo: Uuid,
pub repo_name: String,
pub created_by: Uuid,
pub created_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ProjectRepoUpdatedService {
pub project: ProjectId,
pub repo: Uuid,
pub updated_by: Uuid,
pub updated_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ProjectRepoDeletedService {
pub project: ProjectId,
pub repo: Uuid,
pub deleted_by: Uuid,
pub deleted_at: DateTime<Utc>,
}
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct ProjectRoomCreateClient {
pub project: ProjectId,
pub room_name: String,
#[serde(rename = "room_public")]
pub public: bool,
pub category: Option<RoomCategoryId>,
}
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct ProjectRoomUpdateClient {
pub room: Uuid,
pub room_name: Option<String>,
#[serde(rename = "room_public")]
pub public: Option<bool>,
pub category: Option<RoomCategoryId>,
}
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct ProjectRoomDeleteClient {
pub room: Uuid,
}