tractatus/src/routes/relationships.routes.js
TheFlow 2298d36bed fix(submissions): restructure Economist package and fix article display
- Create Economist SubmissionTracking package correctly:
  * mainArticle = full blog post content
  * coverLetter = 216-word SIR— letter
  * Links to blog post via blogPostId
- Archive 'Letter to The Economist' from blog posts (it's the cover letter)
- Fix date display on article cards (use published_at)
- Target publication already displaying via blue badge

Database changes:
- Make blogPostId optional in SubmissionTracking model
- Economist package ID: 68fa85ae49d4900e7f2ecd83
- Le Monde package ID: 68fa2abd2e6acd5691932150

Next: Enhanced modal with tabs, validation, export

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-24 08:47:42 +13:00

70 lines
1.9 KiB
JavaScript

/**
* Relationships Routes
* API endpoints for publication relationship CRM
*/
const express = require('express');
const router = express.Router();
const relationshipsController = require('../controllers/relationships.controller');
const { authenticateToken, requireAdmin } = require('../middleware/auth.middleware');
// All relationship routes require admin authentication
router.use(authenticateToken);
router.use(requireAdmin);
/**
* POST /api/relationships
* Create new relationship
*/
router.post('/', relationshipsController.createRelationship);
/**
* GET /api/relationships
* Get all relationships with optional filtering
* Query params: stage, priorities, minQuality
*/
router.get('/', relationshipsController.getRelationships);
/**
* GET /api/relationships/summary
* Get CRM summary statistics (must be before /:publicationId route)
*/
router.get('/summary', relationshipsController.getCRMSummary);
/**
* GET /api/relationships/:publicationId
* Get specific relationship
*/
router.get('/:publicationId', relationshipsController.getRelationship);
/**
* PUT /api/relationships/:publicationId
* Update relationship
*/
router.put('/:publicationId', relationshipsController.updateRelationship);
/**
* POST /api/relationships/:publicationId/sync
* Sync relationship statistics from submission data
*/
router.post('/:publicationId/sync', relationshipsController.syncRelationshipStats);
/**
* POST /api/relationships/:publicationId/editors
* Add or update editor contact
*/
router.post('/:publicationId/editors', relationshipsController.addEditor);
/**
* POST /api/relationships/:publicationId/interactions
* Add interaction record
*/
router.post('/:publicationId/interactions', relationshipsController.addInteraction);
/**
* DELETE /api/relationships/:publicationId
* Delete relationship
*/
router.delete('/:publicationId', relationshipsController.deleteRelationship);
module.exports = router;