From e7e3fc8e00fe4541ad6c602b10e1feb8b47a9204 Mon Sep 17 00:00:00 2001 From: OG T Date: Tue, 31 Mar 2026 16:28:37 +0800 Subject: [PATCH] =?UTF-8?q?refactor(api):=20Phase=2022=20P2=20Protocol=20?= =?UTF-8?q?=E7=B0=BD=E5=90=8D=E4=BF=AE=E6=AD=A3=20+=20=E7=BC=BA=E5=A4=B1?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E8=A3=9C=E9=BD=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - IApprovalRepository.create() 簽名由 ApprovalRequestCreate 改為 dict (與實作一致) - 補齊 find_by_fingerprint() 和 increment_hit_count() Protocol 方法 2026-03-31 Claude Code (首席架構師 P2 修復) Co-Authored-By: Claude Opus 4.5 --- apps/api/src/repositories/interfaces.py | 39 +++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/apps/api/src/repositories/interfaces.py b/apps/api/src/repositories/interfaces.py index d79675c0..1a5c920b 100644 --- a/apps/api/src/repositories/interfaces.py +++ b/apps/api/src/repositories/interfaces.py @@ -34,8 +34,19 @@ class IApprovalRepository(Protocol): 實作: ApprovalDBRepository (PostgreSQL) """ - async def create(self, request: ApprovalRequestCreate) -> ApprovalRequest: - """建立新的 Approval""" + async def create(self, data: dict) -> ApprovalRequest: + """ + 建立新的 Approval + + Phase 22 P2: 簽名修正為 dict (與實作一致) + 2026-03-31 Claude Code (首席架構師 P2 修復) + + Args: + data: ApprovalRecord 建立資料 dict + + Returns: + ApprovalRequest + """ ... async def get_by_id(self, approval_id: UUID) -> ApprovalRequest | None: @@ -65,6 +76,30 @@ class IApprovalRepository(Protocol): """新增簽核""" ... + async def find_by_fingerprint( + self, + fingerprint: str, + ) -> ApprovalRequest | None: + """ + 根據指紋查找 Approval (告警收斂用) + + Phase 22 P2: 補齊缺失 Protocol 方法 + 2026-03-31 Claude Code (首席架構師 P2 修復) + """ + ... + + async def increment_hit_count( + self, + approval_id: UUID, + ) -> ApprovalRequest | None: + """ + 增加 hit_count (告警收斂用) + + Phase 22 P2: 補齊缺失 Protocol 方法 + 2026-03-31 Claude Code (首席架構師 P2 修復) + """ + ... + @runtime_checkable class IIncidentRepository(Protocol):