Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bdc8d9a8e0 |
No files matched your search
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "multi-stub",
|
"name": "multi-stub",
|
||||||
"version": "1.2.0",
|
"version": "1.1.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "multi-stub",
|
"name": "multi-stub",
|
||||||
"version": "1.2.0",
|
"version": "1.1.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^1.7.9",
|
"axios": "^1.7.9",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "multi-stub",
|
"name": "multi-stub",
|
||||||
"version": "1.2.0",
|
"version": "1.1.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
+1
-1
@@ -88,7 +88,7 @@ app.use("/dry-wash", require("./routers/dry-wash"))
|
|||||||
app.use("/freetracker", require("./routers/freetracker"))
|
app.use("/freetracker", require("./routers/freetracker"))
|
||||||
app.use("/dhs-testing", require("./routers/dhs-testing"))
|
app.use("/dhs-testing", require("./routers/dhs-testing"))
|
||||||
app.use("/gamehub", require("./routers/gamehub"))
|
app.use("/gamehub", require("./routers/gamehub"))
|
||||||
app.use("/esc", require("./routers/esc"))
|
|
||||||
|
|
||||||
app.use(require("./error"))
|
app.use(require("./error"))
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,40 @@
|
|||||||
const router = require('express').Router()
|
const router = require('express').Router()
|
||||||
const {MasterModel} = require('./model/master')
|
const {MasterModel} = require('./model/master')
|
||||||
const mongoose = require("mongoose")
|
const mongoose = require("mongoose")
|
||||||
|
const {OrderModel} = require("./model/order")
|
||||||
|
|
||||||
|
|
||||||
router.get('/masters', async (req, res,next) => {
|
router.get("/masters", async (req, res, next) => {
|
||||||
try {
|
try {
|
||||||
const master = await MasterModel.find({})
|
const masters = await MasterModel.find({});
|
||||||
res.status(200).send({success: true, body: master})
|
const orders = await OrderModel.find({});
|
||||||
|
|
||||||
|
const mastersWithOrders = masters.map((master) => {
|
||||||
|
const masterOrders = orders.filter((order) => {
|
||||||
|
return (
|
||||||
|
order?.master && order.master.toString() === master._id.toString()
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
const schedule = masterOrders.map((order) => ({
|
||||||
|
id: order._id,
|
||||||
|
startWashTime: order.startWashTime,
|
||||||
|
endWashTime: order.endWashTime,
|
||||||
|
}));
|
||||||
|
|
||||||
|
return {
|
||||||
|
id: master._id,
|
||||||
|
name: master.name,
|
||||||
|
schedule: schedule,
|
||||||
|
phone: master.phone,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
res.status(200).send({ success: true, body: mastersWithOrders });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
next(error)
|
next(error);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
router.delete('/masters/:id', async (req, res,next) => {
|
router.delete('/masters/:id', async (req, res,next) => {
|
||||||
const { id } = req.params;
|
const { id } = req.params;
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
const router = require("express").Router();
|
|
||||||
|
|
||||||
router.get('/game-links', (request, response) => {
|
|
||||||
response.send(require('./json/game-links/success.json'))
|
|
||||||
})
|
|
||||||
|
|
||||||
router.get('/4u2k-links', (request, response) => {
|
|
||||||
response.send(require('./json/4u2k-links/success.json'))
|
|
||||||
})
|
|
||||||
;
|
|
||||||
|
|
||||||
module.exports = router;
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
{
|
|
||||||
"data":[
|
|
||||||
{
|
|
||||||
"type": "video",
|
|
||||||
"links": {
|
|
||||||
"l1": "https://www.youtube.com/embed/DsQMLrPdLf8?si=l9X57nHqaSYlxDFf",
|
|
||||||
"l2": "https://www.youtube.com/embed/Dk8AAU_UdVk?si=N8NdYMUCfawdsJGE",
|
|
||||||
"l3": "https://www.youtube.com/embed/HKfDfWrCwEA?si=qPugjiKR8V9eZ-yG",
|
|
||||||
"l4": "https://www.youtube.com/embed/tD-6xHAHrQ4?si=ZFe41gSK8d5gqahW"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "podcast",
|
|
||||||
"links": {
|
|
||||||
"l1": "https://www.youtube.com/embed/RtVs87Nd1MQ?si=i4giUCtbp4Ouqv2W",
|
|
||||||
"l2": "https://www.youtube.com/embed/DfTU5LA_kw8?si=m7fI5Ie9yIGDFCrU",
|
|
||||||
"l3": "https://www.youtube.com/embed/Sp-1fX1Q15I?si=xyealVly9IBMW7Xi",
|
|
||||||
"l4": "https://www.youtube.com/embed/rLYFJYfluRs?si=MjW1beQ-Q9-TAehF"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "entertainment",
|
|
||||||
"links": {
|
|
||||||
"l1": "https://www.youtube.com/embed/DiuuglRCchQ?si=8wTVXKbV-mbHuSjW",
|
|
||||||
"l2": "https://www.youtube.com/embed/zmZcIX5PEyo?si=Hbrv32kl0fqcmtV9",
|
|
||||||
"l3": "https://www.youtube.com/embed/Te-TZUjmzFQ?si=fNG16eruoFEY2KNq",
|
|
||||||
"l4": "https://www.youtube.com/embed/si-MQ5qg3zE?si=67mfO6gV80n1ULqo"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
{
|
|
||||||
"data":[
|
|
||||||
{
|
|
||||||
"title": "ABC",
|
|
||||||
"description": "Мой брат Колян сбацал про меня байку на англицком и несколько фишек кинул для шухера. Англицкий ты вроде знаешь, впряжешься за меня, а?",
|
|
||||||
"link": "https://www.oxfordonlineenglish.com/english-level-test/reading"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "Алё, меня слышно?",
|
|
||||||
"description": "Мой кент на мобилу текст записал с иностранкой. Понимаешь, о чём тут говорят?",
|
|
||||||
"link": "https://test-english.com/listening/"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "Анонимное тестирование",
|
|
||||||
"description": "Ты язык-то нормально знаешь? Проверься, никто угарать не будет",
|
|
||||||
"link": "https://www.ego4u.com/en/cram-up/tests"
|
|
||||||
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
exports.KAZAN_EXPLORE_RESULTS_MODEL_NAME = 'KAZAN_EXPLORE_RESULTS'
|
|
||||||
|
|
||||||
exports.TOKEN_KEY = "KAZAN_EXPLORE_TOP_SECRET_TOKEN_KEY"
|
|
||||||
@@ -1,54 +1,15 @@
|
|||||||
const router = require('express').Router();
|
const router = require('express').Router();
|
||||||
const { ResultsModel } = require('./model/results')
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
router.get('/getQuizResults/:userId', async (request, response) => {
|
|
||||||
const { userId } = request.params;
|
|
||||||
|
|
||||||
try {
|
|
||||||
const results = await ResultsModel.findOne({ userId : userId }).exec();
|
|
||||||
|
|
||||||
if (!results) {
|
|
||||||
return response.status(404).send({ message: 'Quiz results not found' });
|
|
||||||
}
|
|
||||||
|
|
||||||
response.send(results.items);
|
|
||||||
} catch (error) {
|
|
||||||
response.status(500).send({ message: 'An error occurred while fetching quiz results' });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
router.post('/addQuizResult', async (request, response) => {
|
|
||||||
const { userId, quizId, result } = request.body;
|
|
||||||
|
|
||||||
if (!userId || !quizId || !result) {
|
|
||||||
return response.status(400).send({ message: 'Invalid input data' });
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
let userResults = await ResultsModel.findOne({ userId : userId }).exec();
|
|
||||||
if (!userResults) {
|
|
||||||
userResults = new ResultsModel({ userId, items: [] });
|
|
||||||
}
|
|
||||||
userResults.items.push({ quizId, result });
|
|
||||||
await userResults.save();
|
|
||||||
|
|
||||||
response.status(200).send({ message: 'Quiz result added successfully', data: userResults });
|
|
||||||
} catch (error) {
|
|
||||||
response.status(500).send({ message: 'An error occurred while adding quiz result' });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
// First page
|
// First page
|
||||||
router.get('/getInfoAboutKazan', (request, response) => {
|
router.get('/getInfoAboutKazan', (request, response) => {
|
||||||
const lang = request.query.lang || 'ru';
|
const lang = request.query.lang || 'ru'; // Получаем язык из параметров запроса
|
||||||
try {
|
try {
|
||||||
const data = require('./json/first/info-about-kazan/success.json');
|
const data = require('./json/first/info-about-kazan/success.json'); // Загружаем весь JSON
|
||||||
const translatedData = data[lang] || data['ru'];
|
const translatedData = data[lang] || data['ru']; // Выбираем перевод по языку или дефолтный
|
||||||
response.send(translatedData);
|
response.send(translatedData); // Отправляем перевод клиенту
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
response.status(500).send({ message: 'Internal server error' });
|
response.status(500).send({ message: 'Internal server error' }); // Ошибка в случае проблем с JSON
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -64,13 +25,13 @@ router.get('/getNews', (request, response) => {
|
|||||||
|
|
||||||
// Sport page
|
// Sport page
|
||||||
router.get('/getFirstText', (request, response) => {
|
router.get('/getFirstText', (request, response) => {
|
||||||
const lang = request.query.lang || 'ru';
|
const lang = request.query.lang || 'ru'; // Получаем язык из параметров
|
||||||
try {
|
try {
|
||||||
const data = require('./json/sport/first-text/success.json');
|
const data = require('./json/sport/first-text/success.json'); // Загружаем JSON
|
||||||
const translatedData = data[lang] || data['ru'];
|
const translatedData = data[lang] || data['ru']; // Берём перевод или дефолтный
|
||||||
response.send(translatedData);
|
response.send(translatedData);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
response.status(404).send({ message: 'Language not found' });
|
response.status(404).send({ message: 'Language not found' }); // Обработка ошибки
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
const { Schema, model } = require('mongoose')
|
|
||||||
|
|
||||||
const { KAZAN_EXPLORE_RESULTS_MODEL_NAME } = require('../const')
|
|
||||||
|
|
||||||
const schema = new Schema({
|
|
||||||
userId: { type: String },
|
|
||||||
items: [
|
|
||||||
{
|
|
||||||
quizId: { type: String },
|
|
||||||
result: { type: Number }
|
|
||||||
}
|
|
||||||
]
|
|
||||||
})
|
|
||||||
|
|
||||||
schema.set('toJSON', {
|
|
||||||
virtuals: true,
|
|
||||||
versionKey: false,
|
|
||||||
transform: function (doc, ret) {
|
|
||||||
delete ret._id
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
schema.virtual('id').get(function () {
|
|
||||||
return this._id.toHexString()
|
|
||||||
})
|
|
||||||
|
|
||||||
exports.ResultsModel = model(KAZAN_EXPLORE_RESULTS_MODEL_NAME, schema)
|
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loaded 100 of 301 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user