diff --git a/app/src/main/java/com/example/myapplication/api/MyServerService.kt b/app/src/main/java/com/example/myapplication/api/MyServerService.kt index b8be1d6..7a8e222 100644 --- a/app/src/main/java/com/example/myapplication/api/MyServerService.kt +++ b/app/src/main/java/com/example/myapplication/api/MyServerService.kt @@ -150,7 +150,7 @@ interface MyServerService { //Раздача с тлф private const val BASE_URL = "http://192.168.138.47:8079/" //Пк дома -/* private const val BASE_URL = "http://192.168.0.104:8079/"*/ + /*private const val BASE_URL = "http://192.168.0.104:8079/"*/ //private const val BASE_URL = "http://10.0.2.2:8079/" @Volatile diff --git a/server/data.json b/server/data.json index b996f4e..331e453 100644 --- a/server/data.json +++ b/server/data.json @@ -4,7 +4,14 @@ "id": 1, "login": "admin", "role": "admin", - "password": "admin" + "password": "admin", + "items": [ + { + "id": 7, + "count": 5, + "bikeId": 8 + } + ] }, { "id": 2, @@ -116,10 +123,19 @@ "id": 7, "dateTime": 2030, "weight": 10, - "radius": 20, + "radius": 30, "colorbike": "Красный", "maxCount": 10, "bikeId": 8 + }, + { + "dateTime": 2003, + "weight": 15.7, + "radius": 16.5, + "colorbike": "Жёлтый", + "maxCount": 10, + "bikeId": 7, + "id": 8 } ], "bikes": [ diff --git a/server/router.js b/server/router.js index ba6f8f5..d2db700 100644 --- a/server/router.js +++ b/server/router.js @@ -3,6 +3,8 @@ const data = require('./data.json'); module.exports = (req, res, next) => { if (req.url.startsWith('/search') && req.method === 'GET') { try { + delete require.cache[require.resolve('./data.json')]; + const data = require('./data.json'); const searchText = req.query.name; const searched = data.products.filter( (product) => @@ -15,6 +17,8 @@ module.exports = (req, res, next) => { } } else if (req.url.startsWith('/report') && req.method === 'GET') { try { + delete require.cache[require.resolve('./data.json')]; + const data = require('./data.json'); // Добавляем фильтрацию по полю dateTime const fromDate = req.query.fromDate; const toDate = req.query.toDate;