Files
payload/test/select/collections/Posts/index.ts
Sasha dff71eedaa fix(db-postgres): handle select query on select fields (#9607)
Fixes https://github.com/payloadcms/payload/issues/9606

With Postgres / SQLite, select fields (non `hasMany: true`) weren't
properly handled in the `traverseFields.ts` function for `select` query.
2024-12-04 11:27:03 -05:00

121 lines
2.0 KiB
TypeScript

import type { CollectionConfig } from 'payload'
export const PostsCollection: CollectionConfig = {
slug: 'posts',
admin: {
useAsTitle: 'text',
},
fields: [
{
name: 'text',
type: 'text',
},
{
name: 'number',
type: 'number',
},
{
name: 'select',
type: 'select',
options: ['a', 'b'],
},
{
name: 'selectMany',
type: 'select',
options: ['a', 'b'],
hasMany: true,
},
{
name: 'group',
type: 'group',
fields: [
{
name: 'text',
type: 'text',
},
{
name: 'number',
type: 'number',
},
],
},
{
name: 'array',
type: 'array',
fields: [
{
name: 'text',
type: 'text',
},
{
name: 'number',
type: 'number',
},
],
},
{
name: 'blocks',
type: 'blocks',
blocks: [
{
slug: 'intro',
fields: [
{
name: 'text',
type: 'text',
},
{
name: 'introText',
type: 'text',
},
],
},
{
slug: 'cta',
fields: [
{
name: 'text',
type: 'text',
},
{
name: 'ctaText',
type: 'text',
},
],
},
],
},
{
type: 'tabs',
tabs: [
{
name: 'tab',
fields: [
{
type: 'text',
name: 'text',
},
{
type: 'number',
name: 'number',
},
],
},
{
label: 'Tab Unnamed',
fields: [
{
type: 'text',
name: 'unnamedTabText',
},
{
type: 'number',
name: 'unnamedTabNumber',
},
],
},
],
},
],
}