feat(config,workspace,user): jobs/notify config + workspace fetch repo + user ListAdmins

This commit is contained in:
2026-05-06 09:10:43 +08:00
parent 895799a6c9
commit 7b3892c42e
13 changed files with 338 additions and 6 deletions
+20
View File
@@ -41,3 +41,23 @@ SET sync_status = 'error',
last_sync_error = 'process_restarted_during_' || sync_status,
updated_at = now()
WHERE sync_status IN ('cloning', 'syncing');
-- name: ListFetchTargets :many
SELECT w.id, p.owner_id, w.name, w.main_path
FROM workspaces w
JOIN projects p ON p.id = w.project_id
WHERE w.archived_at IS NULL
AND w.sync_status IN ('idle','error')
ORDER BY w.id;
-- name: MarkSyncingCAS :execrows
UPDATE workspaces SET sync_status='syncing', updated_at=now()
WHERE id=$1 AND sync_status IN ('idle','error');
-- name: MarkFetchResult :exec
UPDATE workspaces
SET sync_status = CASE WHEN $2::bool THEN 'idle' ELSE 'error' END,
last_synced_at = CASE WHEN $2::bool THEN now() ELSE last_synced_at END,
last_sync_error = $3,
updated_at = now()
WHERE id = $1;