Feat: Pagination and palette caching for scale

- Add pagination to products and made-to-order pages (20 per page)
- Cache color palette separately for ready-made and personalised
- Fix category queries to use select instead of include
- Calculate total page count for pagination UI
- Add Previous/Next pagination controls

Solves N+1 query problem on color palette generation. With 100+ products:
- Before: Loading all 10,000 products just for color palette
- After: Load palette once (cached 5 mins), show 20 products per page
This commit is contained in:
Andymick
2026-07-21 19:15:27 +01:00
parent 2dddf7d27a
commit 912dcc6ab3
4 changed files with 159 additions and 37 deletions
+2 -1
View File
@@ -154,7 +154,8 @@
"PowerShell(Stop-Process -Id 30912 -Force -ErrorAction SilentlyContinue)",
"Bash(psql postgresql://postgres:craft2prints@192.168.0.190:5432/craft2prints -c ' *)",
"Bash(node scripts/add-indexes.js)",
"Bash(curl -s http://127.0.0.1:3000)"
"Bash(curl -s http://127.0.0.1:3000)",
"Bash(curl -s http://127.0.0.1:3000/products)"
]
}
}