allowing admin to choose which folders get synced

This commit is contained in:
C-West8
2026-10-23 12:55:14 -05:00
parent fbd81b0b45
commit 3ca266acc3
30 changed files with 1109 additions and 120 deletions

View File

@@ -10,6 +10,7 @@
| Scope | Many projects per server; each project is a 1:1 pair of SharePoint root and ACC root |
| ACC ownership | Only touch ACC items this tool created; hand-added ACC content is left alone |
| Ignored files | Temp/lock/system files are skipped silently (not issues) |
| Excluded | Admins can untick folders per project (all sync by default); excluding deletes the tool's ACC copies, re-including restores |
| Retries | 3 attempts across runs, then surface as an issue |
| Files | Small/medium documents; no large Revit models |
| Hosting | One Docker container (Portainer), SQLite on a volume |
@@ -70,6 +71,8 @@ An item whose new parent is outside the root counts as deleted. That covers "rem
**Restored folders:** a folder delete cascades "deleted" to everything stored under it. If a deleted folder later reappears, its contents may not be reported one by one, so ingest asks for one follow-up **full listing** in the same run, which brings them back.
**Excluded folders:** an admin can untick folders on the project's admin page; their IDs are stored on the project. Ingest still tracks everything under them, so `desired` stays accurate. Between ingest and reconcile, each run sets `excluded` on every item that is, or sits under, an excluded folder (by SharePoint's current layout, so moves in and out count). Reconcile treats excluded like deleted: the folder's ACC copy is deleted with one call, which covers its contents. Unticking it again clears the flag, and the tombstoned ACC items are restored. Saving the choice updates the flags straight away, so the status page shows the change before the next run.
## Interfaces (ports)
The source of truth is [`src/lib/server/sync/core/ports.ts`](../src/lib/server/sync/core/ports.ts):
@@ -108,6 +111,7 @@ projects
id, name, enabled, paused_reason
sp_site_id, sp_drive_id, sp_root_item_id, sp_display_path
acc_hub_id, acc_project_id, acc_root_folder_id, acc_display_path
excluded_folder_ids -- JSON array of SharePoint folder IDs
delta_cursor, first_synced_at, last_run_at, created_at
items PK (project_id, source_id)
@@ -116,7 +120,8 @@ items PK (project_id, source_id)
-- synced (what ACC has)
target_id, synced_parent_source_id, synced_name, synced_content_tag, synced_deleted, synced_at
-- bookkeeping
status ('synced' | 'pending' | 'failed' | 'deleted')
excluded -- in or under a folder an admin excluded
status ('synced' | 'pending' | 'failed' | 'deleted' | 'excluded')
attempt_count, last_error, last_attempt_at
runs