feat(admin): E2E CRUD/i18n polish, IFT smoke workflow, fix edit payload wiping id. Refs EventHub/EventHubFrontAdmin#33 #37 #38 #39

This commit is contained in:
2026-07-14 23:34:31 +03:00
parent 836e4a7eea
commit 607209b35f
16 changed files with 345 additions and 128 deletions
+36 -17
View File
@@ -70,7 +70,9 @@ export async function tryHandleContentApi(
return true;
}
if (method === 'PUT') {
content.users[idx] = { ...content.users[idx], ...(postData() as object) };
const patch = (postData() || {}) as Record<string, unknown>;
delete patch.id;
content.users[idx] = { ...content.users[idx], ...patch, id };
await json(route, 200, content.users[idx]);
return true;
}
@@ -114,7 +116,9 @@ export async function tryHandleContentApi(
return true;
}
if (method === 'PUT') {
content.calendars[idx] = { ...content.calendars[idx], ...(postData() as object) };
const patch = (postData() || {}) as Record<string, unknown>;
delete patch.id;
content.calendars[idx] = { ...content.calendars[idx], ...patch, id };
await json(route, 200, content.calendars[idx]);
return true;
}
@@ -155,7 +159,9 @@ export async function tryHandleContentApi(
return true;
}
if (method === 'PUT') {
content.events[idx] = { ...content.events[idx], ...(postData() as object) };
const patch = (postData() || {}) as Record<string, unknown>;
delete patch.id;
content.events[idx] = { ...content.events[idx], ...patch, id };
await json(route, 200, content.events[idx]);
return true;
}
@@ -197,7 +203,9 @@ export async function tryHandleContentApi(
return true;
}
if (method === 'PUT') {
content.subscriptions[idx] = { ...content.subscriptions[idx], ...(postData() as object) };
const patch = (postData() || {}) as Record<string, unknown>;
delete patch.id;
content.subscriptions[idx] = { ...content.subscriptions[idx], ...patch, id };
await json(route, 200, content.subscriptions[idx]);
return true;
}
@@ -221,7 +229,7 @@ export async function tryHandleContentApi(
if (method === 'POST' && path.endsWith('/v1/admin/banned-words')) {
const payload = postData() as { word?: string };
const word = (payload.word || '').trim();
if (word) content.bannedWords.push({ word, added_by: 'admin-e2e-1', created_at: '2026-07-14T12:00:00Z' });
if (word) content.bannedWords.push({ word, added_by: 'admin-e2e-1', added_at: '2026-07-14T12:00:00Z' });
await json(route, 200, { ok: true });
return true;
}
@@ -293,19 +301,30 @@ export async function tryHandleContentApi(
return true;
}
// ---- monitoring enrichment ----
// ---- monitoring ----
if (method === 'GET' && path.includes('/v1/admin/nodes/metrics')) {
await json(route, 200, {
nodes: [
{
node: 'node-a',
cpu: 12,
memory_used_mb: 512,
memory_total_mb: 2048,
ts: '2026-07-14T12:00:00Z',
},
],
});
await json(route, 200, [
{
active_sessions: 3,
io_in: 10,
io_out: 20,
memory_atom: 1,
memory_binary: 2,
memory_ets: 3,
memory_processes: 4,
memory_total: 2048,
mnesia_commits: 1,
mnesia_failures: 0,
node: 'node-a',
process_count: 100,
run_queue: 0,
table_sizes: { users: 10 },
timestamp: '2026-07-14T12:00:00Z',
ws_connections: 5,
cpu_utilization: 12,
memory_available: 1024,
},
]);
return true;
}