mirror of
https://github.com/xtr-dev/payload-automation.git
synced 2025-12-13 01:53:23 +00:00
Initial commit
This commit is contained in:
48
src/steps/delete-document.ts
Normal file
48
src/steps/delete-document.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import type { TaskConfig } from "payload"
|
||||
|
||||
import { deleteDocumentHandler } from "./delete-document-handler.js"
|
||||
|
||||
export const DeleteDocumentStepTask = {
|
||||
slug: 'delete-document',
|
||||
handler: deleteDocumentHandler,
|
||||
inputSchema: [
|
||||
{
|
||||
name: 'collection',
|
||||
type: 'text',
|
||||
admin: {
|
||||
description: 'The collection slug to delete from'
|
||||
},
|
||||
required: true
|
||||
},
|
||||
{
|
||||
name: 'id',
|
||||
type: 'text',
|
||||
admin: {
|
||||
description: 'The ID of a specific document to delete (leave empty to delete multiple)'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'where',
|
||||
type: 'json',
|
||||
admin: {
|
||||
description: 'Query conditions to find documents to delete (used when ID is not provided)'
|
||||
}
|
||||
}
|
||||
],
|
||||
outputSchema: [
|
||||
{
|
||||
name: 'doc',
|
||||
type: 'json',
|
||||
admin: {
|
||||
description: 'The deleted document(s)'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'deletedCount',
|
||||
type: 'number',
|
||||
admin: {
|
||||
description: 'Number of documents deleted'
|
||||
}
|
||||
}
|
||||
]
|
||||
} satisfies TaskConfig<'delete-document'>
|
||||
Reference in New Issue
Block a user