Spaces:
Sleeping
Sleeping
| """ | |
| Domain Layer - Interfaces (Ports) | |
| Defines contracts for infrastructure implementations. | |
| """ | |
| from abc import ABC, abstractmethod | |
| from typing import List, Optional | |
| from uuid import UUID | |
| from app.domain.entities import Document, DocumentChunk | |
| class IDocumentRepository(ABC): | |
| """Repository interface for document persistence""" | |
| async def create(self, document: Document) -> Document: | |
| """Create new document""" | |
| pass | |
| async def get_by_id(self, document_id: UUID) -> Optional[Document]: | |
| """Get document by ID""" | |
| pass | |
| async def update(self, document: Document) -> Document: | |
| """Update document""" | |
| pass | |
| async def list_by_department( | |
| self, department: str, skip: int = 0, limit: int = 100 | |
| ) -> List[Document]: | |
| """List documents by department""" | |
| pass | |
| async def delete(self, document_id: UUID) -> bool: | |
| """Delete document""" | |
| pass | |
| class IChunkRepository(ABC): | |
| """Repository interface for document chunks""" | |
| async def create_bulk(self, chunks: List[DocumentChunk]) -> List[DocumentChunk]: | |
| """Create multiple chunks""" | |
| pass | |
| async def get_by_document_id(self, document_id: UUID) -> List[DocumentChunk]: | |
| """Get all chunks for a document""" | |
| pass | |
| async def delete_by_document_id(self, document_id: UUID) -> int: | |
| """Delete all chunks for a document""" | |
| pass | |