[feature] 整合每日自動同步(Cron Trigger,台北 06:00) - #74
Merged
Merged
Conversation
- wrangler.jsonc:triggers.crons "0 22 * * *";main 改指向自訂 worker.ts (轉發 OpenNext fetch + 新增 scheduled,並轉出 OpenNext 的 DO class) - scheduled 以同 isolate 的函式呼叫打內部 route /api/cron/integrations-autosync, 一次性 token 驗證(src/lib/cron-token.ts),env 由 OpenNext 照常填入 process.env - src/lib/integrations/autosync.ts:runScheduledSync,逐一、隔離地跑 Simpany(90 天發票 + 薪資申報,一月含去年)與 Wise(dryRun: false), 結果寫 config.lastAutoSync,操作紀錄 channel = system(migration 0028) - i18n:getServerT / runAsSystem,沒有 request 時用 zh-TW 字典;store.ts 改用 - 設定 › 整合:每列「自動同步」開關、上次自動同步結果、「立即執行自動同步」 - MCP:list_integrations 加 autoSync / lastAutoSync,新增 run_integration_sync, SERVER_VERSION 1.8.0 - docs:integrations.md 每日自動同步、deployment.md 自訂 worker 與 Cron Trigger
✅ SonarQube Quality Gate passed — pathorsAI_internal0 open issues on this PR. |
yui0303
approved these changes
Sep 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
每天台北 06:00 自動同步所有已開啟且連線中的整合,不用再手動按同步。
wrangler.jsonc加triggers.crons = ["0 22 * * *"];新的worker.ts照 OpenNext custom worker 做法包住.open-next/worker.js,加上scheduled。scheduled不直接 import 業務程式碼,而是在同一個 isolate 以函式呼叫 OpenNext fetch 打內部路由/api/cron/integrations-autosync,用一次性 token(只在記憶體、用完即刪)驗證;外部請求一律 404。run_integration_sync、list_integrations帶 autoSync / lastAutoSync(server 1.8.0)。system(migration 0028),不冒用任何使用者。runAsSystem內用 zh-TWcreateTranslator,網頁與 MCP 行為不變。部署:migration 0028 已套用到 prod(先在 prod 分支演練)。
驗證:tsc、lint、build、cf:build 通過,bundle 匯出
scheduled。