Like what we’re doing? Star us on GitHub!

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

Arskeliss
4 weeks ago
2

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?

  • generator101
    4 weeks ago

    looks valid to me

Open the post
Continue the discussion in Discord
Can't find what you're looking for?
Get help straight from the Payload team with an Enterprise License.Learn More