Календарь: история действий с отменой для админа

This commit is contained in:
dev
2026-11-28 13:32:49 +03:00
parent c74042f297
commit 84ed0adc74
9 changed files with 785 additions and 59 deletions
+19
View File
@@ -301,5 +301,24 @@ ok('calendar_events нормализуются: цвет/повтор/напом
calRestore.calendar_events[0].is_common === true,
calRestore.calendar_events);
ok('calendar_action_log входит в бэкап и sequences', BACKUP_TABLES.includes('calendar_action_log') && BACKUP_SEQUENCE_TABLES.includes('calendar_action_log'));
const calLogRestore = normalizeRestoreData({
...base,
calendar_action_log: [
{ id: 1, event_ids: [1], user_id: 1, user_name: 'Админ', action: 'created', title: 'Созвон', before_state: [], after_state: [{ id: 1, user_id: 1, title: 'Созвон', color: 'nope', starts_at: '2026-11-24T07:30:00.000Z', ends_at: '2026-11-24T08:30:00.000Z', repeat_rule: 'weekly', reminder_minutes: [10, 999], created_at: '2026-11-24T07:00:00.000Z', updated_at: '2026-11-24T07:05:00.000Z' }], created_at: '2026-11-24T07:30:00.000Z' },
{ id: 2, event_ids: [2], action: 'bogus', before_state: [], after_state: [] },
{ id: 3, event_ids: [], before_state: [], after_state: [] },
],
});
ok('calendar_action_log нормализуется: action/snapshot/actor',
calLogRestore.calendar_action_log.length === 1 &&
calLogRestore.calendar_action_log[0].action === 'created' &&
calLogRestore.calendar_action_log[0].user_name === 'Админ' &&
calLogRestore.calendar_action_log[0].after_state[0].color === 'blue' &&
calLogRestore.calendar_action_log[0].after_state[0].reminder_minutes.join(',') === '10' &&
calLogRestore.calendar_action_log[0].after_state[0].created_at === '2026-11-24T07:00:00.000Z' &&
calLogRestore.calendar_action_log[0].after_state[0].updated_at === '2026-11-24T07:05:00.000Z',
calLogRestore.calendar_action_log);
console.log(failed ? `\n${failed} проверок провалено` : '\nBACKUP SELFTEST OK');
process.exit(failed ? 1 : 0);