Compare commits
1 Commits
2ede62bcd8
...
feature/fr
| Author | SHA1 | Date | |
|---|---|---|---|
| 552457b5cb |
@@ -49,7 +49,6 @@ app.use('/kazan-explore', require('./routers/kazan-explore'))
|
|||||||
app.use('/edateam', require('./routers/edateam-legacy'))
|
app.use('/edateam', require('./routers/edateam-legacy'))
|
||||||
app.use('/dry-wash', require('./routers/dry-wash'))
|
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(require('./error'))
|
app.use(require('./error'))
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,4 @@ 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
|
||||||
|
|||||||
@@ -1,123 +0,0 @@
|
|||||||
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;
|
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
const router = require('express').Router();
|
const router = require('express').Router();
|
||||||
|
|
||||||
router.use('/performer', require('./dashboard-performer'))
|
router.use('/performer', require('./dashboard-performer'))
|
||||||
|
router.use('/landing', require('./landing'))
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
29
server/routers/freetracker/landing/index.js
Normal file
29
server/routers/freetracker/landing/index.js
Normal 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
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"success": false,
|
||||||
|
"body": { },
|
||||||
|
"errors": [
|
||||||
|
"Что-то пошло не так"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"success": true,
|
||||||
|
"body": { }
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"success": false,
|
||||||
|
"body": {
|
||||||
|
"blocks": []
|
||||||
|
},
|
||||||
|
"errors": [
|
||||||
|
"Что-то пошло не так"
|
||||||
|
]
|
||||||
|
}
|
||||||
22
server/routers/freetracker/landing/json/blocks-success.json
Normal file
22
server/routers/freetracker/landing/json/blocks-success.json
Normal 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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user