tractatus/src/models
TheFlow 973be3e61d feat: Implement newsletter email sending functionality (Phase 3)
Complete implementation of newsletter sending system with SendGrid integration:

Backend Implementation:
- EmailService class with template rendering (Handlebars)
- sendNewsletter() method with subscriber iteration
- Preview and send controller methods
- Admin routes with CSRF protection and authentication
- findByInterest() method in NewsletterSubscription model

Frontend Implementation:
- Newsletter send form with validation
- Preview functionality (opens in new window)
- Test send to single email
- Production send to all tier subscribers
- Real-time status updates

Dependencies:
- handlebars (template engine)
- @sendgrid/mail (email delivery)
- html-to-text (plain text generation)

Security:
- Admin-only routes with authentication
- CSRF protection on all POST endpoints
- Input validation and sanitization
- Confirmation dialogs for production sends

Next steps: Configure SendGrid API key in environment variables

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-04 11:32:39 +13:00
..
ActivityTimeline.model.js feat(crm): complete Phase 3 multi-project CRM + critical bug fixes 2025-10-24 18:10:14 +13:00
Analytics.model.js fix(analytics): remove SessionSchema.index sessionId duplicate 2025-10-24 10:25:02 +13:00
AuditLog.model.js feat(research): add cross-environment audit log sync infrastructure 2025-10-27 12:11:16 +13:00
BlogPost.model.js feat: Add comprehensive visitor retention system 2025-11-04 10:42:43 +13:00
CaseSubmission.model.js fix(submissions): restructure Economist package and fix article display 2025-10-24 08:47:42 +13:00
Contact.model.js feat(crm): implement unified contact form system 2025-10-24 16:56:21 +13:00
DeliberationSession.model.js chore: update dependencies and documentation 2025-10-19 12:48:37 +13:00
DiskMetrics.model.js feat: add disk monitoring system for dev and production 2025-10-29 11:53:55 +13:00
Document.model.js fix(submissions): restructure Economist package and fix article display 2025-10-24 08:47:42 +13:00
Donation.model.js refactor(lint): fix code style and unused variables across src/ 2025-10-24 20:15:26 +13:00
Feedback.model.js feat: Complete Phase 2 - Agent Lightning integration and Discord community launch 2025-11-03 12:52:26 +13:00
GovernanceLog.model.js feat: fix documentation system - cards, PDFs, TOC, and navigation 2025-10-07 22:51:55 +13:00
GovernanceRule.model.js fix(models): remove duplicate schema indexes for clean startup 2025-10-12 16:35:45 +13:00
index.js feat(server): add security middleware and website-specific routes 2025-10-23 10:57:20 +13:00
MediaInquiry.model.js feat(cultural-sensitivity): implement Phase 1 - detection and flagging (inst_081) 2025-10-25 11:10:06 +13:00
MissedBreach.model.js feat(research): add missed breach tracking system for framework effectiveness measurement 2025-10-27 12:26:53 +13:00
ModerationQueue.model.js refactor(lint): fix code style and unused variables across src/ 2025-10-24 20:15:26 +13:00
NewsletterSubscription.model.js feat: Implement newsletter email sending functionality (Phase 3) 2025-11-04 11:32:39 +13:00
Organization.model.js feat(crm): complete Phase 3 multi-project CRM + critical bug fixes 2025-10-24 18:10:14 +13:00
Precedent.model.js chore: update dependencies and documentation 2025-10-19 12:48:37 +13:00
Project.model.js refactor(lint): fix code style and unused variables across src/ 2025-10-24 20:15:26 +13:00
PublicationRelationship.model.js fix(submissions): restructure Economist package and fix article display 2025-10-24 08:47:42 +13:00
ResearchInquiry.model.js feat(api): implement research inquiry endpoint and Umami analytics 2025-10-29 01:31:02 +13:00
Resource.model.js fix(submissions): restructure Economist package and fix article display 2025-10-24 08:47:42 +13:00
ResponseTemplate.model.js feat(governance): extend framework checks to all external communications 2025-10-25 09:53:09 +13:00
ScheduledTask.model.js refactor(lint): fix code style and unused variables across src/ 2025-10-24 20:15:26 +13:00
SessionState.model.js fix: MongoDB persistence and inst_016-018 content validation enforcement 2025-10-11 00:17:03 +13:00
SLATracking.model.js refactor(lint): fix code style and unused variables across src/ 2025-10-24 20:15:26 +13:00
SubmissionTracking.model.js fix(submissions): resolve Mongoose populate error for hybrid BlogPost model 2025-10-24 10:19:33 +13:00
SyncMetadata.model.js feat(research): add cross-environment audit log sync infrastructure 2025-10-27 12:11:16 +13:00
UnifiedContact.model.js feat(crm): complete Phase 3 multi-project CRM + critical bug fixes 2025-10-24 18:10:14 +13:00
User.model.js fix(submissions): restructure Economist package and fix article display 2025-10-24 08:47:42 +13:00
VariableValue.model.js refactor(lint): fix code style and unused variables across src/ 2025-10-24 20:15:26 +13:00
VerificationLog.model.js chore(framework): session tracking, test enforcement, and schema improvements 2025-10-21 04:05:09 +13:00