Files
bambuddy/backend/app/schemas/print_log.py
T
maziggy 27cecbed87 feat: add print log timeline view in archives page
Add a chronological, table-based print log as a 4th view mode in the
Archives page. Log entries are stored in a separate print_log_entries
table — clearing the log never touches archives or queue items.

Backend:
- New PrintLogEntry model with independent table
- GET /print-log/ endpoint with search, printer, user, status, date filters
- DELETE /print-log/ clears only log entries
- Thumbnail serving endpoint for log entries
- write_log_entry() service called on print completion
- Auth: ARCHIVES_READ for viewing, ARCHIVES_DELETE_ALL for clearing

Frontend:
- New 'log' ViewMode with ClipboardList icon toggle
- Filterable/searchable table with pagination (10/25/50/100 rows)
- Colored status badges, duration formatting, filament color swatches
- Clear button with confirmation modal
- All filter state persisted to localStorage
- i18n: EN, DE, JA, FR, IT translations
2026-02-15 13:14:15 +01:00

26 lines
669 B
Python

from datetime import datetime
from pydantic import BaseModel
class PrintLogEntrySchema(BaseModel):
id: int
print_name: str | None = None
printer_name: str | None = None
printer_id: int | None = None
status: str
started_at: datetime | None = None
completed_at: datetime | None = None
duration_seconds: int | None = None
filament_type: str | None = None
filament_color: str | None = None
filament_used_grams: float | None = None
thumbnail_path: str | None = None
created_by_username: str | None = None
created_at: datetime
class PrintLogResponse(BaseModel):
items: list[PrintLogEntrySchema]
total: int