add fastify server, add prepare-data endpoint (working)

This commit is contained in:
2024-05-25 13:22:55 +02:00
parent 4715cb25dc
commit d2763be27b
11 changed files with 3032 additions and 2065 deletions

100
index.js
View File

@@ -1,12 +1,88 @@
const data = [
[
{
userId: '257862776',
name: 'Катя Разуева',
availableTime: { from: 10, to: 20 },
tgUsername: 'ekate_25',
chatId: 257862776,
},
{
userId: '320185869',
name: 'Евгений Березкин',
availableTime: { from: 10, to: 20 },
tgUsername: 'breznovic',
chatId: 320185869,
},
{
userId: '484619169',
name: 'Владислав Беляев',
availableTime: { from: 10, to: 20 },
tgUsername: 'buladzislau',
chatId: 484619169,
},
],
[
{
userId: '550022173',
name: 'Садов Артем',
availableTime: { from: 10, to: 20 },
tgUsername: 'SadovArtem',
chatId: 550022173,
},
{
userId: '1534716020',
name: 'Игорь Шаргин',
availableTime: { from: 10, to: 20 },
tgUsername: 'Igor_Shargin',
chatId: 1534716020,
},
{
userId: '178615283',
name: 'Артур Ислакаев',
availableTime: { from: 20, to: 30 },
tgUsername: 'kven_a',
chatId: 178615283,
},
],
[
{
userId: '1111257233',
name: 'Александр Черемных',
availableTime: { from: 20, to: 30 },
chatId: 1111257233,
},
{
userId: '74330176',
name: 'Герман Владислав',
availableTime: { from: 30, to: 40 },
tgUsername: 'vladloot',
chatId: 74330176,
},
{
userId: '212999392',
name: 'Листопад Георгий',
availableTime: { from: 30, to: 40 },
tgUsername: 'thencatchfinally',
chatId: 212999392,
},
],
[
{
userId: '855517731',
name: '/add_to_team',
availableTime: { from: 30, to: 40 },
tgUsername: 'go_phase',
chatId: 855517731,
},
],
];
const root = document.getElementById('root');
async function getData() {
const data1 = await fetch('./groups.json').then((res) => res.json());
root.innerHTML = getHtml(data1);
}
function getHtml(data) {
return `<div>${data
.map((group) => {
return `<table><thead>
const html = `<div>${data
.map((group) => {
return `<table><thead>
<tr>
<th>Имя</th>
<th>Время</th>
@@ -23,7 +99,7 @@ function getHtml(data) {
})
.join('')}</tbody>
</table>`;
})
.join('')}</div>`;
}
getData();
})
.join('')}</div>`;
root.innerHTML = html;