Compare commits

..

No commits in common. "02eb0e60b777fa12fdaee319caf3d2ca3c85ac4d" and "66a48d1c7e3dff3bb1294a96500e5c9bc56158c6" have entirely different histories.

View File

@ -73,7 +73,7 @@ router.get("/auth/session", (request, response) => {
router.get("/interactions/check", (req, res) => {
const { owner_id, dogsitter_id } = req.query;
const usersFilePath = path.resolve(__dirname, "./json/users/users.json");
const usersFilePath = path.resolve(__dirname, "../json/users/success.json");
delete require.cache[require.resolve(usersFilePath)];
const usersFile = require(usersFilePath);
@ -97,7 +97,7 @@ router.post("/interactions", (req, res) => {
return res.status(400).json({ error: "Missing required fields" });
}
const usersFilePath = path.resolve(__dirname, "./json/users/users.json");
const usersFilePath = path.resolve(__dirname, "../json/users/success.json");
delete require.cache[require.resolve(usersFilePath)];
const usersFile = require(usersFilePath);
@ -138,7 +138,7 @@ router.get("/dogsitter-viewing", (req, res) => {
const { id } = req.query;
console.log(`Получен запрос для dogsitter с ID: ${id}`);
const usersFile = require("./json/users/users.json");
const usersFile = require(`../json/users/${stubs.users}.json`);
const users = usersFile.data; // Извлекаем массив из свойства "data"
const user = users.find((user) => user.id === Number(id));
@ -162,7 +162,7 @@ router.post('/dogsitter-viewing/rating/:id', (req, res) => {
return res.status(400).json({ error: 'Некорректная оценка' });
}
const usersFilePath = path.resolve(__dirname, "./json/users/users.json");
const usersFilePath = path.resolve(__dirname, '../json/users/success.json');
delete require.cache[require.resolve(usersFilePath)];
const usersFile = require(usersFilePath);
@ -200,7 +200,7 @@ router.patch('/users/:id', (req, res) => {
console.log('Полученные данные для обновления:', updateData);
const usersFilePath = path.resolve(__dirname, "./json/users/users.json");
const usersFilePath = path.resolve(__dirname, '../json/users/success.json');
delete require.cache[require.resolve(usersFilePath)];
const usersFile = require(usersFilePath);