lad-website/mongo-init/01-init.js
Chris Haulmark c9e042fa98 Add Update/Article models, migration script, and complete LAD rebrand
Backend:
- New models: Update, Article (Deaf Focus)
- Expanded Event + Document models: directusId, photoUrl, new minute types
- New routes/controllers: /api/updates, /api/articles (full CRUD)
- Migration script: pulls all data from db.lad1908.org Directus API,
  downloads public PDFs into uploads/documents/, idempotent re-runs
- .env.example for production deployment reference
- Rename ocd_db → lad_db throughout

Frontend:
- Contact: LAD contact info, removed Olathe address and map
- Membership: LAD copy, membership fees replaced with contact-us prompt
- Donate: LAD name in metadata, hero, and FAQs

Infrastructure:
- mongo-init: simplified, uses MONGO_USER/MONGO_PASSWORD env vars, lad_db
- docker-compose: rename volumes ocd-* → lad-*, image names updated
- Upload directory structure committed via .gitkeep files
2026-05-24 15:29:30 -06:00

17 lines
596 B
JavaScript

// MongoDB initialization script — runs once when the container is first created.
db = db.getSiblingDB('lad_db');
if (db.getUser(process.env.MONGO_USER || 'lad_admin') == null) {
db.createUser({
user: process.env.MONGO_USER || 'lad_admin',
pwd: process.env.MONGO_PASSWORD || 'changeme',
roles: [{ role: 'readWrite', db: 'lad_db' }]
});
}
// Collections are created automatically by Mongoose on first write.
// Index definitions live in the model files.
// This script exists to create the DB user and is safe to re-run.
console.log('LAD MongoDB initialization complete.');