Remove orphaned import-lorcana-simple CLI script.
It POSTed to the deleted /api/cards/import-lorcana endpoint; no remaining callers. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
662bdd98e1
commit
6e3b81145b
1 changed files with 0 additions and 98 deletions
|
|
@ -1,98 +0,0 @@
|
|||
import fetch from 'node-fetch';
|
||||
import fs from 'fs';
|
||||
|
||||
// Lorcana sets to import
|
||||
const LORCANA_SETS = [
|
||||
{ code: 'tfc', name: 'The First Chapter' },
|
||||
{ code: 'rotf', name: 'Rise of the Floodborn' },
|
||||
{ code: 'ink', name: 'Into the Inklands' }
|
||||
];
|
||||
|
||||
async function importLorcanaSet(setCode, setName) {
|
||||
try {
|
||||
console.log(`Importing Lorcana set: ${setName} (${setCode})`);
|
||||
|
||||
const response = await fetch(`http://localhost:3000/api/cards/import-lorcana`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
setCode: setCode,
|
||||
setName: setName
|
||||
})
|
||||
});
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
if (result.success) {
|
||||
console.log(`✅ Successfully imported ${result.imported || 0} cards from ${setName}`);
|
||||
return { success: true, importedCount: result.imported || 0 };
|
||||
} else {
|
||||
console.log(`❌ Failed to import ${setName}: ${result.error}`);
|
||||
return { success: false, error: result.error };
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(`❌ Error importing ${setName}: ${error.message}`);
|
||||
return { success: false, error: error.message };
|
||||
}
|
||||
}
|
||||
|
||||
async function importAllLorcana() {
|
||||
console.log('🎨 Starting Lorcana card import...\n');
|
||||
|
||||
const results = {
|
||||
total: 0,
|
||||
successful: 0,
|
||||
failed: 0,
|
||||
sets: []
|
||||
};
|
||||
|
||||
for (const set of LORCANA_SETS) {
|
||||
const result = await importLorcanaSet(set.code, set.name);
|
||||
results.sets.push({ ...set, ...result });
|
||||
|
||||
if (result.success) {
|
||||
results.successful++;
|
||||
results.total += result.importedCount || 0;
|
||||
} else {
|
||||
results.failed++;
|
||||
}
|
||||
|
||||
// Add a delay between sets
|
||||
await new Promise(resolve => setTimeout(resolve, 2000));
|
||||
}
|
||||
|
||||
// Print summary
|
||||
console.log('\n📊 Lorcana Import Summary:');
|
||||
console.log('========================');
|
||||
console.log(`Total sets: ${LORCANA_SETS.length}`);
|
||||
console.log(`Successful: ${results.successful}`);
|
||||
console.log(`Failed: ${results.failed}`);
|
||||
console.log(`Total cards imported: ${results.total}`);
|
||||
console.log(`Success rate: ${((results.successful / LORCANA_SETS.length) * 100).toFixed(1)}%`);
|
||||
|
||||
// Save detailed results
|
||||
const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
|
||||
const filename = `lorcana-import-results-${timestamp}.json`;
|
||||
|
||||
fs.writeFileSync(filename, JSON.stringify(results, null, 2));
|
||||
console.log(`\n📄 Detailed results saved to: ${filename}`);
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
// Run the import if this script is executed directly
|
||||
if (import.meta.url === `file://${process.argv[1]}`) {
|
||||
importAllLorcana()
|
||||
.then(() => {
|
||||
console.log('\n🎉 Lorcana import completed!');
|
||||
process.exit(0);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('❌ Import failed:', error);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
|
||||
export { importAllLorcana, importLorcanaSet };
|
||||
Loading…
Reference in a new issue