Skip to content

Commit 1676bf2

Browse files
committed
Update backup coverage for photo review queue.
Include upload session data in backup/restore docs and scripts, and bump backup version to reflect the new tables.
1 parent b9906aa commit 1676bf2

10 files changed

Lines changed: 242 additions & 16 deletions

File tree

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ Filadex provides multiple backup options to protect your data:
213213
| Print Jobs | ✅ Your jobs | ✅ All users | ✅ All |
214214
| Filament History | ✅ Your history | ✅ All users | ✅ All |
215215
| Slicer Profiles | ✅ Your profiles | ✅ All users | ✅ All |
216+
| Photo Import Review Queue | ✅ Your sessions | ✅ All users | ✅ All |
216217
| Material Compatibility | ✅ All | ✅ All | ✅ All |
217218
| User Sharing Settings | ✅ Your settings | ✅ All users | ✅ All |
218219
| Backup History | ✅ Your logs | ✅ All logs | ✅ All |
@@ -242,6 +243,8 @@ Filadex uses PostgreSQL with the following tables:
242243
| `user_sharing` | Public sharing settings |
243244
| `cloud_backup_configs` | Cloud backup provider configurations |
244245
| `backup_history` | Backup/restore operation logs |
246+
| `upload_sessions` | Photo import review sessions (QR/mobile uploads) |
247+
| `pending_uploads` | Pending photo imports tied to sessions |
245248

246249
### Key Fields in Filaments Table
247250

