Files
payload/test/select/collections/LocalizedPosts/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

159 lines
2.7 KiB
TypeScript

import type { CollectionConfig } from 'payload'
export const LocalizedPostsCollection: CollectionConfig = {
slug: 'localized-posts',
admin: {
useAsTitle: 'text',
},
fields: [
{
name: 'text',
localized: true,
type: 'text',
},
{
name: 'number',
localized: true,
type: 'number',
},
{
name: 'select',
type: 'select',
options: ['a', 'b'],
},
{
name: 'selectMany',
type: 'select',
options: ['a', 'b'],
hasMany: true,
},
{
name: 'group',
localized: true,
type: 'group',
fields: [
{
name: 'text',
type: 'text',
},
{
name: 'number',
type: 'number',
},
],
},
{
name: 'groupSecond',
type: 'group',
fields: [
{
name: 'text',
type: 'text',
localized: true,
},
{
name: 'number',
type: 'number',
},
],
},
{
name: 'array',
type: 'array',
localized: true,
fields: [
{
name: 'text',
type: 'text',
},
{
name: 'number',
type: 'number',
},
],
},
{
name: 'arraySecond',
type: 'array',
fields: [
{
name: 'text',
type: 'text',
localized: true,
},
{
name: 'number',
type: 'number',
},
],
},
{
name: 'blocks',
type: 'blocks',
localized: true,
blocks: [
{
slug: 'intro',
fields: [
{
name: 'text',
type: 'text',
},
{
name: 'introText',
type: 'text',
},
],
},
{
slug: 'cta',
fields: [
{
name: 'text',
type: 'text',
},
{
name: 'ctaText',
type: 'text',
},
],
},
],
},
{
name: 'blocksSecond',
type: 'blocks',
blocks: [
{
slug: 'first',
fields: [
{
name: 'text',
type: 'text',
},
{
name: 'firstText',
type: 'text',
localized: true,
},
],
},
{
slug: 'second',
fields: [
{
name: 'text',
type: 'text',
localized: true,
},
{
name: 'secondText',
type: 'text',
},
],
},
],
},
],
}