Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
359a136dbf |
No files matched your search
+1
-2
@@ -12,8 +12,7 @@ services:
|
|||||||
# ports:
|
# ports:
|
||||||
# - 27017:27017
|
# - 27017:27017
|
||||||
multy-stubs:
|
multy-stubs:
|
||||||
# build: .
|
build: .
|
||||||
image: bro.js/ms/bh:$TAG
|
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
- 8044:8044
|
- 8044:8044
|
||||||
|
|||||||
@@ -44,8 +44,6 @@ app.use(require('./root'))
|
|||||||
*/
|
*/
|
||||||
app.use('/epja-2024-1', require('./routers/epja-2024-1'))
|
app.use('/epja-2024-1', require('./routers/epja-2024-1'))
|
||||||
app.use('/todo', require('./routers/todo/routes'))
|
app.use('/todo', require('./routers/todo/routes'))
|
||||||
app.use('/dogsitters-finder', require('./routers/dogsitters-finder'))
|
|
||||||
app.use('/kazan-explore', require('./routers/kazan-explore'))
|
|
||||||
|
|
||||||
app.use(require('./error'))
|
app.use(require('./error'))
|
||||||
|
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
const { response } = require('express');
|
|
||||||
|
|
||||||
const router = require('express').Router();
|
|
||||||
|
|
||||||
router.get("/users", (request, response) => {
|
|
||||||
response.send(require("./json/users/users.json"))
|
|
||||||
})
|
|
||||||
|
|
||||||
router.post("/auth", (request, response) => {
|
|
||||||
const {phoneNumber, password} = request.body;
|
|
||||||
console.log(phoneNumber, password);
|
|
||||||
if (phoneNumber === '89999999999') {
|
|
||||||
response.send(require("./json/auth/dogsitter.success.json"))
|
|
||||||
}
|
|
||||||
else if (phoneNumber === '89555555555') {
|
|
||||||
response.status(400).send(require("./json/auth/error.json"))
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
response.send(require("./json/auth/owner.success.json"))
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
router.post("/register", (request, response) => {
|
|
||||||
const {firstName, secondName, phoneNumber, password, role} = request.body;
|
|
||||||
console.log(phoneNumber, password, role);
|
|
||||||
if (phoneNumber === '89283244141' || phoneNumber === '89872855893') {
|
|
||||||
response.status(400).send(require("./json/register/error.json"))
|
|
||||||
}
|
|
||||||
else if (role === 'dogsitter') {
|
|
||||||
response.send(require("./json/register/dogsitter.success.json"))
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
response.send(require("./json/register/owner.success.json"))
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
module.exports = router;
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"data": {
|
|
||||||
"id": 1,
|
|
||||||
"phoneNumber": 89283244141,
|
|
||||||
"firstName": "Вася",
|
|
||||||
"secondName": "Пупкин",
|
|
||||||
"role": "dogsitter",
|
|
||||||
"location": "Россия, республика Татарстан, Казань, улица Пушкина, 12",
|
|
||||||
"price": 1500,
|
|
||||||
"aboutMe": "Я люблю собак"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"error": "Пользователь не найден"
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"data": {
|
|
||||||
"id": 3,
|
|
||||||
"phoneNumber": 89872855893,
|
|
||||||
"firstName": "Гадий",
|
|
||||||
"secondName": "Петрович",
|
|
||||||
"role": "owner"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"data": {
|
|
||||||
"id": 5,
|
|
||||||
"phoneNumber": 89555555555,
|
|
||||||
"firstName": "Масяня",
|
|
||||||
"secondName": "Карлова",
|
|
||||||
"role": "dogsitter",
|
|
||||||
"location": "Россия, республика Татарстан, Казань, улица Пушкина, 12",
|
|
||||||
"price": 100,
|
|
||||||
"aboutMe": "Все на свете - собаки"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"error": "Пользователь с таким номером телефона уже существует"
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"data": {
|
|
||||||
"id": 6,
|
|
||||||
"phoneNumber": 89888888888,
|
|
||||||
"firstName": "Генадий",
|
|
||||||
"secondName": "Паровозов",
|
|
||||||
"role": "owner"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -7,4 +7,6 @@ router.use('/cats', require('./cats/index'))
|
|||||||
|
|
||||||
router.use('/ecliptica', require('./ecliptica/index'))
|
router.use('/ecliptica', require('./ecliptica/index'))
|
||||||
|
|
||||||
|
router.use('/sdk', require('./sdk/index'))
|
||||||
|
|
||||||
module.exports = router
|
module.exports = router
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
const router = require('express').Router();
|
||||||
|
const { v4: uuidv4 } = require('uuid');
|
||||||
|
|
||||||
|
const workout1 = {
|
||||||
|
id: uuidv4(),
|
||||||
|
title: "Toned upper body",
|
||||||
|
exercises: [
|
||||||
|
{ title: "Push ups", repsOrDuration: 12, isTimeBased: false },
|
||||||
|
{ title: "Plank", repsOrDuration: 4, isTimeBased: true },
|
||||||
|
{ title: "Bicep curl", repsOrDuration: 12, isTimeBased: false, weight: 5 },
|
||||||
|
{ title: "Bicep curl", repsOrDuration: 12, isTimeBased: false, weight: 5 },
|
||||||
|
{ title: "Bicep curl", repsOrDuration: 12, isTimeBased: false, weight: 5 },
|
||||||
|
{ title: "Bicep curl", repsOrDuration: 12, isTimeBased: false, weight: 5 },
|
||||||
|
],
|
||||||
|
tags: ['Weights', 'Arms', 'Abs', 'Chest', 'Back']
|
||||||
|
};
|
||||||
|
|
||||||
|
const workout2 = {
|
||||||
|
id: uuidv4(),
|
||||||
|
title: "Tom Platz's legs",
|
||||||
|
exercises: [
|
||||||
|
{ title: "Squats", repsOrDuration: 12, isTimeBased: false, weight: 40 },
|
||||||
|
{ title: "Leg Press", repsOrDuration: 4, isTimeBased: false, weight: 65 },
|
||||||
|
{ title: "Lunges", repsOrDuration: 2, isTimeBased: true }
|
||||||
|
],
|
||||||
|
tags: ['Weights', 'Legs']
|
||||||
|
};
|
||||||
|
|
||||||
|
const workout3 = {
|
||||||
|
id: uuidv4(),
|
||||||
|
title: "HIIT",
|
||||||
|
exercises: [
|
||||||
|
{ title: "Jumping rope", repsOrDuration: 100, isTimeBased: false },
|
||||||
|
{ title: "Burpees", repsOrDuration: 3, isTimeBased: true },
|
||||||
|
{ title: "Jumping Jacks", repsOrDuration: 50, isTimeBased: false }
|
||||||
|
],
|
||||||
|
tags: ['Cardio']
|
||||||
|
}
|
||||||
|
|
||||||
|
const savedWorkouts = [workout1, workout3];
|
||||||
|
|
||||||
|
const trainingWorkouts = [workout2];
|
||||||
|
|
||||||
|
router.post('/workout', (req, res) => {
|
||||||
|
const newWorkout = { ...req.body, id: uuidv4() };
|
||||||
|
savedWorkouts.push(newWorkout);
|
||||||
|
res.status(201).json(newWorkout);
|
||||||
|
});
|
||||||
|
|
||||||
|
router.get('/workouts', (req, res) => {
|
||||||
|
res.json(savedWorkouts);
|
||||||
|
});
|
||||||
|
|
||||||
|
router.post('/training/workout', (req, res) => {
|
||||||
|
const newWorkout = { ...req.body, id: uuidv4() };
|
||||||
|
trainingWorkouts.push(newWorkout);
|
||||||
|
res.status(201).json(newWorkout);
|
||||||
|
});
|
||||||
|
|
||||||
|
const trainings = [{ id: uuidv4(), calories: 450, date: new Date("Thu Oct 03 2024 10:05:24 GMT+0300 (Moscow Standard Time)"), emoji: "fuzzy", hours: 1, minutes: 30, isWorkoutSaved: true, workout: workout1.id }];
|
||||||
|
|
||||||
|
const days = [
|
||||||
|
new Date("Thu Oct 03 2024 10:05:24 GMT+0300 (Moscow Standard Time)"),
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
router.post('/training', (req, res) => {
|
||||||
|
const newTraining = { ...req.body, id: uuidv4() };
|
||||||
|
trainings.push(newTraining);
|
||||||
|
days.push(newTraining.date);
|
||||||
|
res.status(201).json(newTraining);
|
||||||
|
});
|
||||||
|
|
||||||
|
router.get('/training', (req, res) => {
|
||||||
|
const { date } = req.query;
|
||||||
|
if (!date) {
|
||||||
|
return res.status(400).json({ message: 'Date query parameter is required' });
|
||||||
|
}
|
||||||
|
const formattedDate = new Date(date);
|
||||||
|
const result = trainings.find(t => new Date(t.date).toDateString() === formattedDate.toDateString());
|
||||||
|
if (result) {
|
||||||
|
res.json(result);
|
||||||
|
} else {
|
||||||
|
res.status(404).json({ message: 'Training not found for the specified date' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
router.get('/training/workout', (req, res) => {
|
||||||
|
const { id } = req.query;
|
||||||
|
if (!id) {
|
||||||
|
return res.status(400).json({ message: 'Id query parameter is required' });
|
||||||
|
}
|
||||||
|
const result = trainingWorkouts.find(w => w.id === id);
|
||||||
|
if (result) {
|
||||||
|
res.json(result);
|
||||||
|
} else {
|
||||||
|
res.status(404).json({ message: 'Training with such workout not found' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
router.get('/workout', (req, res) => {
|
||||||
|
const { id } = req.query;
|
||||||
|
if (!id) {
|
||||||
|
return res.status(400).json({ message: 'Id query parameter is required' });
|
||||||
|
}
|
||||||
|
const result = savedWorkouts.find(w => w.id === id);
|
||||||
|
if (result) {
|
||||||
|
res.json(result);
|
||||||
|
} else {
|
||||||
|
res.status(404).json({ message: 'Workout not found' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
router.get('/trainings', (req, res) => {
|
||||||
|
res.json(trainings);
|
||||||
|
});
|
||||||
|
|
||||||
|
router.get('/days', (req, res) => {
|
||||||
|
res.json(days);
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
module.exports = router;
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
const { response } = require('express');
|
||||||
|
|
||||||
|
const router = require('express').Router();
|
||||||
|
|
||||||
|
router.get("/users", (request, response) => {
|
||||||
|
response.send(require("./json/users.json"))
|
||||||
|
})
|
||||||
|
|
||||||
|
module.exports = router;
|
||||||
+5
-1
@@ -2,6 +2,7 @@
|
|||||||
{
|
{
|
||||||
"id": 1,
|
"id": 1,
|
||||||
"phone_number": 89283244141,
|
"phone_number": 89283244141,
|
||||||
|
"password": "1234",
|
||||||
"first_name": "Вася",
|
"first_name": "Вася",
|
||||||
"second_name": "Пупкин",
|
"second_name": "Пупкин",
|
||||||
"role": "dogsitter",
|
"role": "dogsitter",
|
||||||
@@ -12,6 +13,7 @@
|
|||||||
{
|
{
|
||||||
"id": 2,
|
"id": 2,
|
||||||
"phone_number": 89272844541,
|
"phone_number": 89272844541,
|
||||||
|
"password": "1234",
|
||||||
"first_name": "Ваня",
|
"first_name": "Ваня",
|
||||||
"second_name": "Пуськин",
|
"second_name": "Пуськин",
|
||||||
"role": "dogsitter",
|
"role": "dogsitter",
|
||||||
@@ -22,6 +24,7 @@
|
|||||||
{
|
{
|
||||||
"id": 3,
|
"id": 3,
|
||||||
"phone_number": 89872855893,
|
"phone_number": 89872855893,
|
||||||
|
"password": "12345",
|
||||||
"first_name": "Гадий",
|
"first_name": "Гадий",
|
||||||
"second_name": "Петрович",
|
"second_name": "Петрович",
|
||||||
"role": "owner"
|
"role": "owner"
|
||||||
@@ -29,9 +32,10 @@
|
|||||||
{
|
{
|
||||||
"id": 4,
|
"id": 4,
|
||||||
"phone_number": 89872844591,
|
"phone_number": 89872844591,
|
||||||
|
"password": "12345",
|
||||||
"first_name": "Галкин",
|
"first_name": "Галкин",
|
||||||
"second_name": "Максим",
|
"second_name": "Максим",
|
||||||
"role": "dogsitter",
|
"role": ["owner", "dogsitter"],
|
||||||
"location": "Россия, республика Татарстан, Казань, проспект Ямашева, 83",
|
"location": "Россия, республика Татарстан, Казань, проспект Ямашева, 83",
|
||||||
"price": 1000000,
|
"price": 1000000,
|
||||||
"about_me": "Миллион алых роз"
|
"about_me": "Миллион алых роз"
|
||||||
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.
Reference in new issue
Block a user