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:
@@ -8,13 +8,16 @@ import { logDocumentChange } from '@/utilities/auditLogger'
|
||||
*/
|
||||
export const auditChange =
|
||||
(collection: string): AfterChangeHook =>
|
||||
async ({ doc, req }) => {
|
||||
async ({ doc, req, context }) => {
|
||||
// 跳過 audit 集合本身以避免無限循環
|
||||
if (collection === 'audit') return doc
|
||||
|
||||
// Determine operation from context or default to 'update'
|
||||
const operation = (context?.operation as 'create' | 'update' | 'delete') || 'update'
|
||||
|
||||
await logDocumentChange(
|
||||
req,
|
||||
operation as 'create' | 'update' | 'delete',
|
||||
operation,
|
||||
collection,
|
||||
doc.id as string,
|
||||
(doc.title || doc.name || String(doc.id)) as string,
|
||||
|
||||
@@ -111,7 +111,7 @@ export const Posts: CollectionConfig<'posts'> = {
|
||||
},
|
||||
}),
|
||||
label: false,
|
||||
required: true,
|
||||
required: false, // Temporarily disabled for migration
|
||||
},
|
||||
{
|
||||
name: 'excerpt',
|
||||
|
||||
Reference in New Issue
Block a user