本卡屬 FR-196(母卡 FR-196 母案(同清單上一張)),卡 M-1,第一期批 3。只改 BE(主 repo,Repo 欄空著)。依賴:P-1、P-2、S-1。

這張卡做什麼(白話)

主系統接上通知中心套件。套件靠七張接口跟產品連接,本卡把七張都用主系統既有的東西實作:誰是管理員用授權到期通知那份定義、使用者信箱語系用既有名冊、範本用既有 i18n、投遞用既有 jedi-notification、連結用型錄表裡的路由名、即時先不推。另外紅點旁的「我的待辦任務(N)」數字接既有的 task queue。做完後八條端點在主系統上打得通。🔴 DI 簽章漂移是靜默的,驗收一定要實打端點。

reuse/extend/new

照型 new:接線檔照 core/plugins/bulletin.py(build_adapters+mount+PLUGIN、host_defaults());port 實作 reuse:IRecipientDirectory 包 core/plugins/license.py::TenantAdminDirectory+UserDomainService.get_user_by_ids+ProjectParticipantDomainService;ITemplateRenderer 包 flask-babel _() 用型錄的 i18n key;ILinkResolver 讀型錄 link_route/link_params_template 做字串替換;IDeliveryGateway 包 app/notification/service/notification_service.py 的 send_mail_notification/discord/telegram;IRealtimeNotifier no-op;IClock 既有 now_provider;todo 數 reuse /flow-engine/task/queue 背後的 query

在哪裡

repo:~/Projects/Billows/Audit-Manager/compliance-manager-be
改既有:core/plugins/__init__.py(PLUGINS 加一列)
改既有:di_containers/containers.py(加 notification_center_container)
改既有:config/app_modules.py(若套件 blueprint 要登記則加;照 bulletin 的做法)
新開:core/plugins/notification_center.py
新開:core/plugins/_notification_center_ports.py(七張 port 實作,每張一個 class,檔不超 400 行)
新開:di_containers/notification_center/notification_center_containers.py
新開:common/code/notification_center_error_code.py(re-export 套件的四顆,字串值凍結)
新開:test/test_notification_center_mount.py(register 守門四件缺一拒掛;port 實作對 DEV 查得到管理員)

怎麼做

驗收(首腦照這個驗)

重啟 BE 後 curl -H 'Authorization: Bearer <token>' /api/1.0/notification-center/unread-count 回 {status:true,data:{unread:0,todo:N}}(N 與鈴鐺現在的待辦數相同);GET /settings 回 23 列;DEV 用 cmmgr 手插一列 inbox 給自己後 unread=1、inbox/recent 看得到、PATCH read 後 unread=0;cm_app 身分 SELECT inbox 只看到自己租戶;FE src/config/locales/i18n/{zh-tw,en}/error-code.json 多四條(🔴 本卡是 error-code.json 的 owner,F-3 不碰)

必讀