Retrait des System.out
This commit is contained in:
parent
f8ff85c865
commit
c9d27e54a7
@ -19,24 +19,20 @@ public class QueryDeleteObject {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lecture des paramètres
|
|
||||||
Integer objectId = body.getInteger("object_id");
|
Integer objectId = body.getInteger("object_id");
|
||||||
Integer userId = body.getInteger("requested_by");
|
Integer userId = body.getInteger("requested_by");
|
||||||
|
|
||||||
System.out.println("Body reçu : " + body.encode());
|
|
||||||
System.out.println("objectId = " + objectId + ", userId = " + userId);
|
|
||||||
|
|
||||||
if (objectId == null || userId == null) {
|
if (objectId == null || userId == null) {
|
||||||
context.response().setStatusCode(400).end(new JsonObject().put("error", "Champs manquants").encode());
|
context.response().setStatusCode(400).end(new JsonObject().put("error", "Champs manquants").encode());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Vérification si l'objet existe
|
|
||||||
String checkQuery = "SELECT id FROM weather_objects WHERE id = ?";
|
String checkQuery = "SELECT id FROM weather_objects WHERE id = ?";
|
||||||
|
|
||||||
databaseService.pool.preparedQuery(checkQuery).execute(Tuple.of(objectId), res -> {
|
databaseService.pool.preparedQuery(checkQuery).execute(Tuple.of(objectId), res -> {
|
||||||
if (res.failed()) {
|
if (res.failed()) {
|
||||||
res.cause().printStackTrace(); // Affiche l'erreur SQL s'il y en a une
|
res.cause().printStackTrace();
|
||||||
context.response().setStatusCode(500)
|
context.response().setStatusCode(500)
|
||||||
.end(new JsonObject().put("error", "Erreur base de données").encode());
|
.end(new JsonObject().put("error", "Erreur base de données").encode());
|
||||||
return;
|
return;
|
||||||
@ -47,7 +43,6 @@ public class QueryDeleteObject {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insertion simple (pas de vérif doublon pour l’instant)
|
|
||||||
String checkDuplicate = "SELECT 1 FROM deletion_requests WHERE object_id = ? AND requested_by = ?";
|
String checkDuplicate = "SELECT 1 FROM deletion_requests WHERE object_id = ? AND requested_by = ?";
|
||||||
String insertQuery = "INSERT INTO deletion_requests (object_id, requested_by) VALUES (?, ?)";
|
String insertQuery = "INSERT INTO deletion_requests (object_id, requested_by) VALUES (?, ?)";
|
||||||
|
|
||||||
@ -56,7 +51,7 @@ public class QueryDeleteObject {
|
|||||||
context.response().setStatusCode(200)
|
context.response().setStatusCode(200)
|
||||||
.end(new JsonObject().put("message", "Demande envoyée").encode());
|
.end(new JsonObject().put("message", "Demande envoyée").encode());
|
||||||
} else {
|
} else {
|
||||||
insertRes.cause().printStackTrace(); // Pour voir l'erreur en console
|
insertRes.cause().printStackTrace();
|
||||||
context.response().setStatusCode(500)
|
context.response().setStatusCode(500)
|
||||||
.end(new JsonObject().put("error", "Erreur insertion").encode());
|
.end(new JsonObject().put("error", "Erreur insertion").encode());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -127,7 +127,6 @@ public class QueryObjects {
|
|||||||
.end(new JsonObject().put("error", "Objet non trouvé").encode());
|
.end(new JsonObject().put("error", "Objet non trouvé").encode());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
System.out.println(idUser);
|
|
||||||
|
|
||||||
Boolean shouldUpdatePoints = body.getBoolean("shouldUpdatePoints", false);
|
Boolean shouldUpdatePoints = body.getBoolean("shouldUpdatePoints", false);
|
||||||
|
|
||||||
|
|||||||
@ -58,7 +58,6 @@ public class QueryWeatherData {
|
|||||||
.end(new JsonObject().put("error", "Paramètre 'location' manquant").encode());
|
.end(new JsonObject().put("error", "Paramètre 'location' manquant").encode());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
System.out.println("Paramètre passé à la requête : '" + location + "'");
|
|
||||||
databaseService.pool
|
databaseService.pool
|
||||||
.query("SELECT wd.wind_speed, wd.temperature, wd.humidity, wd.pressure FROM weather_data wd " +
|
.query("SELECT wd.wind_speed, wd.temperature, wd.humidity, wd.pressure FROM weather_data wd " +
|
||||||
"JOIN weather_objects s ON wd.station_id = s.id WHERE s.location = '" + location +
|
"JOIN weather_objects s ON wd.station_id = s.id WHERE s.location = '" + location +
|
||||||
|
|||||||
@ -42,7 +42,6 @@ public class SetWeatherData {
|
|||||||
}
|
}
|
||||||
String query = String.format("UPDATE range_data SET %s_min=?, %s_max=? WHERE station_id=?", type, type);
|
String query = String.format("UPDATE range_data SET %s_min=?, %s_max=? WHERE station_id=?", type, type);
|
||||||
Integer idUser = body.getInteger("idUser");
|
Integer idUser = body.getInteger("idUser");
|
||||||
System.out.println("User : "+idUser);
|
|
||||||
databaseService.pool
|
databaseService.pool
|
||||||
.preparedQuery(
|
.preparedQuery(
|
||||||
query)
|
query)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user