feat: Add stale process monitor, users route, landing page, archive old scripts
- Add backend stale process monitoring API (/api/stale-processes) - Add users management route - Add frontend landing page and stale process monitor UI on /scraper-tools - Move old development scripts to backend/archive/ - Update frontend build with new features 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
48
backend/archive/fix-category-urls.ts
Normal file
48
backend/archive/fix-category-urls.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import { pool } from './src/db/migrate';
|
||||
import { dutchieTemplate } from './src/scrapers/templates/dutchie';
|
||||
|
||||
async function fixCategoryUrls() {
|
||||
console.log('🔧 Fixing category URLs for Dutchie stores\n');
|
||||
|
||||
try {
|
||||
// Get all categories with /shop/ in the URL
|
||||
const result = await pool.query(`
|
||||
SELECT id, store_id, name, slug, dutchie_url
|
||||
FROM categories
|
||||
WHERE dutchie_url LIKE '%/shop/%'
|
||||
ORDER BY store_id, id
|
||||
`);
|
||||
|
||||
console.log(`Found ${result.rows.length} categories to fix:\n`);
|
||||
|
||||
for (const category of result.rows) {
|
||||
console.log(`Category: ${category.name}`);
|
||||
console.log(` Old URL: ${category.dutchie_url}`);
|
||||
|
||||
// Extract base URL (everything before /shop/)
|
||||
const baseUrl = category.dutchie_url.split('/shop/')[0];
|
||||
|
||||
// Use template to build correct URL
|
||||
const newUrl = dutchieTemplate.buildCategoryUrl(baseUrl, category.name);
|
||||
|
||||
console.log(` New URL: ${newUrl}`);
|
||||
|
||||
// Update the category
|
||||
await pool.query(`
|
||||
UPDATE categories
|
||||
SET dutchie_url = $1
|
||||
WHERE id = $2
|
||||
`, [newUrl, category.id]);
|
||||
|
||||
console.log(` ✅ Updated\n`);
|
||||
}
|
||||
|
||||
console.log(`\n✅ All category URLs fixed!`);
|
||||
} catch (error) {
|
||||
console.error('❌ Error:', error);
|
||||
} finally {
|
||||
await pool.end();
|
||||
}
|
||||
}
|
||||
|
||||
fixCategoryUrls();
|
||||
Reference in New Issue
Block a user