feat(import): add WSDC list parser with location + update-missing-location option\n\n- Parse Event List for name/date/location/country/sourceUrl\n- Support --source list|calendar|auto and --update-missing-location\n- Keep calendar import for title/start/end/url fallback\n- Update CLI summary and docs (ADMIN_CLI.md, README.md)

This commit is contained in:
Radosław Gierwiało
2025-11-15 21:56:05 +01:00
parent 457de6c1c4
commit b9d6f42ff5
4 changed files with 175 additions and 21 deletions

View File

@@ -318,19 +318,27 @@ async function cmdEventsImportWsdc(opts) {
const until = opts.until ? new Date(opts.until) : null;
const limit = opts.limit ? parseInt(String(opts.limit), 10) : undefined;
const dryRun = Boolean(opts['dry-run'] || opts.dry || opts.dry_run);
const source = (opts.source || 'auto').toLowerCase(); // auto|calendar|list
const updateMissingLocation = Boolean(opts['update-missing-location'] || opts.updateMissingLocation || opts.update_missing_location);
const result = await importWorldsdc({ since, until, limit, dryRun });
const result = await importWorldsdc({ since, until, limit, dryRun, source, updateMissingLocation });
console.log('Import summary:', {
fetched: result.fetched,
considered: result.considered,
created: result.created.length,
updated: result.updated.length,
skipped: result.skipped.length,
dryRun,
source,
});
if (result.created.length) {
console.log('To create / created:');
console.table(result.created.map(e => ({ name: e.name, startDate: e.startDate, endDate: e.endDate, location: e.location || null, sourceUrl: e.sourceUrl })));
}
if (result.updated.length) {
console.log('To update / updated (location):');
console.table(result.updated.map(e => ({ name: e.name, startDate: e.startDate, oldLocation: e.oldLocation || null, newLocation: e.newLocation })));
}
if (result.skipped.length) {
console.log('Skipped:');
console.table(result.skipped.map(e => ({ name: e.name, startDate: e.startDate, reason: e.reason })));