docs/API.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,7 +1197,7 @@ Downloads a JSON backup of the current user's data.
11971197
- **Response Body**:
11981198
```json
11991199
{
1200-
"version": "1.2",
1200+
"version": "1.4",
12011201
"backupType": "user",
12021202
"exportedAt": "2026-02-04T12:00:00.000Z",
12031203
"userSettings": {
@@ -1210,6 +1210,8 @@ Downloads a JSON backup of the current user's data.
12101210
"printJobs": [],
12111211
"slicerProfiles": [],
12121212
"filamentHistory": [],
1213+
"uploadSessions": [],
1214+
"pendingUploads": [],
12131215
"userSharing": [],
12141216
"backupHistory": [],
12151217
"manufacturers": [],
@@ -1240,6 +1242,8 @@ Restores data from a previously downloaded backup file.
12401242
"slicerProfiles": 2,
12411243
"filamentHistory": 15,
12421244
"userSharing": 1,
1245+
"uploadSessions": 2,
1246+
"pendingUploads": 8,
12431247
"materialCompatibility": 8,
12441248
"userSettings": true
12451249
}
@@ -1337,7 +1341,7 @@ Downloads a complete backup of all users' data (admin only).
13371341
- **Response Body**:
13381342
```json
13391343
{
1340-
"version": "1.2",
1344+
"version": "1.4",
13411345
"backupType": "admin_full",
13421346
"exportedAt": "2026-02-04T12:00:00.000Z",
13431347
"data": {
@@ -1346,6 +1350,8 @@ Downloads a complete backup of all users' data (admin only).
13461350
"printJobs": [],
13471351
"slicerProfiles": [],
13481352
"filamentHistory": [],
1353+
"uploadSessions": [],
1354+
"pendingUploads": [],
13491355
"userSharing": [],
13501356
"backupHistory": [],
13511357
"manufacturers": [],
@@ -1377,6 +1383,8 @@ Restores a complete system backup including all users (admin only).
13771383
"slicerProfiles": 10,
13781384
"filamentHistory": 100,
13791385
"userSharing": 5,
1386+
"uploadSessions": 6,
1387+
"pendingUploads": 20,
13801388
"materialCompatibility": 20
13811389
},
13821390
"note": "3 new users created with temporary password \"changeme\""

docs/DEVELOPMENT.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,8 @@ Backups are stored in `backups/` directory and include:
427427
- Uploaded filament images
428428
- Uploaded slicer profile files
429429

430+
The database dump includes photo import review queue data (`upload_sessions`, `pending_uploads`).
431+
430432
### Web UI Backups (JSON)
431433

432434
Access via **Tools > Cloud Backup** in the app:

scripts/SCRIPTS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,8 @@ filadex_backup_YYYYMMDD_HHMMSS/
202202
| `print_jobs` | Print job logs | name, filament usage, duration, status, timestamps |
203203
| `filament_history` | Usage history | filament_id, change_type, quantity, notes |
204204
| `slicer_profiles` | Slicer configs | name, slicer, material, settings JSON |
205+
| `upload_sessions` | Photo import sessions | user_id, expires_at, created_at |
206+
| `pending_uploads` | Pending photo imports | session_id, filename, status |
205207
| `material_compatibility` | Adhesion matrix | material1, material2, compatibility rating, notes |
206208
| `manufacturers` | Manufacturer list | name, sort_order |
207209
| `materials` | Material types | name, sort_order |

scripts/backup-docker.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ fi
2727
# Backup database (includes all tables)
2828
echo "💾 Backing up database..."
2929
echo " Tables: users, filaments, print_jobs, filament_history, slicer_profiles,"
30-
echo " filament_slicer_profiles, material_compatibility, user_sharing,"
31-
echo " manufacturers, materials, colors, diameters, storage_locations,"
32-
echo " backup_history"
30+
echo " filament_slicer_profiles, upload_sessions, pending_uploads,"
31+
echo " material_compatibility, user_sharing, manufacturers, materials,"
32+
echo " colors, diameters, storage_locations, backup_history"
3333
docker exec filadex-db-1 pg_dump -U filadex -d filadex > "${BACKUP_PATH}/database.sql"
3434
DB_SIZE=$(wc -c < "${BACKUP_PATH}/database.sql" | tr -d ' ')
3535
echo " ✅ Database backup: $(numfmt --to=iec-i --suffix=B $DB_SIZE 2>/dev/null || echo "${DB_SIZE} bytes")"

scripts/backup.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ fi
2727
# Backup database (includes all tables)
2828
echo "💾 Backing up database..."
2929
echo " Tables: users, filaments, print_jobs, filament_history, slicer_profiles,"
30-
echo " filament_slicer_profiles, material_compatibility, user_sharing,"
31-
echo " manufacturers, materials, colors, diameters, storage_locations,"
32-
echo " backup_history"
30+
echo " filament_slicer_profiles, upload_sessions, pending_uploads,"
31+
echo " material_compatibility, user_sharing, manufacturers, materials,"
32+
echo " colors, diameters, storage_locations, backup_history"
3333
docker exec filadex-db-dev pg_dump -U filadex_dev -d filadex_dev > "${BACKUP_PATH}/database.sql"
3434
DB_SIZE=$(wc -c < "${BACKUP_PATH}/database.sql" | tr -d ' ')
3535
echo " ✅ Database backup: $(numfmt --to=iec-i --suffix=B $DB_SIZE 2>/dev/null || echo "${DB_SIZE} bytes")"

scripts/restore-docker.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ BACKUP_FILE="${backups[$selection]}"
4040
echo ""
4141
echo "🔴 WARNING: This will OVERWRITE all PRODUCTION data!"
4242
echo " - All users, filaments, print jobs, history will be replaced"
43+
echo " - Photo review queue data will be replaced"
4344
echo " - All uploaded images and slicer profiles will be replaced"
4445
echo " Selected: $(basename "$BACKUP_FILE")"
4546
echo ""
@@ -68,9 +69,9 @@ EXTRACTED_DIR=$(ls "$TEMP_DIR")
6869
# Restore database
6970
echo "💾 Restoring database..."
7071
echo " Tables: users, filaments, print_jobs, filament_history, slicer_profiles,"
71-
echo " filament_slicer_profiles, material_compatibility, user_sharing,"
72-
echo " manufacturers, materials, colors, diameters, storage_locations,"
73-
echo " backup_history"
72+
echo " filament_slicer_profiles, upload_sessions, pending_uploads,"
73+
echo " material_compatibility, user_sharing, manufacturers, materials,"
74+
echo " colors, diameters, storage_locations, backup_history"
7475
docker exec -i filadex-db-1 psql -U filadex -d filadex -c "DROP SCHEMA public CASCADE; CREATE SCHEMA public;" > /dev/null 2>&1
7576
docker exec -i filadex-db-1 psql -U filadex -d filadex < "${TEMP_DIR}/${EXTRACTED_DIR}/database.sql" > /dev/null 2>&1
7677
echo " ✅ Database restored"

scripts/restore.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ BACKUP_FILE="${backups[$selection]}"
4040
echo ""
4141
echo "⚠️ WARNING: This will OVERWRITE all local development data!"
4242
echo " - All users, filaments, print jobs, history will be replaced"
43+
echo " - Photo review queue data will be replaced"
4344
echo " - All uploaded images and slicer profiles will be replaced"
4445
echo " Selected: $(basename "$BACKUP_FILE")"
4546
echo ""
@@ -68,9 +69,9 @@ EXTRACTED_DIR=$(ls "$TEMP_DIR")
6869
# Restore database
6970
echo "💾 Restoring database..."
7071
echo " Tables: users, filaments, print_jobs, filament_history, slicer_profiles,"
71-
echo " filament_slicer_profiles, material_compatibility, user_sharing,"
72-
echo " manufacturers, materials, colors, diameters, storage_locations,"
73-
echo " backup_history"
72+
echo " filament_slicer_profiles, upload_sessions, pending_uploads,"
73+
echo " material_compatibility, user_sharing, manufacturers, materials,"
74+
echo " colors, diameters, storage_locations, backup_history"
7475
docker exec -i filadex-db-dev psql -U filadex_dev -d filadex_dev -c "DROP SCHEMA public CASCADE; CREATE SCHEMA public;" > /dev/null 2>&1
7576
docker exec -i filadex-db-dev psql -U filadex_dev -d filadex_dev < "${TEMP_DIR}/${EXTRACTED_DIR}/database.sql" > /dev/null 2>&1
7677
echo " ✅ Database restored"

server/routes/admin.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import {
1919
filamentSlicerProfiles,
2020
cloudBackupConfigs,
2121
backupHistory,
22+
uploadSessions,
23+
pendingUploads,
2224
} from "../../shared/schema";
2325
import { authenticate, isAdmin, hashPassword } from "../auth";
2426
import { logger as appLogger } from "../utils/logger";
@@ -47,6 +49,8 @@ export function registerAdminRoutes(app: Express): void {
4749
// Delete dependent tables first
4850
await db.delete(filamentHistory);
4951
await db.delete(printJobs);
52+
await db.delete(pendingUploads);
53+
await db.delete(uploadSessions);
5054
await db.delete(filamentSlicerProfiles);
5155
await db.delete(slicerProfiles);
5256
await db.delete(userSharing);

0 commit comments

Comments
 (0)