From bb9a030e89a51859b9b916da7623b961398dace5 Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Fri, 17 Jul 2026 14:02:54 +0200 Subject: [PATCH] fix: update clubId handling in CSV upload to support query parameters and improve form data processing --- backend/controllers/matchController.js | 2 +- frontend/src/views/ScheduleView.vue | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/controllers/matchController.js b/backend/controllers/matchController.js index 10a47b35..6a70225d 100755 --- a/backend/controllers/matchController.js +++ b/backend/controllers/matchController.js @@ -4,7 +4,7 @@ import { emitScheduleMatchUpdated } from '../services/socketService.js'; import { devLog } from '../utils/logger.js'; export const uploadCSV = async (req, res) => { try { - const { clubId } = req.body; + const clubId = req.body?.clubId ?? req.query?.clubId; const { authcode: userToken} = req.headers; const filePath = req.file.path; const result = await MatchService.importCSV(userToken, clubId, filePath); diff --git a/frontend/src/views/ScheduleView.vue b/frontend/src/views/ScheduleView.vue index 62e394f1..7cf2fce5 100755 --- a/frontend/src/views/ScheduleView.vue +++ b/frontend/src/views/ScheduleView.vue @@ -2208,7 +2208,10 @@ export default { try { // Let the browser add the multipart boundary. Setting Content-Type manually // drops it and prevents Multer from reading form fields such as clubId. - const response = await apiClient.post('/matches/import', formData); + const response = await apiClient.post( + `/matches/import?clubId=${encodeURIComponent(this.currentClub)}`, + formData + ); if (response.status < 200 || response.status >= 300) { throw new Error(response.data?.error || 'Failed to import CSV data'); }