* fix for supporting hasMany property in text field * Updated docs * handle text case types for schema and graphql schema * fix unit test for required failing * add unit test for has many text field * add end to end test for has many on text field creation * support has many feature for text field on postgres --------- Co-authored-by: Chris Heinz <chrisi.heinz@web.de>
20 lines
442 B
TypeScript
20 lines
442 B
TypeScript
/* eslint-disable no-param-reassign */
|
|
import type { TextField } from 'payload/types'
|
|
|
|
type Args = {
|
|
field: TextField
|
|
locale?: string
|
|
textRows: Record<string, unknown>[]
|
|
ref: Record<string, unknown>
|
|
}
|
|
|
|
export const transformHasManyText = ({ field, locale, textRows, ref }: Args) => {
|
|
const result = textRows.map(({ text }) => text)
|
|
|
|
if (locale) {
|
|
ref[field.name][locale] = result
|
|
} else {
|
|
ref[field.name] = result
|
|
}
|
|
}
|