Add landing page
This commit is contained in:
parent
3fea484585
commit
bce86ee840
47 changed files with 7119 additions and 439 deletions
37
scripts/list-all-series-events.js
Normal file
37
scripts/list-all-series-events.js
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
import mongoose from 'mongoose';
|
||||
import Event from '../server/models/event.js';
|
||||
|
||||
const MONGODB_URI = process.env.MONGODB_URI || 'mongodb://localhost:27017/ghostguild';
|
||||
|
||||
async function listAll() {
|
||||
try {
|
||||
await mongoose.connect(MONGODB_URI);
|
||||
|
||||
// Group events by series ID
|
||||
const allEvents = await Event.find({ 'series.isSeriesEvent': true })
|
||||
.select('title series.id')
|
||||
.sort({ 'series.id': 1, 'series.position': 1 })
|
||||
.lean();
|
||||
|
||||
const grouped = {};
|
||||
allEvents.forEach(e => {
|
||||
const sid = e.series?.id || 'unknown';
|
||||
if (!grouped[sid]) grouped[sid] = [];
|
||||
grouped[sid].push(e.title);
|
||||
});
|
||||
|
||||
console.log('Events grouped by series.id:\n');
|
||||
Object.entries(grouped).forEach(([sid, events]) => {
|
||||
console.log(`${sid} (${events.length} events):`);
|
||||
events.forEach(e => console.log(` - ${e}`));
|
||||
console.log('');
|
||||
});
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error:', error);
|
||||
} finally {
|
||||
await mongoose.connection.close();
|
||||
}
|
||||
}
|
||||
|
||||
listAll();
|
||||
Loading…
Add table
Add a link
Reference in a new issue