本卡屬 FR-196(母卡 FR-196 母案(同清單上一張)),卡 P-1,第一期批 1。只改 jedi-python-package。依賴:無。

這張卡做什麼(白話)

通知中心的核心套件,第一棒。它只認識五個概念:事件代碼、收件人、主題物件、參數、管道,不認識任務、專案、掃描。本卡做的是:七張「產品要提供什麼」的接口定義(使用者名冊、範本、連結、投遞、即時、時鐘、租戶)、五張資料表與建表 SQL、業務程式要呼叫的那一行 notify() 的行為(查型錄、展開收件人角色、查每人設定、渲染、寫收件匣、交給投遞)。不含 REST 端點(P-2 做)。套件形狀照 jedi-bulletin,別自己發明一套。

reuse/extend/new

new(新套件,照型):目錄與 plugin 契約照 jedi-bulletin(plugin/contract.py adapters dataclass 守門四件無預設值、plugin/migrations.py::iter_migrations()、plugin/runtime.py);repo 繼承 jedi-common BaseRepositoryImpl;migration SQL 的 RLS/GRANT 照 jedi-bulletin migrations/002;port 命名照 jedi-bulletin domain/ports.py

在哪裡

repo:~/Projects/Jedicogy/module/jedi-python-package
改既有:jedi-python-package/pyproject.toml(workspace 若有列套件清單則加一列;沒有就不動)
改既有:jedi-python-package/README.md(25 支名冊加一列)
新開:jedi-notification-center/pyproject.toml(0.1.0;依賴 jedi-common、jedi-notification>=1.2.4)
新開:jedi-notification-center/jedi_notification_center/__init__.py(export notify、register、NotificationCenterAdapters、Role)
新開:jedi-notification-center/jedi_notification_center/domain/ports.py(IRecipientDirectory/ITemplateRenderer/ILinkResolver/IDeliveryGateway/IRealtimeNotifier/IClock/ITenantContext)
新開:jedi-notification-center/jedi_notification_center/domain/entities/(notification_event、inbox_item、user_setting、user_profile、maintenance 五個 entity+query entity)
新開:jedi-notification-center/jedi_notification_center/domain/repositories/(五張 repo 介面)
新開:jedi-notification-center/jedi_notification_center/infra/models/(五張 SQLAlchemy model,design.md §5.2 表 5-1~5-4+notification_maintenance)
新開:jedi-notification-center/jedi_notification_center/infra/repository/(五張 repo impl;inbox 的 list 走 (recipient_user_id, archived_at, read_at, created_at desc) 索引)
新開:jedi-notification-center/jedi_notification_center/infra/mapper/
新開:jedi-notification-center/jedi_notification_center/app/service/notify_service.py(`notify()`:查型錄 → 展開 Role → 查每人設定或預設 → 渲染 → 寫 inbox → 交 delivery port;型錄查不到寫 warning 回 None;recipients 空直接 return)
新開:jedi-notification-center/jedi_notification_center/plugin/contract.py、assembly.py、runtime.py、migrations.py
新開:jedi-notification-center/migrations/001-notification-center-tables.sql(五張表+索引)、002-notification-center-rls-grants.sql
新開:jedi-notification-center/tests/(port 假件;notify 寫 inbox、必收覆寫設定、型錄查不到不炸、Role 展開)
新開:jedi-notification-center/README.md(照 jedi-notification README 的「兩種用法」骨架)

怎麼做

驗收(首腦照這個驗)

套件 tests 綠(含:必收事件就算設定關了 inapp 仍寫 inbox;型錄查不到回 None 且 log warning;Role('tenant_admin') 經 port 展開;recipients 空不寫);iter_migrations() 回兩支;用套件 harness 或 sqlite 跑一次 notify() 後 inbox 有一列且 title 已渲染;0.1.0 不發版(收口才發)

必讀