template-monorepo/internal/model/notification/README.md

32 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

ji3
## 擴充指南
### 新增 Email Provider
已內建:`smtp_sender.go`、`ses_sender.go`。若要再加其他 ESP
1.`provider/email/` 實作 `Sender``Name`、`Sort`、`Send`)。
2.`config/config.go` 加設定區塊,並在 `collectEmailSenders` 註冊。
3.`provider/email/*_test.go`
### 新增 NotifyKind
1. `domain/enum/kind.go` 常數。
2. embed 模板 + `template/registry.go`
3. 若為 OTP 類,業務呼叫時設 `DoNotPersistBody: true`
### 新增 HTTP API
1.`generate/api/` 定義路由。
2. `make gen-api`
3. `internal/logic` 只呼叫 `domain/usecase` 介面,做 types ↔ DTO 映射。
---
## 相關文件
- [docs/model.md](../../../docs/model.md) — `domain/` 分包、Redis/Mongo 連線生命週期、gomock 方案 A
- [docs/identity-member-design.md §11](../../../docs/identity-member-design.md#11-notification-module) — 產品級設計與決策
- [internal/library/redis/README.md](../../library/redis/README.md) — 共用 Redis 連線
- [internal/library/mongo/README.md](../../library/mongo/README.md) — Mongo 存取層