Merge branch 'master' of ssh://85.143.175.152:222/bro-students/multy-stub

This commit is contained in:
RustamRu 2025-01-18 22:58:00 +03:00
commit 17c63e6fe0
968 changed files with 439 additions and 128 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "multi-stub", "name": "multi-stub",
"version": "1.0.1", "version": "1.1.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "multi-stub", "name": "multi-stub",
"version": "1.0.1", "version": "1.1.0",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"axios": "^1.7.9", "axios": "^1.7.9",

View File

@ -1,6 +1,6 @@
{ {
"name": "multi-stub", "name": "multi-stub",
"version": "1.0.1", "version": "1.1.0",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View File

@ -2,5 +2,6 @@ const router = require('express').Router();
router.use('/performer', require('./dashboard-performer')) router.use('/performer', require('./dashboard-performer'))
router.use('/auth', require('./auth')) router.use('/auth', require('./auth'))
router.use('/landing', require('./landing'))
module.exports = router; module.exports = router;

View File

@ -0,0 +1,29 @@
const Router = require('express').Router;
const router = Router()
const values = {
'blocks': 'success',
'application': 'success'
}
const timer = (_req, _res, next) => {
setTimeout(() => next(), 500)
}
router.use(timer)
router.get(
'/blocks',
(req, res) =>
res.send(require(`./json/blocks-${values['blocks']}.json`))
)
router.post(
'/application',
(req, res) => {
res.send(require(`./json/application-${values['application']}.json`))
}
)
module.exports = router

View File

@ -0,0 +1,7 @@
{
"success": false,
"body": { },
"errors": [
"Что-то пошло не так"
]
}

View File

@ -0,0 +1,4 @@
{
"success": true,
"body": { }
}

View File

@ -0,0 +1,9 @@
{
"success": false,
"body": {
"blocks": []
},
"errors": [
"Что-то пошло не так"
]
}

View File

@ -0,0 +1,22 @@
{
"success": true,
"body": {
"blocks": [
{
"titleKey":"block1.title",
"textKey":"block1.subtitle",
"imageName":"truck1"
},
{
"titleKey":"block2.title",
"textKey":"block2.subtitle",
"imageName":"truck2"
},
{
"titleKey":"block3.title",
"textKey":"block3.subtitle",
"imageName":"truck3"
}
]
}
}

View File

@ -4,6 +4,10 @@ router.get("/game-page", (request, response) => {
response.send(require("./json/gamepage/success.json")); response.send(require("./json/gamepage/success.json"));
}); });
router.get("/update-like", (request, response) => {
response.send(require("./json/gamepage/success.json"));
});
router.get("/categories", (request, response) => { router.get("/categories", (request, response) => {
response.send(require("./json/categories/success.json")); response.send(require("./json/categories/success.json"));
}); });
@ -20,4 +24,69 @@ router.get("/all-games", (request, response) => {
response.send(require("./json/home-page-data/all-games.json")); response.send(require("./json/home-page-data/all-games.json"));
}); });
// // Маршрут для обновления лайков
// router.post("/update-like", (request, response) => {
// const { username, likes } = request.body;
// // Эмулируем успешное обновление лайков
// console.log(`Лайки для пользователя ${username} обновлены до ${likes}`);
// response.status(200).json({
// success: true,
// message: `Лайки для пользователя ${username} обновлены до ${likes}`,
// });
// });
const fs = require("fs").promises;
const path = require("path");
// Path to JSON file
const commentsFilePath = path.join(__dirname, "./json/gamepage/success.json");
// Read JSON file
async function readComments() {
const data = await fs.readFile(commentsFilePath, "utf-8");
const parsedData = JSON.parse(data);
console.log("Прочитанные данные:", parsedData); // Логируем полученные данные
return parsedData;
}
// Write to JSON file
async function writeComments(data) {
await fs.writeFile(commentsFilePath, JSON.stringify(data, null, 2), "utf-8");
}
// Update likes route
router.post("/update-like", async (req, res) => {
const { username, likes } = req.body;
if (!username || likes === undefined) {
return res.status(400).json({ success: false, message: "Invalid input" });
}
try {
const data = await readComments();
const comment = data.data.comments.find((c) => c.username === username);
if (comment) {
comment.likes = likes;
await writeComments(data); // Сохраняем обновленные данные в файл
// Возвращаем актуализированные данные
res.status(200).json({
success: true,
message: "Likes updated successfully",
data: data.data, // Возвращаем актуализированные данные
});
} else {
res.status(404).json({ success: false, message: "Comment not found" });
}
} catch (error) {
console.error("Error updating likes:", error);
res.status(500).json({ success: false, message: "Server error" });
}
});
module.exports = router; module.exports = router;

View File

@ -8,14 +8,18 @@
"price": 259, "price": 259,
"old_price": 500, "old_price": 500,
"image": "sales_game1", "image": "sales_game1",
"os": "windows" "os": "windows",
"fav1": "star1",
"fav2": "star2"
}, },
{ {
"id": 2, "id": 2,
"title": "Red Solstice 2 Survivors", "title": "Red Solstice 2 Survivors",
"price": 561, "price": 561,
"image": "sales_game2", "image": "sales_game2",
"os": "windows" "os": "windows",
"fav1": "star1",
"fav2": "star2"
}, },
{ {
"id": 3, "id": 3,
@ -23,7 +27,9 @@
"price": 820, "price": 820,
"old_price": 1100, "old_price": 1100,
"image": "new_game2", "image": "new_game2",
"os": "windows" "os": "windows",
"fav1": "star1",
"fav2": "star2"
}, },
{ {
"id": 4, "id": 4,
@ -31,7 +37,9 @@
"price": 990, "price": 990,
"old_price": 1200, "old_price": 1200,
"image": "leaders_game4", "image": "leaders_game4",
"os": "windows" "os": "windows",
"fav1": "star1",
"fav2": "star2"
}, },
{ {
"id": 5, "id": 5,
@ -39,7 +47,9 @@
"price": 1200, "price": 1200,
"old_price": 2500, "old_price": 2500,
"image": "leaders_game5", "image": "leaders_game5",
"os": "windows" "os": "windows",
"fav1": "star1",
"fav2": "star2"
}, },
{ {
"id": 6, "id": 6,
@ -47,31 +57,39 @@
"price": 600, "price": 600,
"old_price": 890, "old_price": 890,
"image": "leaders_game6", "image": "leaders_game6",
"os": "windows" "os": "windows",
"fav1": "star1",
"fav2": "star2"
} }
], ],
"games2": [ "games2": [
{ {
"id": 1, "id": 7,
"title": "Alpha League", "title": "Alpha League",
"price": 299, "price": 299,
"image": "new_game1", "image": "new_game1",
"os": "windows" "os": "windows",
"fav1": "star1",
"fav2": "star2"
}, },
{ {
"id": 2, "id": 8,
"title": "Sons Of The Forests", "title": "Sons Of The Forests",
"price": 820, "price": 820,
"old_price": 1100, "old_price": 1100,
"image": "new_game2", "image": "new_game2",
"os": "windows" "os": "windows",
"fav1": "star1",
"fav2": "star2"
}, },
{ {
"id": 3, "id": 9,
"title": "Pacific Drives", "title": "Pacific Drives",
"price": 1799, "price": 1799,
"image": "new_game3", "image": "new_game3",
"os": "windows" "os": "windows",
"fav1": "star1",
"fav2": "star2"
}, },
{ {
"id": 4, "id": 4,
@ -79,7 +97,9 @@
"price": 990, "price": 990,
"old_price": 1200, "old_price": 1200,
"image": "leaders_game4", "image": "leaders_game4",
"os": "windows" "os": "windows",
"fav1": "star1",
"fav2": "star2"
}, },
{ {
"id": 5, "id": 5,
@ -87,7 +107,9 @@
"price": 1200, "price": 1200,
"old_price": 2500, "old_price": 2500,
"image": "leaders_game5", "image": "leaders_game5",
"os": "windows" "os": "windows",
"fav1": "star1",
"fav2": "star2"
}, },
{ {
"id": 6, "id": 6,
@ -95,31 +117,39 @@
"price": 600, "price": 600,
"old_price": 890, "old_price": 890,
"image": "leaders_game6", "image": "leaders_game6",
"os": "windows" "os": "windows",
"fav1": "star1",
"fav2": "star2"
} }
], ],
"games3": [ "games3": [
{ {
"id": 1, "id": 10,
"title": "Elden Ring", "title": "Elden Ring",
"price": 3295, "price": 3295,
"old_price": 3599, "old_price": 3599,
"image": "leaders_game2", "image": "leaders_game2",
"os": "windows" "os": "windows",
"fav1": "star1",
"fav2": "star2"
}, },
{ {
"id": 2, "id": 11,
"title": "Counter-Strike 2", "title": "Counter-Strike 2",
"price": 479, "price": 479,
"image": "leaders_game1", "image": "leaders_game1",
"os": "windows" "os": "windows",
"fav1": "star1",
"fav2": "star2"
}, },
{ {
"id": 3, "id": 12,
"title": "PUBG: BATTLEGROUNDS", "title": "PUBG: BATTLEGROUNDS",
"price": 199, "price": 199,
"image": "leaders_game3", "image": "leaders_game3",
"os": "windows" "os": "windows",
"fav1": "star1",
"fav2": "star2"
}, },
{ {
"id": 4, "id": 4,
@ -127,7 +157,9 @@
"price": 990, "price": 990,
"old_price": 1200, "old_price": 1200,
"image": "leaders_game4", "image": "leaders_game4",
"os": "windows" "os": "windows",
"fav1": "star1",
"fav2": "star2"
}, },
{ {
"id": 5, "id": 5,
@ -135,7 +167,9 @@
"price": 1200, "price": 1200,
"old_price": 2500, "old_price": 2500,
"image": "leaders_game5", "image": "leaders_game5",
"os": "windows" "os": "windows",
"fav1": "star1",
"fav2": "star2"
}, },
{ {
"id": 6, "id": 6,
@ -143,7 +177,9 @@
"price": 600, "price": 600,
"old_price": 890, "old_price": 890,
"image": "leaders_game6", "image": "leaders_game6",
"os": "windows" "os": "windows",
"fav1": "star1",
"fav2": "star2"
} }
] ]
} }

View File

@ -4,21 +4,32 @@
"comments": [ "comments": [
{ {
"username": ользователь1", "username": ользователь1",
"text": "Текст комментария 1" "text": "Текст комментария 1",
"likes": 9,
"rating": 8,
"date": "2025-03-01T10:00:00Z"
}, },
{ {
"username": ользователь2", "username": ользователь2",
"text": "Текст комментария 2" "text": "Текст комментария 2",
"likes": 7,
"rating": 7,
"date": "2025-01-01T10:00:00Z"
}, },
{ {
"username": ользователь3", "username": ользователь3",
"text": "Текст комментария 3" "text": "Текст комментария 3",
"likes": 5,
"rating": 3,
"date": "2025-02-01T10:00:00Z"
}, },
{ {
"username": ользователь4", "username": ользователь4",
"text": "Текст комментария 4" "text": "Текст комментария 4",
"likes": 15,
"rating": 2,
"date": "2025-12-01T10:00:00Z"
} }
] ]
} }
} }

View File

@ -27,7 +27,7 @@ router.put('/new', (req, res) => {
return res.status(500).send('No data to update'); // Internal server error return res.status(500).send('No data to update'); // Internal server error
} }
indexedUpdatedData = { id: data.length, ...updatedData }; // Add the new dictionary to the array const indexedUpdatedData = { id: data.length, ...updatedData }; // Add the new dictionary to the array
data.push(indexedUpdatedData); // Add the new dictionary to the array data.push(indexedUpdatedData); // Add the new dictionary to the array

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 470 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 578 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 481 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 368 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 593 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 539 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 414 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 414 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 739 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 686 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 750 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 687 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 706 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 776 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 628 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 742 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 853 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 911 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 601 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 648 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 709 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 442 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 858 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 718 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1015 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 811 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 872 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 659 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 767 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 719 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 812 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 760 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 955 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 908 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1016 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 997 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 856 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 693 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 711 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 952 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 843 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 951 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 967 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 923 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 725 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 935 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 820 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 841 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1006 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 949 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 930 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 782 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 855 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 809 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 837 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 760 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1020 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1015 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 758 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 771 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Some files were not shown because too many files have changed in this diff Show More