diff --git a/CHANGELOG.md b/CHANGELOG.md index 21581c67e..bc8dd9e29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,10 @@ All notable changes to Bambuddy will be documented in this file. - Placeholder text shows expected format (e.g., "DD/MM/YYYY" or "HH:MM AM/PM") - Added date utilities: `formatDateInput`, `parseDateInput`, `getDatePlaceholder` - Added time utilities: `formatTimeInput`, `parseTimeInput`, `getTimePlaceholder` +- **500 Error on Archive Detail Page**: + - Fixed internal server error when viewing individual archive details + - Root cause: `project` relationship not eagerly loaded in `get_archive()` service method + - Async SQLAlchemy requires explicit eager loading; lazy loading is not supported ## [0.1.6.2] - 2026-02-02 diff --git a/backend/app/services/archive.py b/backend/app/services/archive.py index 840be0999..39037e703 100644 --- a/backend/app/services/archive.py +++ b/backend/app/services/archive.py @@ -933,11 +933,13 @@ class ArchiveService: return archive async def get_archive(self, archive_id: int) -> PrintArchive | None: - """Get an archive by ID with creator loaded.""" + """Get an archive by ID with relationships loaded.""" from sqlalchemy.orm import selectinload result = await self.db.execute( - select(PrintArchive).options(selectinload(PrintArchive.created_by)).where(PrintArchive.id == archive_id) + select(PrintArchive) + .options(selectinload(PrintArchive.created_by), selectinload(PrintArchive.project)) + .where(PrintArchive.id == archive_id) ) return result.scalar_one_or_none()