Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

I asked ChatGPT to write the code of an example collection. Is this valid?

default discord avatar
arskeliss2 years ago
1

module.exports = {


slug: 'posts',


labels: {


singular: 'Post',


plural: 'Posts'


},


admin: {


useAsTitle: 'title'


},


fields: [


{


name: 'title',


label: 'Title',


type: 'text',


required: true,


},


{


name: 'slug',


label: 'Slug',


type: 'slug',


from: 'title',


required: true,


unique: true,


editable: false


},


{


name: 'content',


label: 'Content',


type: 'richtext',


required: true,


},


{


name: 'author',


label: 'Author',


type: 'relationship',


relationTo: 'users',


required: true,


},


{


name: 'publishedAt',


label: 'Published At',


type: 'datetime',


required: true,


},


{


name: 'tags',


label: 'Tags',


type: 'array',


of: 'string',


required: false,


},


{


name: 'featuredImage',


label: 'Featured Image',


type: 'file',


required: false,


options: {


accept: 'image/*',


limit: 1,


},


},


],


};



I asked ChatGPT to write the code of an example collection. Is this valid?

  • default discord avatar
    generator1012 years ago

    looks valid to me

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.