mirror of
https://github.com/xtr-dev/payload-automation.git
synced 2025-12-10 00:43:23 +00:00
Initial commit
This commit is contained in:
56
src/steps/create-document.ts
Normal file
56
src/steps/create-document.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
import type { TaskConfig } from "payload"
|
||||
|
||||
import { createDocumentHandler } from "./create-document-handler.js"
|
||||
|
||||
export const CreateDocumentStepTask = {
|
||||
slug: 'create-document',
|
||||
handler: createDocumentHandler,
|
||||
inputSchema: [
|
||||
{
|
||||
name: 'collection',
|
||||
type: 'text',
|
||||
admin: {
|
||||
description: 'The collection slug to create a document in'
|
||||
},
|
||||
required: true
|
||||
},
|
||||
{
|
||||
name: 'data',
|
||||
type: 'json',
|
||||
admin: {
|
||||
description: 'The document data to create'
|
||||
},
|
||||
required: true
|
||||
},
|
||||
{
|
||||
name: 'draft',
|
||||
type: 'checkbox',
|
||||
admin: {
|
||||
description: 'Create as draft (if collection has drafts enabled)'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'locale',
|
||||
type: 'text',
|
||||
admin: {
|
||||
description: 'Locale for the document (if localization is enabled)'
|
||||
}
|
||||
}
|
||||
],
|
||||
outputSchema: [
|
||||
{
|
||||
name: 'doc',
|
||||
type: 'json',
|
||||
admin: {
|
||||
description: 'The created document'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'id',
|
||||
type: 'text',
|
||||
admin: {
|
||||
description: 'The ID of the created document'
|
||||
}
|
||||
}
|
||||
]
|
||||
} satisfies TaskConfig<'create-document'>
|
||||
Reference in New Issue
Block a user