Files
Edu/services/msg
SpecialX 0a71b02e04
Some checks failed
CI / quality-ts (push) Failing after 48s
CI / quality-go (push) Failing after 4s
CI / quality-proto (push) Failing after 2s
CI / deploy (push) Has been skipped
fix: code compliance audit and fix across all services
NestJS (6 services): implement @RequirePermission decorator with
SetMetadata+Reflector, register APP_GUARD globally, fix as assertions
to type guards, add explicit return types, fix import type for express,
fix /metrics implicit any, replace native Error with ApplicationError,
remove typeorm remnants, register LifecycleService.

teacher-bff: add logger, ApplicationError, GlobalErrorFilter, forward
real userId to downstream, log downstream failures, migrate health
controller to shared/health.

Go (2 services): interface to any, doc comments, CORS dev whitelist,
JWT secret fail-fast, push-gateway internal API auth, metrics and
readyz endpoints, remove dead code.

Python (2 services): lifespan return type, dev_mode to bool, data-ana
APIRouter, ai POST body model, ClickHouse async wrapping.
2026-07-09 17:28:27 +08:00
..

Msg 消息通知服务

版本0.1P5 骨架) 端口3007

职责

消息通知限界上下文,管理通知的多渠道分发(站内信、邮件、短信、推送)。 消费 Kafka 事件,写入 MySQL + Elasticsearch调用 Push Gateway 实时推送。

技术栈

  • NestJS 10 + TypeScript 5
  • Drizzle ORM + MySQL 8
  • Elasticsearch 8全文检索
  • Kafka事件消费骨架
  • pino + prom-client + OpenTelemetry

开发

pnpm install
pnpm dev   # http://localhost:3007

API

方法 路径 说明
POST /notifications 发送通知
GET /notifications 查询用户通知列表
POST /notifications/:id/read 标记已读
GET /notifications/search?q= 全文检索通知

健康检查

端点 用途 鉴权
GET /healthz 存活探针liveness仅返回进程状态不检查依赖
GET /readyz 就绪探针readiness检查 DB 连接,失败返回 503

实现见 src/shared/health/health.controller.ts5 个 NestJS 服务iam/core-edu/content/msg/classes一致。

环境变量

变量 默认值 说明
PORT 3007 服务端口
DATABASE_URL - MySQL 连接串
KAFKA_BROKERS localhost:9092 Kafka broker 列表
ES_URL http://localhost:9200 Elasticsearch 地址
JWT_SECRET - JWT 密钥