feat: v2 rewrite — hexagonal arch, ActivityPub federation, NATS, deployment-ready #1

Merged
GKaszewski merged 334 commits from v2 into master 2026-05-16 09:42:43 +00:00
Showing only changes of commit f4db518167 - Show all commits

View File

@@ -1,9 +1,11 @@
use std::collections::HashMap;
use crate::{
errors::DomainError,
events::{DomainEvent, EventEnvelope},
models::{
api_key::ApiKey,
feed::{FeedEntry, PageParams, Paginated, UserSummary},
feed::{EngagementStats, FeedEntry, PageParams, Paginated, UserSummary, ViewerContext},
notification::Notification,
remote_actor::RemoteActor,
social::{Block, Boost, Follow, FollowState, Like},
@@ -56,6 +58,8 @@ pub trait UserReader: Send + Sync {
async fn find_by_email(&self, email: &Email) -> Result<Option<User>, DomainError>;
async fn list_with_stats(&self) -> Result<Vec<UserSummary>, DomainError>;
async fn count(&self) -> Result<i64, DomainError>;
async fn list_paginated(&self, page: PageParams) -> Result<Paginated<UserSummary>, DomainError>;
async fn find_by_ids(&self, ids: &[UserId]) -> Result<HashMap<UserId, User>, DomainError>;
}
#[async_trait]
@@ -115,6 +119,15 @@ pub trait BoostRepository: Send + Sync {
async fn count_for_thought(&self, thought_id: &ThoughtId) -> Result<i64, DomainError>;
}
#[async_trait]
pub trait EngagementRepository: Send + Sync {
async fn get_for_thoughts(
&self,
thought_ids: &[ThoughtId],
viewer_id: Option<&UserId>,
) -> Result<HashMap<ThoughtId, (EngagementStats, Option<ViewerContext>)>, DomainError>;
}
#[async_trait]
pub trait FollowRepository: Send + Sync {
async fn save(&self, follow: &Follow) -> Result<(), DomainError>;
@@ -180,6 +193,11 @@ pub trait ApiKeyRepository: Send + Sync {
async fn delete(&self, id: &ApiKeyId, user_id: &UserId) -> Result<(), DomainError>;
}
#[async_trait]
pub trait ApiKeyService: Send + Sync {
async fn validate_key(&self, raw_key: &str) -> Result<Option<UserId>, DomainError>;
}
#[async_trait]
pub trait TopFriendRepository: Send + Sync {
async fn set_top_friends(