Fase 1a: microservicio tcef-notifications (workers FCM v1 + email)
Sustituye el envío de push por la API legacy de GCM (muerta desde jun-2024) y saca el envío del observer de Meteor a una cola BullMQ controlada. - poller: consume 'notifications' pendientes (campos correctos; el cron viejo tenía un typo nofitied/emailNofitied que nunca casaba) - fcm-worker: firebase-admin (FCM HTTP v1), payload compatible con la app Flutter (FLUTTER_NOTIFICATION_CLICK, collapseKey=_id, data); purga tokens muertos sin reintentar - email-worker: nodemailer + plantillas new-fire portadas verbatim - idempotencia persistente: notification_sends, indice unico (notificationId, channel) -> sobrevive reinicios y replays - salvaguardas anti-spam: modos dry-run/shadow/canary/full, exclusion mutua por canal (OWNED_CHANNELS + notifDisabledChannels en Meteor), kill switch, limites por usuario/dia y circuit breaker por batch - docs/legacy-behavior.md (caracterizacion) + docs/rollout.md - 47 tests (vitest + mongodb-memory-server), typecheck y build OK - deploy: systemd + pm2 (Node 22 standalone) Falta el service account de Firebase para envio real de push (pedir al usuario).
This commit is contained in:
commit
d20e168c90
39 changed files with 8378 additions and 0 deletions
38
package.json
Normal file
38
package.json
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"name": "tcef-notifications",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"description": "Notification sending microservice for Todos contra el Fuego (FCM v1 + email, later Telegram). Replaces the dead node-gcm push path and the Meteor observer.",
|
||||
"type": "module",
|
||||
"engines": {
|
||||
"node": ">=22"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc -p tsconfig.json && node scripts/copy-templates.mjs",
|
||||
"typecheck": "tsc -p tsconfig.json --noEmit",
|
||||
"start": "node --enable-source-maps dist/index.js",
|
||||
"dev": "node --experimental-strip-types --watch src/index.ts",
|
||||
"test": "vitest run",
|
||||
"test:watch": "vitest"
|
||||
},
|
||||
"dependencies": {
|
||||
"bullmq": "^5.34.0",
|
||||
"firebase-admin": "^13.0.2",
|
||||
"handlebars": "^4.7.8",
|
||||
"ioredis": "^5.4.2",
|
||||
"juice": "^11.0.0",
|
||||
"luxon": "^3.5.0",
|
||||
"mongodb": "^6.12.0",
|
||||
"nodemailer": "^6.9.16",
|
||||
"pino": "^9.5.0",
|
||||
"pino-pretty": "^13.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/luxon": "^3.4.2",
|
||||
"@types/node": "^22.10.2",
|
||||
"@types/nodemailer": "^6.4.17",
|
||||
"mongodb-memory-server": "^11.2.0",
|
||||
"typescript": "^5.7.2",
|
||||
"vitest": "^2.1.8"
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue