feat(chat): persistance bornee du brouillon custom chat par projet/layout (#182)

This commit is contained in:
2026-08-11 16:24:20 +02:00
parent 25ad44a3d9
commit 94b4ce7e5f
23 changed files with 1552 additions and 70 deletions

View File

@ -35,6 +35,7 @@ use crate::background_task::{
BackgroundTask, BackgroundTaskKind, BackgroundTaskResult, BackgroundTaskWakePolicy,
};
use crate::chat_attachment::{ChatAttachment, ChatAttachmentId, ChatAttachmentSourceKind};
use crate::chat_draft::{ChatDraft, ChatDraftKey};
use crate::device::{AuthenticatedDevice, DeviceId, PairedDevice};
use crate::events::DomainEvent;
use crate::ids::{
@ -1251,6 +1252,23 @@ pub trait ChatAttachmentStore: Send + Sync {
) -> Result<Vec<ChatAttachment>, ChatAttachmentStoreError>;
}
/// Persistence port for project-scoped custom chat drafts.
#[async_trait]
pub trait ChatDraftStore: Send + Sync {
/// Reads one draft. Missing entries return `Ok(None)`.
async fn read(
&self,
root: &ProjectPath,
key: ChatDraftKey,
) -> Result<Option<ChatDraft>, StoreError>;
/// Saves or replaces one draft.
async fn save(&self, root: &ProjectPath, draft: ChatDraft) -> Result<(), StoreError>;
/// Clears one draft. Missing entries are a no-op.
async fn clear(&self, root: &ProjectPath, key: ChatDraftKey) -> Result<(), StoreError>;
}
/// Errors from the sprint store.
#[derive(Debug, Clone, PartialEq, Eq, Error)]
pub enum SprintStoreError {