chore: add debug logging for Synology calendar pruning

Log individual calendar names/URLs from server and stale calendar IDs
to diagnose why deleted calendars persist in stored list.

v1.57.5

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
mARTin 2026-03-22 23:54:08 +01:00
parent 93e808ddfa
commit af46c0c21f
3 changed files with 9 additions and 1 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "my-weekly-todo-list", "name": "my-weekly-todo-list",
"version": "1.57.4", "version": "1.57.5",
"description": "A web-based weekly task management application that organizes to-dos and calendar events in a single, intuitive weekly view", "description": "A web-based weekly task management application that organizes to-dos and calendar events in a single, intuitive weekly view",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View File

@ -50,6 +50,11 @@ export async function GET(request: NextRequest) {
if (username && password && serverUrl) { if (username && password && serverUrl) {
const freshCalendars = await getSynologyCalendars(serverUrl, username, password); const freshCalendars = await getSynologyCalendars(serverUrl, username, password);
const freshIds = new Set(freshCalendars.map(c => c.id)); const freshIds = new Set(freshCalendars.map(c => c.id));
const storedIds = calendars.map((c: any) => c.id);
const staleIds = storedIds.filter((id: string) => !freshIds.has(id));
if (staleIds.length > 0) {
console.log('[CONNECTIONS] Synology stale calendars to prune:', staleIds);
}
const pruned = calendars.filter((c: any) => freshIds.has(c.id)); const pruned = calendars.filter((c: any) => freshIds.has(c.id));
if (pruned.length < calendars.length) { if (pruned.length < calendars.length) {
calendars = pruned; calendars = pruned;

View File

@ -201,6 +201,9 @@ export const validateCredentials = async (serverUrl: string, username: string, p
})); }));
console.log('[SYNOLOGY CALENDAR] Found calendars:', mappedCalendars.length, '(filtered from', calendars.length, 'total)'); console.log('[SYNOLOGY CALENDAR] Found calendars:', mappedCalendars.length, '(filtered from', calendars.length, 'total)');
for (const cal of mappedCalendars) {
console.log(`[SYNOLOGY CALENDAR] - "${cal.title}" → ${cal.id}`);
}
return mappedCalendars; return mappedCalendars;
} catch (error) { } catch (error) {
console.error('Synology Calendar validation failed:', error); console.error('Synology Calendar validation failed:', error);