Index: Wedding_Planner.html
===================================================================
--- Wedding_Planner.html	(revision 3679996aa9694cc6afa7598db54bdc53f0f651fb)
+++ Wedding_Planner.html	(revision b7d8a4d7876853de88e2a8615a368abdc4c6981b)
@@ -324,4 +324,5 @@
 let CURRENT_USER   = null;
 let CURRENT_WEDDING = null;
+let WEDDINGS = [];
 let EVENTS         = [];
 let GUESTS         = [];
@@ -337,4 +338,5 @@
 let REGISTRAR_BOOKINGS = [];
 let ATTENDANCE     = [];
+let RSVPS = [];
 
 // =============================================================
@@ -370,4 +372,5 @@
     if (wRes && wRes.ok) {
         const weddings = await wRes.json();
+        WEDDINGS = weddings;
         CURRENT_WEDDING = weddings[0] || null;
     }
@@ -405,4 +408,10 @@
     }
 
+    // Load RSVPs for this wedding (admin view)
+    if (wid) {
+        const rsvpR = await api('GET', `/api/weddings/${wid}/rsvp`);
+        if (rsvpR && rsvpR.ok) RSVPS = await rsvpR.json();
+    }
+
     const [venR, banR, phR, chR, regR] = await Promise.all([
         api('GET', '/api/venues'),
@@ -424,4 +433,17 @@
 async function reload() {
     if (!CURRENT_WEDDING) return;
+    // Refresh list of weddings first (in case user created/removed/switches)
+    try {
+        const wListR = await api('GET', '/api/weddings');
+        if (wListR && wListR.ok) {
+            WEDDINGS = await wListR.json();
+            // keep CURRENT_WEDDING reference in sync
+            if (CURRENT_WEDDING) {
+                const found = WEDDINGS.find(w => String(w.wedding_id) === String(CURRENT_WEDDING.wedding_id));
+                if (found) CURRENT_WEDDING = found;
+            }
+        }
+    } catch (e) { /* ignore */ }
+
     const wid = CURRENT_WEDDING.wedding_id;
     const [evR, guR, vbR, pbR, bbR, rbR, cbR, attR] = await Promise.all([
@@ -443,4 +465,7 @@
     if (cbR && cbR.ok) CHURCH_BOOKINGS = await cbR.json();
     if (attR && attR.ok) ATTENDANCE = await attR.json();
+    // Refresh RSVP list as well
+    const rsvpR = await api('GET', `/api/weddings/${wid}/rsvp`);
+    if (rsvpR && rsvpR.ok) RSVPS = await rsvpR.json();
     renderApp();
 }
@@ -473,4 +498,54 @@
         a.classList.toggle('active', page ? `/${page}` === ctx : false);
     });
+    // Render wedding selector in the topbar actions so user can switch between weddings
+    try {
+        const topbarActions = document.querySelector('.topbar .topbar-actions');
+        // remove old selector if present
+        const oldSel = document.getElementById('weddingSelect');
+        if (oldSel) oldSel.remove();
+        const oldBtn = document.getElementById('btnNewWedding');
+        if (oldBtn) oldBtn.remove();
+
+        // Create selector
+        const sel = document.createElement('select');
+        sel.id = 'weddingSelect';
+        sel.style.minWidth = '200px';
+        sel.style.padding = '6px 8px';
+        sel.style.borderRadius = '8px';
+        sel.style.border = '1px solid var(--border)';
+        sel.style.background = '#fff';
+        sel.style.marginRight = '8px';
+        const noneOpt = document.createElement('option');
+        noneOpt.value = '';
+        noneOpt.textContent = '— Select Wedding —';
+        sel.appendChild(noneOpt);
+        WEDDINGS.forEach(w => {
+            const o = document.createElement('option');
+            o.value = w.wedding_id;
+            o.textContent = `${w.date} ${w.notes?'- '+(w.notes||'') : ''}`;
+            if (CURRENT_WEDDING && String(CURRENT_WEDDING.wedding_id) === String(w.wedding_id)) o.selected = true;
+            sel.appendChild(o);
+        });
+        sel.addEventListener('change', async (e) => {
+            const val = e.target.value;
+            if (!val) return;
+            const found = WEDDINGS.find(x => String(x.wedding_id) === String(val));
+            if (found) {
+                CURRENT_WEDDING = found;
+                await reload();
+                renderApp();
+            }
+        });
+        topbarActions.insertBefore(sel, topbarActions.firstChild);
+
+        // New wedding button
+        const newBtn = document.createElement('button');
+        newBtn.id = 'btnNewWedding';
+        newBtn.className = 'btn btn-sm';
+        newBtn.style.marginRight = '8px';
+        newBtn.textContent = '+ Wedding';
+        newBtn.addEventListener('click', openCreateWeddingModal);
+        topbarActions.insertBefore(newBtn, topbarActions.firstChild);
+    } catch (e) { /* ignore UI insertion errors */ }
     const content = document.getElementById('page-content');
     content.innerHTML = '';
@@ -893,37 +968,119 @@
     if(!CURRENT_WEDDING){ renderNoWedding(container); return; }
     const wrap = document.createElement('div');
-    wrap.innerHTML = `<div class="card"><div class="card-header"><h3>Guest List</h3><div class="card-actions"><button class="btn btn-primary" id="btnAddGuest">+ Add Guest</button></div></div><div id="guestTableContainer"></div></div>`;
+    wrap.innerHTML = `<div class="card"><div class="card-header"><h3>Guest List</h3><div class="card-actions"><button class="btn btn-primary" id="btnAddGuest">+ Add Guest</button><button class="btn" id="btnUploadGuests">Upload CSV</button></div></div><div id="guestTableContainer"></div></div>`;
     container.appendChild(wrap);
     wrap.querySelector('#btnAddGuest').addEventListener('click', openAddGuestModal);
-
-    const guestRsvpMap = {};
-    if(EVENTS.length > 0){
-        const firstEvent = EVENTS[0];
-        // RSVP mapping removed for revert
+    wrap.querySelector('#btnUploadGuests').addEventListener('click', () => {
+        if(!CURRENT_WEDDING){ showToast('Select or create a wedding first.','danger'); return; }
+        const input = document.createElement('input');
+        input.type = 'file';
+        input.accept = '.csv,text/csv';
+        input.addEventListener('change', async (e) => {
+            const file = e.target.files && e.target.files[0];
+            if(!file) return;
+            const text = await file.text();
+            const rows = parseCSV(text);
+            if(rows.length === 0){ showToast('No guests found in CSV.','danger'); return; }
+
+            const previewRows = rows.slice(0,200).map(r=>`<tr><td>${escapeHtml(r.first_name||'')}</td><td>${escapeHtml(r.last_name||'')}</td><td>${escapeHtml(r.email||'')}</td><td>${escapeHtml(r.role||'')}</td></tr>`).join('');
+            const body = `<div style="max-height:320px;overflow:auto;"><table style="width:100%;border-collapse:collapse;"><thead><tr><th style="text-align:left;padding:6px">First</th><th style="text-align:left;padding:6px">Last</th><th style="text-align:left;padding:6px">Email</th><th style="text-align:left;padding:6px">Role</th></tr></thead><tbody>${previewRows}</tbody></table></div><div style="margin-top:12px;"><label><input type="checkbox" id="csvSendEmails"/> Send invitation emails</label></div><p class="muted" style="margin-top:10px;">${rows.length} guests parsed. Showing first ${Math.min(rows.length,200)} rows.</p>`;
+
+            showModal('Import Guests from CSV', body, async () => {
+                const sendEmails = document.getElementById('csvSendEmails').checked;
+                const res = await api('POST', `/api/weddings/${CURRENT_WEDDING.wedding_id}/guests/bulk`, { guests: rows, sendEmails });
+                if(res && res.ok){ const d = await res.json(); closeModal(); showToast(`${d.inserted} guests imported.`,'success'); await reload(); }
+                else { const d = await res.json().catch(()=>null); showToast((d&&d.error) || 'Error importing guests.','danger'); }
+            });
+        });
+        input.click();
+    });
+
+    // Build table after ensuring we have up-to-date RSVP data for this wedding
+    (async () => {
+        // Fetch fresh RSVPs for this wedding to ensure the UI reflects guest-submitted responses
+        try {
+            const r = await api('GET', `/api/weddings/${CURRENT_WEDDING.wedding_id}/rsvp`);
+            if (r && r.ok) RSVPS = await r.json();
+        } catch (e) { /* ignore, we'll use cached RSVPS if available */ }
+
+        const guestRsvpMap = {};
+        if (EVENTS.length > 0) {
+            const firstEvent = EVENTS[0];
+            RSVPS.forEach(rv => {
+                if (String(rv.event_id) === String(firstEvent.event_id)) guestRsvpMap[String(rv.guest_id)] = rv.status;
+            });
+        }
+
+        buildDataTable({
+            container: wrap.querySelector('#guestTableContainer'),
+            columns: [
+                { header:'First Name', accessor:'first_name' },
+                { header:'Last Name', accessor:'last_name' },
+                { header:'Email', accessor:'email' },
+                { header:'Status', accessor:'status', render: v => {
+                    const color = v === 'accepted' ? 'badge-success' : v === 'declined' ? 'badge-danger' : v === 'invited' ? 'badge-warn' : 'badge-purple';
+                    return `<span class="badge ${color}">${v || 'pending'}</span>`;
+                }},
+                { header:'Invite', accessor:'email', sortable:false, render: (v,row) =>
+                    v ? `<span class="badge badge-success">✉ Invite sent</span>` : `<span class="badge badge-warn">No email</span>`
+                }
+            ],
+            rows: GUESTS.map(g=>({ id:g.guest_id, first_name:g.first_name, last_name:g.last_name, email:g.email||'', status: guestRsvpMap[String(g.guest_id)] || 'pending' })),
+            onEdit: row => editGuestModal(row.id),
+            onDelete: async row => {
+                const res = await api('DELETE',`/api/guests/${row.id}`);
+                if(res && res.ok){ showToast('Guest removed.',''); await reload(); }
+                else showToast('Could not remove guest.','danger');
+            }
+        });
+    })();
+}
+
+// CSV helpers for guest import
+function splitCSVLine(line){
+    const out = [];
+    let cur = '';
+    let inQuotes = false;
+    for(let i=0;i<line.length;i++){
+        const ch = line[i];
+        if(ch === '"'){
+            if(inQuotes && line[i+1] === '"'){ cur += '"'; i++; }
+            else inQuotes = !inQuotes;
+        } else if(ch === ',' && !inQuotes){ out.push(cur); cur = ''; }
+        else cur += ch;
     }
-
-    buildDataTable({
-        container: wrap.querySelector('#guestTableContainer'),
-        columns: [
-            { header:'First Name', accessor:'first_name' },
-            { header:'Last Name', accessor:'last_name' },
-            { header:'Email', accessor:'email' },
-            { header:'Status', accessor:'status', render: v => {
-                const color = v === 'accepted' ? 'badge-success' : v === 'declined' ? 'badge-danger' : v === 'invited' ? 'badge-warn' : 'badge-purple';
-                return `<span class="badge ${color}">${v || 'pending'}</span>`;
-            }},
-            { header:'Invite', accessor:'email', sortable:false, render: (v,row) =>
-                v ? `<span class="badge badge-success">✉ Invite sent</span>` : `<span class="badge badge-warn">No email</span>`
-            }
-        ],
-        rows: GUESTS.map(g=>({ id:g.guest_id, first_name:g.first_name, last_name:g.last_name, email:g.email||'', status: 'pending' })),
-        onEdit: row => editGuestModal(row.id),
-        onDelete: async row => {
-            const res = await api('DELETE',`/api/guests/${row.id}`);
-            if(res && res.ok){ showToast('Guest removed.',''); await reload(); }
-            else showToast('Could not remove guest.','danger');
-        }
-    });
-}
+    out.push(cur);
+    return out.map(s=>s.trim());
+}
+
+function parseCSV(text){
+    if(!text) return [];
+    const lines = text.split(/\r?\n/).map(l=>l.trim()).filter(l=>l.length>0);
+    if(lines.length === 0) return [];
+    const first = splitCSVLine(lines[0]).map(h=>h.toLowerCase());
+    const hasHeader = first.some(h=>['first','first_name','first name','last','last_name','email','role'].includes(h));
+    const rows = [];
+    const start = hasHeader ? 1 : 0;
+    let headers = first;
+    if(!hasHeader) headers = ['first_name','last_name','email','role'];
+    for(let i=start;i<lines.length;i++){
+        const cols = splitCSVLine(lines[i]);
+        const obj = {};
+        for(let j=0;j<headers.length;j++){
+            const key = headers[j] ? headers[j].toLowerCase().replace(/ /g,'_') : `col${j}`;
+            obj[key] = cols[j] ? cols[j].trim().replace(/^"|"$/g,'') : '';
+        }
+        const out = {
+            first_name: obj.first_name || obj.first || '',
+            last_name: obj.last_name || obj.last || '',
+            email: obj.email || '',
+            role: obj.role || ''
+        };
+        if(out.first_name || out.last_name) rows.push(out);
+    }
+    return rows;
+}
+
+function escapeHtml(s){ return String(s||'').replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;'); }
 
 function openAddGuestModal(){
@@ -1568,4 +1725,8 @@
 //  UTILITY
 // =============================================================
+// When the window gains focus, refresh wedding-specific data so changes submitted via RSVP links
+// (which happen outside this UI) are reflected in both Guests and Seating pages.
+window.addEventListener('focus', () => { if (CURRENT_WEDDING) reload(); });
+
 function focusSearch(){
     const s = document.querySelector('.search-input');
Index: server.js
===================================================================
--- server.js	(revision 3679996aa9694cc6afa7598db54bdc53f0f651fb)
+++ server.js	(revision b7d8a4d7876853de88e2a8615a368abdc4c6981b)
@@ -61,4 +61,114 @@
     port: parseInt(process.env.DB_PORT, 10),
     ssl: { rejectUnauthorized: false }
+});
+
+// POST /api/weddings/:wid/guests/bulk — add multiple guests in a transaction
+app.post('/api/weddings/:wid/guests/bulk', requireAuth, async (req, res) => {
+    const { guests, sendEmails } = req.body;
+    if (!Array.isArray(guests) || guests.length === 0) return res.status(400).json({ error: 'guests array is required.' });
+
+    const wid = req.params.wid;
+    const client = await pool.connect();
+    try {
+        // Ensure wedding exists
+        const wRes = await client.query('SET search_path TO project; SELECT wedding_id, "date" FROM wedding WHERE wedding_id=$1', [wid]);
+        if (wRes.rows.length === 0) {
+            client.release();
+            return res.status(404).json({ error: 'Wedding not found.' });
+        }
+
+        // Fetch events for this wedding
+        const evRes = await client.query('SELECT event_id, event_type, "date", start_time, end_time FROM project.event WHERE wedding_id=$1 ORDER BY "date", start_time', [wid]);
+        const events = evRes.rows;
+
+        await client.query('BEGIN');
+        const inserted = [];
+        for (const g of guests) {
+            const first_name = (g.first_name || '').trim();
+            const last_name = (g.last_name || '').trim();
+            const email = (g.email || null);
+            const role = (g.role || null);
+            if (!first_name || !last_name) {
+                await client.query('ROLLBACK');
+                return res.status(400).json({ error: 'Each guest must have first_name and last_name.' });
+            }
+            const ins = await client.query('INSERT INTO project.guest(first_name,last_name,email,wedding_id,role) VALUES ($1,$2,$3,$4,$5) RETURNING *', [first_name, last_name, email, wid, role]);
+            const guest = ins.rows[0];
+            inserted.push(guest);
+
+            // Create RSVP records for each event
+            for (const ev of events) {
+                try {
+                    await client.query(
+                        `INSERT INTO project.event_rsvp(status, response_date, guest_id, event_id)
+                         VALUES ('invited', CURRENT_DATE, $1, $2)
+                         ON CONFLICT (guest_id, event_id) DO NOTHING`,
+                        [guest.guest_id, ev.event_id]
+                    );
+                } catch (e) {
+                    // Log and continue
+                    console.warn('Could not create RSVP for guest', guest.guest_id, 'event', ev.event_id, e.message);
+                }
+            }
+        }
+
+        await client.query('COMMIT');
+
+        // Optionally send emails after commit
+        if (sendEmails) {
+            for (const guest of inserted) {
+                if (!guest.email) continue;
+                try {
+                    // Build event links
+                    const eventLinks = events.map(ev => {
+                        const token = crypto.createHmac('sha256', 'wedding_rsvp_secret').update(`${guest.guest_id}-${ev.event_id}`).digest('hex');
+                        const base = `http://localhost:${PORT}`;
+                        return `
+                            <tr>
+                              <td style="padding:8px 0; font-size:15px; color:#2c1f1f;">
+                                <strong>${ev.event_type}</strong> — ${ev.date} ${ev.start_time}–${ev.end_time}
+                              </td>
+                              <td style="padding:8px 0; text-align:right;">
+                                <a href="${base}/rsvp.html?guest=${guest.guest_id}&event=${ev.event_id}&token=${token}&action=accepted" style="background:#3a9e6b;color:#fff;padding:6px 14px;border-radius:6px;text-decoration:none;margin-right:6px;font-size:13px;">✅ Accept</a>
+                                <a href="${base}/rsvp.html?guest=${guest.guest_id}&event=${ev.event_id}&token=${token}&action=declined" style="background:#c94545;color:#fff;padding:6px 14px;border-radius:6px;text-decoration:none;font-size:13px;">❌ Decline</a>
+                              </td>
+                            </tr>`;
+                    }).join('');
+
+                    const mailOptions = {
+                        from: `"Wedding Planner" <${process.env.EMAIL_USER}>`,
+                        to: guest.email,
+                        subject: `You're Invited! 💍 ${req.session.user.first_name} & ${req.session.user.last_name}'s Wedding`,
+                        html: `
+                            <div style="font-family:'DM Sans',Arial,sans-serif;max-width:600px;margin:auto;background:#fdf8f3;border-radius:12px;overflow:hidden;border:1px solid #ecddd0;">
+                              <div style="background:linear-gradient(135deg,#d4606a,#e8949c);padding:32px;text-align:center;">
+                                <div style="font-size:36px;margin-bottom:8px;">💍</div>
+                                <h1 style="color:#fff;font-size:26px;margin:0;">You're Invited!</h1>
+                                <p style="color:rgba(255,255,255,0.9);margin:8px 0 0;">Wedding Invitation</p>
+                              </div>
+                              <div style="padding:32px;">
+                                <p style="font-size:16px;color:#2c1f1f;">Dear <strong>${guest.first_name} ${guest.last_name}</strong>,</p>
+                                <p style="font-size:15px;color:#6b4f4f;line-height:1.6;">Please RSVP for the events below:</p>
+                                <table style="width:100%;border-collapse:collapse;">${eventLinks}</table>
+                              </div>
+                              <div style="background:#f2e8db;padding:16px;text-align:center;"></div>
+                            </div>`
+                    };
+                    await transporter.sendMail(mailOptions);
+                } catch (mailErr) {
+                    console.warn('Failed to send invite to', guest.email, mailErr.message);
+                }
+            }
+        }
+
+        client.release();
+        res.json({ inserted: inserted.length, guests: inserted });
+    } catch (err) {
+        try { await client.query('ROLLBACK'); } catch (e) { /* ignore */ }
+        client.release();
+        console.error('Bulk guest insert error:', err.message);
+        if (err instanceof ApiError) return res.status(err.status).json({ error: err.message });
+        res.status(500).json({ error: 'Server error during bulk guest insert.' });
+    }
 });
 
@@ -83,4 +193,104 @@
 
 // =============================================================
+//  Service layer: Booking validation utilities
+// =============================================================
+class ApiError extends Error {
+    constructor(status, message) {
+        super(message);
+        this.status = status;
+    }
+}
+
+const BookingService = {
+    // Normalize date value (DATE from PG may be string or Date)
+    _fmtDate(d) {
+        if (!d) return null;
+        if (d instanceof Date) return d.toISOString().slice(0,10);
+        // assume string YYYY-MM-DD
+        return String(d).slice(0,10);
+    },
+
+    // Check if two time intervals overlap: [s1,e1) and [s2,e2)
+    isOverlapping(s1, e1, s2, e2) {
+        if (!s1 || !e1 || !s2 || !e2) return false;
+        // times are strings like HH:MM:SS or HH:MM
+        const toSec = t => {
+            const parts = String(t).split(':').map(Number);
+            return (parts[0]||0)*3600 + (parts[1]||0)*60 + (parts[2]||0);
+        };
+        const a1 = toSec(s1), b1 = toSec(e1), a2 = toSec(s2), b2 = toSec(e2);
+        return a1 < b2 && a2 < b1;
+    },
+
+    // Gather all bookings/events for a given wedding and date
+    async getBookingsForWeddingDate(wedding_id, date) {
+        const q = `
+            SELECT 'venue' AS type, booking_id AS id, start_time, end_time
+            FROM project.venue_booking WHERE wedding_id=$1 AND "date"=$2
+            UNION ALL
+            SELECT 'church' AS type, booking_id AS id, start_time, end_time
+            FROM project.church_booking WHERE wedding_id=$1 AND "date"=$2
+            UNION ALL
+            SELECT 'registrar' AS type, booking_id AS id, start_time, end_time
+            FROM project.registrar_booking WHERE wedding_id=$1 AND "date"=$2
+            UNION ALL
+            SELECT 'photographer' AS type, booking_id AS id, start_time, end_time
+            FROM project.photographer_booking WHERE wedding_id=$1 AND "date"=$2
+            UNION ALL
+            SELECT 'band' AS type, booking_id AS id, start_time, end_time
+            FROM project.band_booking WHERE wedding_id=$1 AND "date"=$2
+            UNION ALL
+            SELECT 'event' AS type, event_id AS id, start_time, end_time
+            FROM project.event WHERE wedding_id=$1 AND "date"=$2
+        `;
+        const res = await pool.query(q, [wedding_id, date]);
+        return res.rows;
+    },
+
+    // Validate booking date equals wedding date
+    async validateDateMatchesWedding(wedding_id, date) {
+        // Use SQL date cast/comparison to avoid client-side format issues
+        const r = await pool.query('SELECT 1 FROM project.wedding WHERE wedding_id=$1 AND "date" = $2::date', [wedding_id, date]);
+        if (r.rows.length === 0) {
+            // Determine whether wedding not found or date mismatch
+            const exists = await pool.query('SELECT 1 FROM project.wedding WHERE wedding_id=$1', [wedding_id]);
+            if (exists.rows.length === 0) throw new ApiError(404, 'Wedding not found.');
+            throw new ApiError(400, 'Booking is only allowed on the wedding date.');
+        }
+    },
+
+    // Validate time slot overlap across all bookings for the wedding/date
+    // exclude optional { type, id } to allow updating existing record
+    async validateNoOverlap(wedding_id, date, start_time, end_time, exclude) {
+        const bookings = await BookingService.getBookingsForWeddingDate(wedding_id, date);
+        for (const b of bookings) {
+            if (exclude && String(exclude.type) === String(b.type) && String(exclude.id) === String(b.id)) continue;
+            if (BookingService.isOverlapping(start_time, end_time, b.start_time, b.end_time)) {
+                throw new ApiError(409, 'Time slot conflict detected: this booking overlaps with another scheduled event.');
+            }
+        }
+    },
+
+    // Registrar location must match wedding venue location for that wedding date
+    // We require an existing venue booking on the wedding date and compare locations
+    async validateRegistrarLocation(wedding_id, date, registrar_id) {
+        // find registrar
+        const r = await pool.query('SELECT location FROM project.registrar WHERE registrar_id=$1', [registrar_id]);
+        if (r.rows.length === 0) throw new ApiError(404, 'Registrar not found.');
+        const regLoc = r.rows[0].location;
+
+        // find venue booking(s) for the wedding on the date
+        const vb = await pool.query('SELECT v.location FROM project.venue_booking vb JOIN project.venue v ON vb.venue_id=v.venue_id WHERE vb.wedding_id=$1 AND vb."date"=$2', [wedding_id, date]);
+        if (vb.rows.length === 0) {
+            // no venue booked on that date -> not allowed
+            throw new ApiError(400, 'Registrar booking is only allowed at the wedding venue location.');
+        }
+        // require at least one matching venue location
+        const match = vb.rows.some(x => String(x.location).trim().toLowerCase() === String(regLoc).trim().toLowerCase());
+        if (!match) throw new ApiError(400, 'Registrar booking is only allowed at the wedding venue location.');
+    }
+};
+
+// =============================================================
 //  EMAIL TRANSPORTER
 // =============================================================
@@ -323,4 +533,8 @@
         return res.status(400).json({ error: 'event_type, date, start_time, end_time are required.' });
     try {
+        // Business validations
+        await BookingService.validateDateMatchesWedding(req.params.wid, date);
+        await BookingService.validateNoOverlap(req.params.wid, date, start_time, end_time, null);
+
         const result = await pool.query(
             `INSERT INTO project.event(event_type,"date",start_time,end_time,status,wedding_id)
@@ -331,4 +545,5 @@
     } catch (err) {
         console.error(err.message);
+        if (err instanceof ApiError) return res.status(err.status).json({ error: err.message });
         res.status(500).json({ error: 'Server error.' });
     }
@@ -339,4 +554,13 @@
     const { event_type, date, start_time, end_time, status } = req.body;
     try {
+        // fetch existing event to know wedding_id and current values
+        const evRes = await pool.query('SELECT * FROM project.event WHERE event_id=$1', [req.params.id]);
+        if (evRes.rows.length === 0) return res.status(404).json({ error: 'Event not found.' });
+        const ev = evRes.rows[0];
+        const weddingId = ev.wedding_id;
+        // Validate date matches wedding and no overlap (exclude this event)
+        await BookingService.validateDateMatchesWedding(weddingId, date);
+        await BookingService.validateNoOverlap(weddingId, date, start_time, end_time, { type: 'event', id: req.params.id });
+
         const result = await pool.query(
             `UPDATE project.event SET event_type=$1,"date"=$2,start_time=$3,end_time=$4,status=$5
@@ -348,4 +572,5 @@
     } catch (err) {
         console.error(err.message);
+        if (err instanceof ApiError) return res.status(err.status).json({ error: err.message });
         res.status(500).json({ error: 'Server error.' });
     }
@@ -778,4 +1003,8 @@
     // Check availability: no overlapping booking for same venue on same date
     try {
+        // Business validations
+        await BookingService.validateDateMatchesWedding(req.params.wid, date);
+        await BookingService.validateNoOverlap(req.params.wid, date, start_time, end_time, null);
+
         const conflict = await pool.query(
             `SELECT booking_id FROM project.venue_booking
@@ -795,4 +1024,5 @@
     } catch (err) {
         console.error(err.message);
+        if (err instanceof ApiError) return res.status(err.status).json({ error: err.message });
         res.status(500).json({ error: 'Server error.' });
     }
@@ -848,4 +1078,7 @@
         return res.status(400).json({ error: 'date, start_time, end_time and band_id are required.' });
     try {
+        // Business validations
+        await BookingService.validateDateMatchesWedding(req.params.wid, date);
+        await BookingService.validateNoOverlap(req.params.wid, date, start_time, end_time, null);
         const result = await pool.query(
             `INSERT INTO project.band_booking("date",start_time,end_time,status,band_id,wedding_id)
@@ -856,4 +1089,5 @@
     } catch (err) {
         console.error(err.message);
+        if (err instanceof ApiError) return res.status(err.status).json({ error: err.message });
         res.status(500).json({ error: 'Server error.' });
     }
@@ -909,4 +1143,7 @@
         return res.status(400).json({ error: 'date, start_time, end_time and photographer_id are required.' });
     try {
+        // Business validations
+        await BookingService.validateDateMatchesWedding(req.params.wid, date);
+        await BookingService.validateNoOverlap(req.params.wid, date, start_time, end_time, null);
         const result = await pool.query(
             `INSERT INTO project.photographer_booking("date",start_time,end_time,status,photographer_id,wedding_id)
@@ -917,4 +1154,5 @@
     } catch (err) {
         console.error(err.message);
+        if (err instanceof ApiError) return res.status(err.status).json({ error: err.message });
         res.status(500).json({ error: 'Server error.' });
     }
@@ -977,4 +1215,7 @@
         return res.status(400).json({ error: 'date, start_time, end_time and church_id are required.' });
     try {
+        // Business validations
+        await BookingService.validateDateMatchesWedding(req.params.wid, date);
+        await BookingService.validateNoOverlap(req.params.wid, date, start_time, end_time, null);
         const result = await pool.query(
             `INSERT INTO project.church_booking("date",start_time,end_time,status,church_id,wedding_id)
@@ -985,4 +1226,5 @@
     } catch (err) {
         console.error(err.message);
+        if (err instanceof ApiError) return res.status(err.status).json({ error: err.message });
         res.status(500).json({ error: 'Server error.' });
     }
@@ -1038,4 +1280,9 @@
         return res.status(400).json({ error: 'date, start_time, end_time and registrar_id are required.' });
     try {
+        // Business validations
+        await BookingService.validateDateMatchesWedding(req.params.wid, date);
+        await BookingService.validateNoOverlap(req.params.wid, date, start_time, end_time, null);
+        await BookingService.validateRegistrarLocation(req.params.wid, date, registrar_id);
+
         const result = await pool.query(
             `INSERT INTO project.registrar_booking("date",start_time,end_time,status,registrar_id,wedding_id)
@@ -1046,4 +1293,5 @@
     } catch (err) {
         console.error(err.message);
+        if (err instanceof ApiError) return res.status(err.status).json({ error: err.message });
         res.status(500).json({ error: 'Server error.' });
     }
