fix: use qsoId for fetching QSO details in award page modal

The award page was filtering QSOs by callsign/date/band/mode, which
could return the wrong QSO when multiple QSOs with the same callsign
exist on the same band/mode combination.

Changes:
- Backend: Add qsoId field to award entity breakdown responses
- Backend: Add GET /api/qsos/:id endpoint to fetch QSO by ID
- Backend: Implement getQSOById() function in lotw.service.js
- Frontend: Update openQSODetailModal() to fetch by qsoId instead of filtering
- Frontend: Include qsoId in QSO entry objects for modal click handler

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-19 13:08:19 +01:00
parent b332989844
commit 9dc8c8b678
4 changed files with 68 additions and 12 deletions

View File

@@ -451,3 +451,18 @@ export async function deleteQSOs(userId) {
return result;
}
/**
* Get a single QSO by ID for a specific user
* @param {number} userId - User ID
* @param {number} qsoId - QSO ID
* @returns {Object|null} QSO object or null if not found
*/
export async function getQSOById(userId, qsoId) {
const result = await db
.select()
.from(qsos)
.where(and(eq(qsos.userId, userId), eq(qsos.id, qsoId)));
return result.length > 0 ? result[0] : null;
}