From 979232d0293c7be26a14cab5d8f6b81eaea7c65c Mon Sep 17 00:00:00 2001 From: anasgourd <151581241+anasgourd@users.noreply.github.com> Date: Sat, 21 Dec 2024 18:59:57 +0200 Subject: [PATCH 1/4] Prevent unused variable declarations --- controllers/LicensePlate.js | 4 ++-- controllers/Payment.js | 2 +- controllers/Reservation.js | 6 +++--- controllers/Spot.js | 10 +++++----- controllers/SpotOwner.js | 2 +- service/ReservationService.js | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/controllers/LicensePlate.js b/controllers/LicensePlate.js index fb25814..a0610b9 100644 --- a/controllers/LicensePlate.js +++ b/controllers/LicensePlate.js @@ -3,7 +3,7 @@ var utils = require('../utils/writer.js'); var LicensePlate = require('../service/LicensePlateService'); -module.exports.modifyPlate = function modifyPlate (req, res, next, body) { +module.exports.modifyPlate = function modifyPlate (_, res, _, body) { LicensePlate.modifyPlate(body) .then(function (response) { utils.writeJson(res, response); @@ -13,7 +13,7 @@ module.exports.modifyPlate = function modifyPlate (req, res, next, body) { }); }; -module.exports.registerPlate = function registerPlate (req, res, next, body) { +module.exports.registerPlate = function registerPlate (_, res, _ , body) { LicensePlate.registerPlate(body) .then(function (response) { utils.writeJson(res, response); diff --git a/controllers/Payment.js b/controllers/Payment.js index d7063a9..56d00dd 100644 --- a/controllers/Payment.js +++ b/controllers/Payment.js @@ -3,7 +3,7 @@ var utils = require('../utils/writer.js'); var Payment = require('../service/PaymentService'); -module.exports.makePayment = function makePayment (req, res, next, body) { +module.exports.makePayment = function makePayment (_ , res, _ , body) { Payment.makePayment(body) .then(function (response) { utils.writeJson(res, response); diff --git a/controllers/Reservation.js b/controllers/Reservation.js index 2616028..dbff588 100644 --- a/controllers/Reservation.js +++ b/controllers/Reservation.js @@ -3,7 +3,7 @@ var utils = require('../utils/writer.js'); var Reservation = require('../service/ReservationService'); -module.exports.deleteReservation = function deleteReservation (req, res, next, id) { +module.exports.deleteReservation = function deleteReservation (_, res, _, id) { Reservation.deleteReservation(id) .then(function (response) { utils.writeJson(res, response); @@ -13,7 +13,7 @@ module.exports.deleteReservation = function deleteReservation (req, res, next, i }); }; -module.exports.makeReservation = function makeReservation (req, res, next, body) { +module.exports.makeReservation = function makeReservation (_, res, _, body) { Reservation.makeReservation(body) .then(function (response) { utils.writeJson(res, response); @@ -23,7 +23,7 @@ module.exports.makeReservation = function makeReservation (req, res, next, body) }); }; -module.exports.modifyReservation = function modifyReservation (req, res, next, body, spotId, userId, startTime, duration, date, id) { +module.exports.modifyReservation = function modifyReservation (_, res, _, body, spotId, userId, startTime, duration, date, id) { Reservation.modifyReservation(body, spotId, userId, startTime, duration, date, id) .then(function (response) { utils.writeJson(res, response); diff --git a/controllers/Spot.js b/controllers/Spot.js index e553c6a..b69e6db 100644 --- a/controllers/Spot.js +++ b/controllers/Spot.js @@ -3,7 +3,7 @@ var utils = require('../utils/writer.js'); var Spot = require('../service/SpotService'); -module.exports.createSpot = function createSpot (req, res, next, body) { +module.exports.createSpot = function createSpot (_, res, _, body) { Spot.createSpot(body) .then(function (response) { utils.writeJson(res, response); @@ -13,7 +13,7 @@ module.exports.createSpot = function createSpot (req, res, next, body) { }); }; -module.exports.getSpots = function getSpots (req, res, next) { +module.exports.getSpots = function getSpots (_, res, _) { Spot.getSpots() .then(function (response) { utils.writeJson(res, response); @@ -23,7 +23,7 @@ module.exports.getSpots = function getSpots (req, res, next) { }); }; -module.exports.modifySpot = function modifySpot (req, res, next, body, address, type, charger, id) { +module.exports.modifySpot = function modifySpot (_, res, _, body, address, type, charger, id) { Spot.modifySpot(body, address, type, charger, id) .then(function (response) { utils.writeJson(res, response); @@ -33,7 +33,7 @@ module.exports.modifySpot = function modifySpot (req, res, next, body, address, }); }; -module.exports.removeSpot = function removeSpot (req, res, next, id) { +module.exports.removeSpot = function removeSpot (_, res, _, id) { Spot.removeSpot(id) .then(function (response) { utils.writeJson(res, response); @@ -43,7 +43,7 @@ module.exports.removeSpot = function removeSpot (req, res, next, id) { }); }; -module.exports.searchSpot = function searchSpot (req, res, next, address, type, charger) { +module.exports.searchSpot = function searchSpot (_, res, _, address, type, charger) { Spot.searchSpot(address, type, charger) .then(function (response) { utils.writeJson(res, response); diff --git a/controllers/SpotOwner.js b/controllers/SpotOwner.js index 4cdfcf8..bbed7a2 100644 --- a/controllers/SpotOwner.js +++ b/controllers/SpotOwner.js @@ -3,7 +3,7 @@ var utils = require('../utils/writer.js'); var SpotOwner = require('../service/SpotOwnerService'); -module.exports.addSpotOwner = function addSpotOwner (req, res, next, body) { +module.exports.addSpotOwner = function addSpotOwner (_, res, _, body) { SpotOwner.addSpotOwner(body) .then(function (response) { utils.writeJson(res, response); diff --git a/service/ReservationService.js b/service/ReservationService.js index abb4437..587e9a1 100644 --- a/service/ReservationService.js +++ b/service/ReservationService.js @@ -112,7 +112,7 @@ exports.makeReservation = function(body) { * id Integer * no response value expected for this operation **/ -exports.modifyReservation = function(body,spotId,userId,startTime,duration,date,id) { +exports.modifyReservation = function(body,spotId,userId,_ ,_ ,_,id) { return new Promise(function(resolve, reject) { // // Η ημερομηνία της κράτησης πρεπει να είναι string (τύπος date) From 32a4998907e89d46abe361032f21767f2b1ca06a Mon Sep 17 00:00:00 2001 From: anasgourd <151581241+anasgourd@users.noreply.github.com> Date: Sat, 21 Dec 2024 19:17:13 +0200 Subject: [PATCH 2/4] More changes for task Remove Unused Variables --- controllers/LicensePlate.js | 4 ++-- controllers/Payment.js | 2 +- controllers/Reservation.js | 6 +++--- controllers/Spot.js | 10 +++++----- controllers/SpotOwner.js | 2 +- service/ReservationService.js | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/controllers/LicensePlate.js b/controllers/LicensePlate.js index a0610b9..ae53097 100644 --- a/controllers/LicensePlate.js +++ b/controllers/LicensePlate.js @@ -3,7 +3,7 @@ var utils = require('../utils/writer.js'); var LicensePlate = require('../service/LicensePlateService'); -module.exports.modifyPlate = function modifyPlate (_, res, _, body) { +module.exports.modifyPlate = function modifyPlate (_req, res, _next, body) { LicensePlate.modifyPlate(body) .then(function (response) { utils.writeJson(res, response); @@ -13,7 +13,7 @@ module.exports.modifyPlate = function modifyPlate (_, res, _, body) { }); }; -module.exports.registerPlate = function registerPlate (_, res, _ , body) { +module.exports.registerPlate = function registerPlate (_req, res, _next , body) { LicensePlate.registerPlate(body) .then(function (response) { utils.writeJson(res, response); diff --git a/controllers/Payment.js b/controllers/Payment.js index 56d00dd..d182dca 100644 --- a/controllers/Payment.js +++ b/controllers/Payment.js @@ -3,7 +3,7 @@ var utils = require('../utils/writer.js'); var Payment = require('../service/PaymentService'); -module.exports.makePayment = function makePayment (_ , res, _ , body) { +module.exports.makePayment = function makePayment (_req , res, _next , body) { Payment.makePayment(body) .then(function (response) { utils.writeJson(res, response); diff --git a/controllers/Reservation.js b/controllers/Reservation.js index dbff588..612864e 100644 --- a/controllers/Reservation.js +++ b/controllers/Reservation.js @@ -3,7 +3,7 @@ var utils = require('../utils/writer.js'); var Reservation = require('../service/ReservationService'); -module.exports.deleteReservation = function deleteReservation (_, res, _, id) { +module.exports.deleteReservation = function deleteReservation (_req, res, _next, id) { Reservation.deleteReservation(id) .then(function (response) { utils.writeJson(res, response); @@ -13,7 +13,7 @@ module.exports.deleteReservation = function deleteReservation (_, res, _, id) { }); }; -module.exports.makeReservation = function makeReservation (_, res, _, body) { +module.exports.makeReservation = function makeReservation (_req, res, _next, body) { Reservation.makeReservation(body) .then(function (response) { utils.writeJson(res, response); @@ -23,7 +23,7 @@ module.exports.makeReservation = function makeReservation (_, res, _, body) { }); }; -module.exports.modifyReservation = function modifyReservation (_, res, _, body, spotId, userId, startTime, duration, date, id) { +module.exports.modifyReservation = function modifyReservation (_req, res, _next, body, spotId, userId, startTime, duration, date, id) { Reservation.modifyReservation(body, spotId, userId, startTime, duration, date, id) .then(function (response) { utils.writeJson(res, response); diff --git a/controllers/Spot.js b/controllers/Spot.js index b69e6db..9773d07 100644 --- a/controllers/Spot.js +++ b/controllers/Spot.js @@ -3,7 +3,7 @@ var utils = require('../utils/writer.js'); var Spot = require('../service/SpotService'); -module.exports.createSpot = function createSpot (_, res, _, body) { +module.exports.createSpot = function createSpot (_req, res, _next, body) { Spot.createSpot(body) .then(function (response) { utils.writeJson(res, response); @@ -13,7 +13,7 @@ module.exports.createSpot = function createSpot (_, res, _, body) { }); }; -module.exports.getSpots = function getSpots (_, res, _) { +module.exports.getSpots = function getSpots (__req, res,_next) { Spot.getSpots() .then(function (response) { utils.writeJson(res, response); @@ -23,7 +23,7 @@ module.exports.getSpots = function getSpots (_, res, _) { }); }; -module.exports.modifySpot = function modifySpot (_, res, _, body, address, type, charger, id) { +module.exports.modifySpot = function modifySpot (__req, res,_next, body, address, type, charger, id) { Spot.modifySpot(body, address, type, charger, id) .then(function (response) { utils.writeJson(res, response); @@ -33,7 +33,7 @@ module.exports.modifySpot = function modifySpot (_, res, _, body, address, type, }); }; -module.exports.removeSpot = function removeSpot (_, res, _, id) { +module.exports.removeSpot = function removeSpot (_req, res, _next, id) { Spot.removeSpot(id) .then(function (response) { utils.writeJson(res, response); @@ -43,7 +43,7 @@ module.exports.removeSpot = function removeSpot (_, res, _, id) { }); }; -module.exports.searchSpot = function searchSpot (_, res, _, address, type, charger) { +module.exports.searchSpot = function searchSpot (_req, res, _next, address, type, charger) { Spot.searchSpot(address, type, charger) .then(function (response) { utils.writeJson(res, response); diff --git a/controllers/SpotOwner.js b/controllers/SpotOwner.js index bbed7a2..72c5a5c 100644 --- a/controllers/SpotOwner.js +++ b/controllers/SpotOwner.js @@ -3,7 +3,7 @@ var utils = require('../utils/writer.js'); var SpotOwner = require('../service/SpotOwnerService'); -module.exports.addSpotOwner = function addSpotOwner (_, res, _, body) { +module.exports.addSpotOwner = function addSpotOwner (_req, res, _next, body) { SpotOwner.addSpotOwner(body) .then(function (response) { utils.writeJson(res, response); diff --git a/service/ReservationService.js b/service/ReservationService.js index 587e9a1..d7b9693 100644 --- a/service/ReservationService.js +++ b/service/ReservationService.js @@ -112,7 +112,7 @@ exports.makeReservation = function(body) { * id Integer * no response value expected for this operation **/ -exports.modifyReservation = function(body,spotId,userId,_ ,_ ,_,id) { +exports.modifyReservation = function(body,spotId,userId,_startTime ,_duration ,_date,id) { return new Promise(function(resolve, reject) { // // Η ημερομηνία της κράτησης πρεπει να είναι string (τύπος date) From 24c3d278851d092b9ec30dab7a629cac0758e9e3 Mon Sep 17 00:00:00 2001 From: anasgourd <151581241+anasgourd@users.noreply.github.com> Date: Sat, 21 Dec 2024 21:46:28 +0200 Subject: [PATCH 3/4] Updates for Remove Unused Variables --- controllers/LicensePlate.js | 4 ++-- controllers/Payment.js | 4 ++-- controllers/Reservation.js | 8 ++++---- controllers/Spot.js | 12 ++++++------ controllers/SpotOwner.js | 2 +- cypress.config.js | 4 ++-- service/LicensePlateService.js | 4 ++-- service/ReservationService.js | 5 ++--- service/SpotOwnerService.js | 2 +- service/SpotService.js | 4 ++-- 10 files changed, 24 insertions(+), 25 deletions(-) diff --git a/controllers/LicensePlate.js b/controllers/LicensePlate.js index ae53097..bbdb90a 100644 --- a/controllers/LicensePlate.js +++ b/controllers/LicensePlate.js @@ -3,7 +3,7 @@ var utils = require('../utils/writer.js'); var LicensePlate = require('../service/LicensePlateService'); -module.exports.modifyPlate = function modifyPlate (_req, res, _next, body) { +module.exports.modifyPlate = function modifyPlate (_,res,next,body) { LicensePlate.modifyPlate(body) .then(function (response) { utils.writeJson(res, response); @@ -13,7 +13,7 @@ module.exports.modifyPlate = function modifyPlate (_req, res, _next, body) { }); }; -module.exports.registerPlate = function registerPlate (_req, res, _next , body) { +module.exports.registerPlate = function registerPlate (_,res,next,body) { LicensePlate.registerPlate(body) .then(function (response) { utils.writeJson(res, response); diff --git a/controllers/Payment.js b/controllers/Payment.js index d182dca..6987b89 100644 --- a/controllers/Payment.js +++ b/controllers/Payment.js @@ -3,7 +3,7 @@ var utils = require('../utils/writer.js'); var Payment = require('../service/PaymentService'); -module.exports.makePayment = function makePayment (_req , res, _next , body) { +module.exports.makePayment = function makePayment (_ ,res,next, body) { Payment.makePayment(body) .then(function (response) { utils.writeJson(res, response); @@ -11,4 +11,4 @@ module.exports.makePayment = function makePayment (_req , res, _next , body) { .catch(function (response) { utils.writeJson(res, response); }); -}; +}; \ No newline at end of file diff --git a/controllers/Reservation.js b/controllers/Reservation.js index 612864e..015ea85 100644 --- a/controllers/Reservation.js +++ b/controllers/Reservation.js @@ -3,7 +3,7 @@ var utils = require('../utils/writer.js'); var Reservation = require('../service/ReservationService'); -module.exports.deleteReservation = function deleteReservation (_req, res, _next, id) { +module.exports.deleteReservation = function deleteReservation (_, res, next, id) { Reservation.deleteReservation(id) .then(function (response) { utils.writeJson(res, response); @@ -13,7 +13,7 @@ module.exports.deleteReservation = function deleteReservation (_req, res, _next, }); }; -module.exports.makeReservation = function makeReservation (_req, res, _next, body) { +module.exports.makeReservation = function makeReservation (_, res,next, body) { Reservation.makeReservation(body) .then(function (response) { utils.writeJson(res, response); @@ -23,7 +23,7 @@ module.exports.makeReservation = function makeReservation (_req, res, _next, bod }); }; -module.exports.modifyReservation = function modifyReservation (_req, res, _next, body, spotId, userId, startTime, duration, date, id) { +module.exports.modifyReservation = function modifyReservation (_, res, next, body, spotId, userId, startTime, duration, date, id) { Reservation.modifyReservation(body, spotId, userId, startTime, duration, date, id) .then(function (response) { utils.writeJson(res, response); @@ -31,4 +31,4 @@ module.exports.modifyReservation = function modifyReservation (_req, res, _next, .catch(function (response) { utils.writeJson(res, response); }); -}; +}; \ No newline at end of file diff --git a/controllers/Spot.js b/controllers/Spot.js index 9773d07..d44432a 100644 --- a/controllers/Spot.js +++ b/controllers/Spot.js @@ -3,7 +3,7 @@ var utils = require('../utils/writer.js'); var Spot = require('../service/SpotService'); -module.exports.createSpot = function createSpot (_req, res, _next, body) { +module.exports.createSpot = function createSpot (_, res, next, body) { Spot.createSpot(body) .then(function (response) { utils.writeJson(res, response); @@ -13,7 +13,7 @@ module.exports.createSpot = function createSpot (_req, res, _next, body) { }); }; -module.exports.getSpots = function getSpots (__req, res,_next) { +module.exports.getSpots = function getSpots (_, res,next) { Spot.getSpots() .then(function (response) { utils.writeJson(res, response); @@ -23,7 +23,7 @@ module.exports.getSpots = function getSpots (__req, res,_next) { }); }; -module.exports.modifySpot = function modifySpot (__req, res,_next, body, address, type, charger, id) { +module.exports.modifySpot = function modifySpot (_, res,next, body, address, type, charger, id) { Spot.modifySpot(body, address, type, charger, id) .then(function (response) { utils.writeJson(res, response); @@ -33,7 +33,7 @@ module.exports.modifySpot = function modifySpot (__req, res,_next, body, address }); }; -module.exports.removeSpot = function removeSpot (_req, res, _next, id) { +module.exports.removeSpot = function removeSpot (_, res, next, id) { Spot.removeSpot(id) .then(function (response) { utils.writeJson(res, response); @@ -43,7 +43,7 @@ module.exports.removeSpot = function removeSpot (_req, res, _next, id) { }); }; -module.exports.searchSpot = function searchSpot (_req, res, _next, address, type, charger) { +module.exports.searchSpot = function searchSpot (_, res, next, address, type, charger) { Spot.searchSpot(address, type, charger) .then(function (response) { utils.writeJson(res, response); @@ -51,4 +51,4 @@ module.exports.searchSpot = function searchSpot (_req, res, _next, address, type .catch(function (response) { utils.writeJson(res, response); }); -}; +}; \ No newline at end of file diff --git a/controllers/SpotOwner.js b/controllers/SpotOwner.js index 72c5a5c..a7dbb98 100644 --- a/controllers/SpotOwner.js +++ b/controllers/SpotOwner.js @@ -3,7 +3,7 @@ var utils = require('../utils/writer.js'); var SpotOwner = require('../service/SpotOwnerService'); -module.exports.addSpotOwner = function addSpotOwner (_req, res, _next, body) { +module.exports.addSpotOwner = function addSpotOwner (_, res, next, body) { SpotOwner.addSpotOwner(body) .then(function (response) { utils.writeJson(res, response); diff --git a/cypress.config.js b/cypress.config.js index 97f47c4..611afba 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -2,8 +2,8 @@ const { defineConfig } = require("cypress"); module.exports = defineConfig({ e2e: { - setupNodeEvents(on, config) { + setupNodeEvents(on,_ /*config*/) { // implement node event listeners here }, }, -}); +}); \ No newline at end of file diff --git a/service/LicensePlateService.js b/service/LicensePlateService.js index 5db813a..714c828 100644 --- a/service/LicensePlateService.js +++ b/service/LicensePlateService.js @@ -95,7 +95,7 @@ exports.registerPlate = function(body) { return new Promise((resolve, reject) => { // Μια ήδη καταχωρημένη πινακίδα μέσα στο σύστημα - var existingPlates = { + var _ = { "licensePlate": "AKH1314", // το όνομα της πινακίδας "id": 15, // το id της πινακίδας @@ -130,4 +130,4 @@ exports.registerPlate = function(body) { // } resolve(); }); -}; +}; \ No newline at end of file diff --git a/service/ReservationService.js b/service/ReservationService.js index d7b9693..6783e0e 100644 --- a/service/ReservationService.js +++ b/service/ReservationService.js @@ -9,7 +9,7 @@ * no response value expected for this operation **/ exports.deleteReservation = function(id) { - return new Promise(function(resolve, reject) { + return new Promise(function(resolve, _ /*reject*/) { resolve(); }); } @@ -112,7 +112,7 @@ exports.makeReservation = function(body) { * id Integer * no response value expected for this operation **/ -exports.modifyReservation = function(body,spotId,userId,_startTime ,_duration ,_date,id) { +exports.modifyReservation = function(body,spotId,userId,_ /*startTime*/ ,duration ,date,id) { return new Promise(function(resolve, reject) { // // Η ημερομηνία της κράτησης πρεπει να είναι string (τύπος date) @@ -182,4 +182,3 @@ exports.modifyReservation = function(body,spotId,userId,_startTime ,_duration ,_ resolve(); }); } - diff --git a/service/SpotOwnerService.js b/service/SpotOwnerService.js index fce6d6f..571b15f 100644 --- a/service/SpotOwnerService.js +++ b/service/SpotOwnerService.js @@ -13,7 +13,7 @@ exports.addSpotOwner = function(body) { return new Promise((resolve, reject) =>{ //SpotOwner = Ιδιοκτήτης θέσεων πάρκινγκ - var existingSpotOwners = { + var _ = { "id":1, // το id του ιδιοκτήτη θέσεων "idNumber": "AK1234", // ο αριθμός ταυτότητας του ιδιοκτήτη θέσεων "name":"John Doe", // ο ονοματεπώνυμο του ιδιοκτήτη diff --git a/service/SpotService.js b/service/SpotService.js index e7f24ac..69c709b 100644 --- a/service/SpotService.js +++ b/service/SpotService.js @@ -86,7 +86,7 @@ exports.createSpot = function (body) { * returns List **/ exports.getSpots = function () { - return new Promise(function (resolve, reject) { + return new Promise(function (resolve, _ /*reject*/) { var examples = {}; examples['application/json'] = [{ "address": "address", @@ -247,7 +247,7 @@ exports.modifySpot = function (body, address, type, charger, id) { * no response value expected for this operation **/ exports.removeSpot = function (id) { - return new Promise(function (resolve, reject) { + return new Promise(function (resolve, _ /*reject*/) { resolve(); }); } From d4dde859f1a963099fac390c00b061c52070de71 Mon Sep 17 00:00:00 2001 From: anasgourd <151581241+anasgourd@users.noreply.github.com> Date: Sun, 22 Dec 2024 13:16:56 +0200 Subject: [PATCH 4/4] Last changes for unused variables --- controllers/LicensePlate.js | 4 ++-- controllers/Payment.js | 2 +- controllers/Reservation.js | 6 +++--- controllers/Spot.js | 10 +++++----- controllers/SpotOwner.js | 2 +- cypress.config.js | 2 +- service/LicensePlateService.js | 8 -------- service/ReservationService.js | 4 ++-- service/SpotOwnerService.js | 12 +----------- 9 files changed, 16 insertions(+), 34 deletions(-) diff --git a/controllers/LicensePlate.js b/controllers/LicensePlate.js index bbdb90a..29f27d5 100644 --- a/controllers/LicensePlate.js +++ b/controllers/LicensePlate.js @@ -3,7 +3,7 @@ var utils = require('../utils/writer.js'); var LicensePlate = require('../service/LicensePlateService'); -module.exports.modifyPlate = function modifyPlate (_,res,next,body) { +module.exports.modifyPlate = function modifyPlate (_,res,__,body) { LicensePlate.modifyPlate(body) .then(function (response) { utils.writeJson(res, response); @@ -13,7 +13,7 @@ module.exports.modifyPlate = function modifyPlate (_,res,next,body) { }); }; -module.exports.registerPlate = function registerPlate (_,res,next,body) { +module.exports.registerPlate = function registerPlate (_,res,__,body) { LicensePlate.registerPlate(body) .then(function (response) { utils.writeJson(res, response); diff --git a/controllers/Payment.js b/controllers/Payment.js index 6987b89..9cb9fa0 100644 --- a/controllers/Payment.js +++ b/controllers/Payment.js @@ -3,7 +3,7 @@ var utils = require('../utils/writer.js'); var Payment = require('../service/PaymentService'); -module.exports.makePayment = function makePayment (_ ,res,next, body) { +module.exports.makePayment = function makePayment (_ ,res,__, body) { Payment.makePayment(body) .then(function (response) { utils.writeJson(res, response); diff --git a/controllers/Reservation.js b/controllers/Reservation.js index 015ea85..008f0d3 100644 --- a/controllers/Reservation.js +++ b/controllers/Reservation.js @@ -3,7 +3,7 @@ var utils = require('../utils/writer.js'); var Reservation = require('../service/ReservationService'); -module.exports.deleteReservation = function deleteReservation (_, res, next, id) { +module.exports.deleteReservation = function deleteReservation (_, res, __, id) { Reservation.deleteReservation(id) .then(function (response) { utils.writeJson(res, response); @@ -13,7 +13,7 @@ module.exports.deleteReservation = function deleteReservation (_, res, next, id) }); }; -module.exports.makeReservation = function makeReservation (_, res,next, body) { +module.exports.makeReservation = function makeReservation (_, res,__, body) { Reservation.makeReservation(body) .then(function (response) { utils.writeJson(res, response); @@ -23,7 +23,7 @@ module.exports.makeReservation = function makeReservation (_, res,next, body) { }); }; -module.exports.modifyReservation = function modifyReservation (_, res, next, body, spotId, userId, startTime, duration, date, id) { +module.exports.modifyReservation = function modifyReservation (_, res, __, body, spotId, userId, startTime, duration, date, id) { Reservation.modifyReservation(body, spotId, userId, startTime, duration, date, id) .then(function (response) { utils.writeJson(res, response); diff --git a/controllers/Spot.js b/controllers/Spot.js index d44432a..e91c50a 100644 --- a/controllers/Spot.js +++ b/controllers/Spot.js @@ -3,7 +3,7 @@ var utils = require('../utils/writer.js'); var Spot = require('../service/SpotService'); -module.exports.createSpot = function createSpot (_, res, next, body) { +module.exports.createSpot = function createSpot (_, res, __, body) { Spot.createSpot(body) .then(function (response) { utils.writeJson(res, response); @@ -13,7 +13,7 @@ module.exports.createSpot = function createSpot (_, res, next, body) { }); }; -module.exports.getSpots = function getSpots (_, res,next) { +module.exports.getSpots = function getSpots (_, res,__){ Spot.getSpots() .then(function (response) { utils.writeJson(res, response); @@ -23,7 +23,7 @@ module.exports.getSpots = function getSpots (_, res,next) { }); }; -module.exports.modifySpot = function modifySpot (_, res,next, body, address, type, charger, id) { +module.exports.modifySpot = function modifySpot (_, res,__, body, address, type, charger, id) { Spot.modifySpot(body, address, type, charger, id) .then(function (response) { utils.writeJson(res, response); @@ -33,7 +33,7 @@ module.exports.modifySpot = function modifySpot (_, res,next, body, address, typ }); }; -module.exports.removeSpot = function removeSpot (_, res, next, id) { +module.exports.removeSpot = function removeSpot (_, res, __, id) { Spot.removeSpot(id) .then(function (response) { utils.writeJson(res, response); @@ -43,7 +43,7 @@ module.exports.removeSpot = function removeSpot (_, res, next, id) { }); }; -module.exports.searchSpot = function searchSpot (_, res, next, address, type, charger) { +module.exports.searchSpot = function searchSpot (_, res, __, address, type, charger) { Spot.searchSpot(address, type, charger) .then(function (response) { utils.writeJson(res, response); diff --git a/controllers/SpotOwner.js b/controllers/SpotOwner.js index a7dbb98..f37a494 100644 --- a/controllers/SpotOwner.js +++ b/controllers/SpotOwner.js @@ -3,7 +3,7 @@ var utils = require('../utils/writer.js'); var SpotOwner = require('../service/SpotOwnerService'); -module.exports.addSpotOwner = function addSpotOwner (_, res, next, body) { +module.exports.addSpotOwner = function addSpotOwner (_, res, __, body){ SpotOwner.addSpotOwner(body) .then(function (response) { utils.writeJson(res, response); diff --git a/cypress.config.js b/cypress.config.js index 611afba..b1d06ac 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -2,7 +2,7 @@ const { defineConfig } = require("cypress"); module.exports = defineConfig({ e2e: { - setupNodeEvents(on,_ /*config*/) { + setupNodeEvents(_ ,__) { // implement node event listeners here }, }, diff --git a/service/LicensePlateService.js b/service/LicensePlateService.js index 714c828..9485919 100644 --- a/service/LicensePlateService.js +++ b/service/LicensePlateService.js @@ -93,14 +93,6 @@ exports.modifyPlate = function(body) { **/ exports.registerPlate = function(body) { return new Promise((resolve, reject) => { - - // Μια ήδη καταχωρημένη πινακίδα μέσα στο σύστημα - var _ = { - "licensePlate": "AKH1314", // το όνομα της πινακίδας - "id": 15, // το id της πινακίδας - - }; - if (!Number.isInteger(body.id) || body.id < 0) { //αν το id έχει μη έγκυρη τιμή τότε έχω σφάλμα με κωδικό σφάλματος 400 diff --git a/service/ReservationService.js b/service/ReservationService.js index 6783e0e..ba3a170 100644 --- a/service/ReservationService.js +++ b/service/ReservationService.js @@ -8,7 +8,7 @@ * id Integer * no response value expected for this operation **/ -exports.deleteReservation = function(id) { +exports.deleteReservation = function(_) { return new Promise(function(resolve, _ /*reject*/) { resolve(); }); @@ -112,7 +112,7 @@ exports.makeReservation = function(body) { * id Integer * no response value expected for this operation **/ -exports.modifyReservation = function(body,spotId,userId,_ /*startTime*/ ,duration ,date,id) { +exports.modifyReservation = function(body,spotId,userId,_ /*startTime*/ ,_duration ,_date,id) { return new Promise(function(resolve, reject) { // // Η ημερομηνία της κράτησης πρεπει να είναι string (τύπος date) diff --git a/service/SpotOwnerService.js b/service/SpotOwnerService.js index 571b15f..3131a04 100644 --- a/service/SpotOwnerService.js +++ b/service/SpotOwnerService.js @@ -12,17 +12,7 @@ exports.addSpotOwner = function(body) { return new Promise((resolve, reject) =>{ - //SpotOwner = Ιδιοκτήτης θέσεων πάρκινγκ - var _ = { - "id":1, // το id του ιδιοκτήτη θέσεων - "idNumber": "AK1234", // ο αριθμός ταυτότητας του ιδιοκτήτη θέσεων - "name":"John Doe", // ο ονοματεπώνυμο του ιδιοκτήτη - "email":"johhdoe@gmail.com", // το email του ιδιοκτήτη - "phone":"1234567890",// το τηλέφωνο του ιδιοκτήτη - "spots":[] // οι θέσεις του ιδιοκτήτη - }; - - + if (!body.id || body.id < 0) { //αν το id έχει μη έγκυρη τιμή τότε έχω σφάλμα με κωδικό σφάλματος 400 const error = new Error("Invalid id: must be a positive integer.");