Implement Sprint 2: Source Management
- Add SourceService with create, list, delete, research methods
- Add POST /api/v1/notebooks/{id}/sources - Add source (URL, YouTube, Drive)
- Add GET /api/v1/notebooks/{id}/sources - List sources with filtering
- Add DELETE /api/v1/notebooks/{id}/sources/{source_id} - Delete source
- Add POST /api/v1/notebooks/{id}/sources/research - Web research
- Add ResearchRequest model for research parameters
- Integrate sources router with main app
Endpoints:
- POST /sources - 201 Created
- GET /sources - 200 OK with pagination
- DELETE /sources/{id} - 204 No Content
- POST /sources/research - 202 Accepted
Technical:
- Support for url, youtube, drive source types
- Filtering by source_type and status
- Validation for research mode (fast/deep)
- Error handling with standardized responses
Related: Sprint 2 - Source Management
107 lines
2.6 KiB
Markdown
107 lines
2.6 KiB
Markdown
# Prompt Sprint 2 - Source Management
|
|
|
|
## 🎯 Sprint 2: Source Management
|
|
|
|
**Iniziato**: 2026-04-06
|
|
**Stato**: 🟡 In Progress
|
|
**Assegnato**: @sprint-lead
|
|
|
|
---
|
|
|
|
## 📋 Obiettivo
|
|
|
|
Implementare la gestione delle fonti (sources) per i notebook, permettendo agli utenti di aggiungere URL, PDF, YouTube, Google Drive e avviare ricerche web.
|
|
|
|
---
|
|
|
|
## 🏗️ Architettura
|
|
|
|
### Pattern da seguire (stesso di Sprint 1)
|
|
|
|
```
|
|
API Layer (FastAPI Routes)
|
|
↓
|
|
Service Layer (SourceService)
|
|
↓
|
|
External Layer (notebooklm-py client)
|
|
```
|
|
|
|
### Endpoints da implementare
|
|
|
|
1. **POST /api/v1/notebooks/{id}/sources** - Aggiungere fonte
|
|
2. **GET /api/v1/notebooks/{id}/sources** - Listare fonti
|
|
3. **DELETE /api/v1/notebooks/{id}/sources/{source_id}** - Rimuovere fonte
|
|
4. **GET /api/v1/notebooks/{id}/sources/{source_id}/fulltext** - Ottenere testo
|
|
5. **POST /api/v1/notebooks/{id}/sources/research** - Ricerca web
|
|
|
|
---
|
|
|
|
## 📊 Task Breakdown Sprint 2
|
|
|
|
### Fase 1: Specifiche
|
|
- [ ] SPEC-004: Analisi requisiti Source Management
|
|
- [ ] SPEC-005: Definire modelli dati fonti
|
|
|
|
### Fase 2: API Design
|
|
- [ ] API-003: Modelli Pydantic (SourceCreate, Source, ecc.)
|
|
- [ ] API-004: Documentazione endpoints
|
|
|
|
### Fase 3: Implementazione
|
|
- [ ] DEV-007: SourceService
|
|
- [ ] DEV-008: POST /sources
|
|
- [ ] DEV-009: GET /sources
|
|
- [ ] DEV-010: DELETE /sources/{id}
|
|
- [ ] DEV-011: POST /sources/research
|
|
|
|
### Fase 4: Testing
|
|
- [ ] TEST-004: Unit tests SourceService
|
|
- [ ] TEST-005: Integration tests
|
|
|
|
---
|
|
|
|
## 🔧 Implementazione
|
|
|
|
### Tipi di Fonti Supportate
|
|
|
|
```python
|
|
class SourceType(str, Enum):
|
|
URL = "url"
|
|
FILE = "file" # PDF, DOC, etc.
|
|
YOUTUBE = "youtube"
|
|
DRIVE = "drive"
|
|
```
|
|
|
|
### SourceService Methods
|
|
|
|
```python
|
|
class SourceService:
|
|
async def create(notebook_id: UUID, data: dict) -> Source
|
|
async def list(notebook_id: UUID) -> list[Source]
|
|
async def get(notebook_id: UUID, source_id: str) -> Source
|
|
async def delete(notebook_id: UUID, source_id: str) -> None
|
|
async def get_fulltext(notebook_id: UUID, source_id: str) -> str
|
|
async def research(notebook_id: UUID, query: str, mode: str) -> ResearchResult
|
|
```
|
|
|
|
---
|
|
|
|
## 📝 Note Importanti
|
|
|
|
1. **Riusare pattern Sprint 1**: Stessa struttura NotebookService
|
|
2. **Gestione upload file**: Supportare multipart/form-data per PDF
|
|
3. **Ricerca web**: Integrare con notebooklm-py research
|
|
4. **Error handling**: Fonte già esistente, formato non supportato
|
|
|
|
---
|
|
|
|
## 🚀 Prossimi Passi
|
|
|
|
1. @sprint-lead: Attivare @api-designer per API-003
|
|
2. @api-designer: Definire modelli Pydantic
|
|
3. @tdd-developer: Iniziare implementazione SourceService
|
|
|
|
---
|
|
|
|
**Dipende da**: Sprint 1 (Notebook CRUD) ✅
|
|
**Blocca**: Sprint 3 (Chat) 🔴
|