feat(backend): update collections, config and migration tools

Update Payload CMS configuration, collections (Audit, Posts), and add migration scripts/reports.
This commit is contained in:
2026-02-11 11:50:23 +08:00
parent 8ca609a889
commit be7fc902fb
46 changed files with 5442 additions and 15 deletions

View File

@@ -0,0 +1,46 @@
#!/usr/bin/env tsx
/**
* Test CSV Parser (No MongoDB required)
*/
import { parseWebflowCSV } from './csvParser'
import { Logger } from './utils'
const logger = new Logger(true)
async function main() {
const csvPath = process.argv[2] || '../../恩群數位行銷 - 行銷放大鏡集 - 61f24aa108528b279f942ca9.csv'
logger.header('🧪 Testing CSV Parser')
logger.info(`File: ${csvPath}`)
try {
const data = await parseWebflowCSV(csvPath)
logger.success(`✓ CSV parsed successfully!`)
logger.info(`Posts: ${data.posts?.length || 0}`)
logger.info(`Categories: ${data.categories?.length || 0}`)
logger.info(`Portfolio: ${data.portfolio?.length || 0}`)
if (data.categories && data.categories.length > 0) {
logger.info('\n📋 Categories found:')
for (const cat of data.categories) {
logger.info(` - ${cat.name} (${cat.slug}) - ${cat.colorHex}`)
}
}
if (data.posts && data.posts.length > 0) {
logger.info('\n📝 First 5 posts:')
for (const post of data.posts.slice(0, 5)) {
logger.info(` - [${post.postCategory || 'uncategorized'}] ${post.title}`)
logger.debug(` Slug: ${post.slug}`)
logger.debug(` Date: ${post.publishedDate}`)
}
}
} catch (error) {
logger.error(`Error: ${error}`)
}
}
main()