merge: enable scheduled OA overtime todo dispatch

This commit is contained in:
jingchuan 2026-08-03 17:28:45 +08:00
commit a2040410e8

View File

@ -28,7 +28,7 @@ fi
cat >"$SERVICE_FILE" <<EOF
[Unit]
Description=Furniture OA new product board snapshot sync
Description=Furniture OA new product board snapshot and overtime todo sync
After=network-online.target
Wants=network-online.target
@ -40,14 +40,16 @@ EnvironmentFile=$APP_ENV
# Reuse the HR read-only credentials from the existing employee-directory sync.
# The leading '-' keeps the OA sync usable before that optional sync is installed.
EnvironmentFile=-$HR_SYNC_ENV
ExecStart=/bin/bash -lc 'cd "$APP_ROOT" && ./node_modules/.bin/tsx scripts/sync-oa-board.ts --apply'
# Keep the todo scan after the snapshot refresh so each decision uses the newest OA state.
# The global switch remains off by default and skips the todo scan until it is explicitly enabled.
ExecStart=/bin/bash -lc 'set -euo pipefail; cd "$APP_ROOT"; ./node_modules/.bin/tsx scripts/sync-oa-board.ts --apply; case "\${DINGTALK_TODO_ENABLED:-false}" in 1|true|TRUE|yes|YES|on|ON) ./node_modules/.bin/tsx scripts/sync-oa-board-todos.ts ;; *) echo "DingTalk OA overtime todo dispatch is disabled; skipping." ;; esac'
StandardOutput=journal
StandardError=journal
EOF
cat >"$TIMER_FILE" <<EOF
[Unit]
Description=Refresh furniture OA new product board snapshot every 15 minutes
Description=Refresh furniture OA board and dispatch enabled overtime todos every 15 minutes
[Timer]
OnBootSec=$SYNC_ON_BOOT_SEC