Compare commits
1 Commits
a9673b260f
...
connectme-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8ee5ca5528 |
@@ -89,6 +89,7 @@ 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("/esc", require("./routers/esc"))
|
||||||
|
app.use('/connectme', require('./routers/connectme'))
|
||||||
|
|
||||||
app.use(require("./error"))
|
app.use(require("./error"))
|
||||||
|
|
||||||
|
|||||||
8
server/routers/connectme/index.js
Normal file
8
server/routers/connectme/index.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
const { Router } = require('express')
|
||||||
|
const router = Router()
|
||||||
|
|
||||||
|
router.get('/cities', (request, response) => {
|
||||||
|
response.send(require('./json/cities.json'))
|
||||||
|
})
|
||||||
|
|
||||||
|
module.exports = router
|
||||||
85
server/routers/connectme/json/cities.json
Normal file
85
server/routers/connectme/json/cities.json
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
{
|
||||||
|
"data": [
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"title": "Моска"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 2,
|
||||||
|
"title": "Санкт-петербург"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 3,
|
||||||
|
"title": "Новосибирска"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 4,
|
||||||
|
"title": "Екатеринбург"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 5,
|
||||||
|
"title": "Казань"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 6,
|
||||||
|
"title": "Нижний новгород"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 7,
|
||||||
|
"title": "Челябинск"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 8,
|
||||||
|
"title": "Самара"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 9,
|
||||||
|
"title": "Омск"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 10,
|
||||||
|
"title": "Ростов-на-дону"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 11,
|
||||||
|
"title": "Уфа"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 12,
|
||||||
|
"title": "Красноярск"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 13,
|
||||||
|
"title": "Пермь"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 14,
|
||||||
|
"title": "Воронеж"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 15,
|
||||||
|
"title": "Волгоград"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 16,
|
||||||
|
"title": "Краснодар"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 17,
|
||||||
|
"title": "Тюмень"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 18,
|
||||||
|
"title": "Ижевск"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 19,
|
||||||
|
"title": "Барнаул"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 20,
|
||||||
|
"title": "Владивосток"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"count": 20
|
||||||
|
}
|
||||||
@@ -27,12 +27,10 @@ router.post('/:user_id/:action/:id', (req, res) => {
|
|||||||
const user_id = parseInt(req.params.user_id);
|
const user_id = parseInt(req.params.user_id);
|
||||||
const id = parseInt(req.params.id);
|
const id = parseInt(req.params.id);
|
||||||
const action = req.params.action;
|
const action = req.params.action;
|
||||||
/*
|
|
||||||
if (users_data.findIndex((item) => item.id === user_id) === -1 || data.findIndex((item) => item.id === id) === -1) {
|
if (users_data.findIndex((item) => item.id === user_id) === -1 || data.findIndex((item) => item.id === id) === -1) {
|
||||||
res.status(404).send();
|
res.status(404).send();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
if (action !== 'participate' && action !== 'refuse') {
|
if (action !== 'participate' && action !== 'refuse') {
|
||||||
res.status(400).send({ error: 'Invalid action' });
|
res.status(400).send({ error: 'Invalid action' });
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -10,17 +10,6 @@
|
|||||||
"Музыка"
|
"Музыка"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"id": 1252744945,
|
|
||||||
"username": "Моряков Сергей",
|
|
||||||
"photo": "",
|
|
||||||
"about": "Люблю путешествия и фотографию, обожаю изучать новые культуры.",
|
|
||||||
"email": "sergey.moryakov@example.com",
|
|
||||||
"interests": [
|
|
||||||
"Путешествия и туризм",
|
|
||||||
"Искусство, фотография и дизайн"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"id": 2,
|
"id": 2,
|
||||||
"username": "Мария Смирнова",
|
"username": "Мария Смирнова",
|
||||||
@@ -229,5 +218,16 @@
|
|||||||
"Медицина и здоровье",
|
"Медицина и здоровье",
|
||||||
"Спорт, фитнес и ЗОЖ"
|
"Спорт, фитнес и ЗОЖ"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 1252744945,
|
||||||
|
"username": "Моряков Сергей",
|
||||||
|
"photo": "https://i.pravatar.cc/150?img=50",
|
||||||
|
"about": "Люблю путешествия и фотографию, обожаю изучать новые культуры.",
|
||||||
|
"email": "maria.smirnova@example.com",
|
||||||
|
"interests": [
|
||||||
|
"Путешествия и туризм",
|
||||||
|
"Искусство, фотография и дизайн"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -27,12 +27,10 @@ router.post('/:to_id/:action/:from_id', (req, res) => {
|
|||||||
const to_id = parseInt(req.params.to_id);
|
const to_id = parseInt(req.params.to_id);
|
||||||
const from_id = parseInt(req.params.from_id);
|
const from_id = parseInt(req.params.from_id);
|
||||||
const action = req.params.action;
|
const action = req.params.action;
|
||||||
/*
|
|
||||||
if (data.findIndex((item) => item.id === to_id) === -1 || data.findIndex((item) => item.id === from_id) === -1) {
|
if (data.findIndex((item) => item.id === to_id) === -1 || data.findIndex((item) => item.id === from_id) === -1) {
|
||||||
res.status(404).send();
|
res.status(404).send();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
if (action !== 'like' && action !== 'dislike') {
|
if (action !== 'like' && action !== 'dislike') {
|
||||||
res.status(400).send({ error: 'Invalid action' });
|
res.status(400).send({ error: 'Invalid action' });
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user