Skip to content

feat: 實作 Hard Delete 功能與 Google OAuth 登入#1

Merged
eric23489 merged 10 commits intomainfrom
feature/hard-delete
Feb 9, 2026
Merged

feat: 實作 Hard Delete 功能與 Google OAuth 登入#1
eric23489 merged 10 commits intomainfrom
feature/hard-delete

Conversation

@eric23489
Copy link
Owner

Summary

  • 實作 Hard Delete 功能 (Project/Point/Deployment/Audio/Recorder),支援永久刪除資源及相關 MinIO 物件
  • 實作 Google OAuth 登入與密碼重設功能
  • 新增單元測試,測試覆蓋率提升至 85%
  • 新增開發文件與範本 (delete-patterns.md, changelog.md)

Changes

  • Hard Delete API: DELETE /api/v1/{resources}/{id}/permanent (需 Admin 權限)
  • Google OAuth: 支援 Google 帳號登入與帳號綁定
  • 密碼重設: 透過 Email 發送重設連結
  • 測試: 新增 734 行 Hard Delete 測試、OAuth 與密碼重設測試

Test plan

  • Hard Delete 功能測試通過
  • OAuth 服務單元測試通過
  • 密碼重設服務測試通過
  • 整體測試覆蓋率達 85%

🤖 Generated with Claude Code

eric23489 and others added 10 commits February 4, 2026 16:22
- docker-compose.yml: 新增 PostgreSQL healthcheck 和服務依賴條件
- alembic.ini: 啟用 ruff hook 和時間戳檔名格式
- requirements.txt: 新增 requests 套件
- scripts/: 新增 TaiwanPower 資料匯入/刪除腳本
- alembic: 新增 migration merge heads

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- 新增 .claude/docs/delete-patterns.md 完整範本
- 更新 claude.md 增加 Hard Delete 和多角色討論模式說明
- 修正刪除順序描述為 4 步驟流程
- 擴充架構師提問範本 (6 維度 + 方案比較表)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
新增永久刪除功能:
- API: DELETE /api/v1/{resources}/{id}/permanent (需 Admin)
- 刪除順序: MinIO 物件 → MinIO Bucket → DB 記錄
- 級聯刪除: Project 層級刪除所有子記錄
- 名稱保留: 軟刪除名稱保留,Hard Delete 後釋放

變更檔案:
- 4 個 API endpoints 新增 /permanent 路由
- 4 個 services 新增 hard_delete 方法
- create 方法新增軟刪除名稱檢查

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
測試涵蓋:
- API 層權限檢查 (Admin required)
- Project/Point/Deployment/Audio 永久刪除
- Service 層 MinIO 物件刪除驗證
- 名稱釋放後可重用

新增 13 個測試案例,總測試數: 93

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
多角色討論模式:
- 新增測試工程師角色 (測試策略、覆蓋率、Mock 設計)

測試範本更新:
- 新增測試案例清單表格 (8 類型)
- API/Service/名稱釋放測試範本

Hard Delete 測試擴充 (13 -> 17):
- test_hard_delete_continues_when_minio_fails
- test_hard_delete_empty_project
- test_hard_delete_batch_over_1000_objects
- test_soft_deleted_name_is_reserved

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- 新增 Fixture 範本 (mock_normal_user)
- 擴充 API 層測試為完整可複製範例
- 擴充 Service 層測試含 MinIO 整合細節
- 擴充名稱釋放測試含完整 Mock 設置
- 文件從 307 行增加至 535 行

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- 建立 .claude/docs/changelog.md 記錄開發歷程 (Phase 1-3)
- 精簡 CLAUDE.md Section 7,改為連結至 changelog.md
- 移除 emoji 符號以符合專案規範

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- 新增 hard_delete_recorder API 端點 (需 Admin 權限)
- 新增 Deployment FK 引用檢查,有引用時拒絕刪除
- 新增軟刪除識別碼保留檢查 (brand/model/sn)
- 新增 8 個測試案例 (API/Service/名稱釋放)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- 新增 Google OAuth 登入/註冊 API
- 新增忘記密碼/重設密碼 API
- 新增 OAuth 帳號綁定/解除綁定 API
- 新增設定密碼 API (OAuth 帳號可設密碼)
- 更新 User Model 支援 OAuth 欄位
- 新增 28 個測試案例

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- 新增 test_user_service.py (19 個測試)
- 新增 test_auth.py (10 個測試)
- 新增 test_password_reset_service_unit.py (13 個測試)
- 新增 test_oauth_service_unit.py (17 個測試)
- 更新 changelog.md 記錄 Phase 5
- 新增計劃文件至 .claude/plans/

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@github-actions github-actions bot added documentation Improvements or additions to documentation database api size/XL labels Feb 9, 2026
@github-actions
Copy link

github-actions bot commented Feb 9, 2026

✅ Automated PR Review Summary

Status: passed

Results:

  • Code Quality Check: success
  • Run Tests: success
  • Security Check: success

Details:

  • Total checks: 3
  • Passed: 3
  • Failed: 0
  • Skipped: 0

🎉 All checks passed! Great work!


This is an automated review. For detailed logs, check the Actions tab.

@eric23489 eric23489 merged commit 0dbdf4c into main Feb 9, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api database documentation Improvements or additions to documentation size/XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant