From caa759951887cd52bad463bd33cc806946824ffb Mon Sep 17 00:00:00 2001 From: Luca Warmenhoven Date: Tue, 28 May 2024 11:53:28 +0200 Subject: [PATCH] Commit war crimes in formal Yugoslavia --- .idea/workspace.xml | 19 ++++++++++++++----- code/web/incoming_request_handlers.js | 13 +++++++------ 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index fd1ed2b..f242400 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -14,8 +14,8 @@ - - + + @@ -375,6 +383,7 @@ - \ No newline at end of file diff --git a/code/web/incoming_request_handlers.js b/code/web/incoming_request_handlers.js index 0a2114b..2d13b29 100644 --- a/code/web/incoming_request_handlers.js +++ b/code/web/incoming_request_handlers.js @@ -8,18 +8,19 @@ */ function handleIncoming(request, response, app, pool) { + + let query = 'SELECT * FROM Exercise WHERE ExerciseID = ?'; + let parameters = []; + if (!request.hasOwnProperty('uid') || typeof request.uid !== 'number') { - response - .status(400) - .send(JSON.stringify({error: 'Missing valid UID in request'})); - return; - } + query = 'SELECT * FROM Exercise'; + } else parameters.push(request.uid); // Acquire database connection pool.getConnection() .then(conn => { - conn.query('SELECT * FROM Exercise WHERE ExerciseID = ?', [request.uid]) + conn.query(query, parameters) .then(rows => { if (rows.length === 0) {