import { CmsModelFieldToGraphQLPlugin } from "~/types" ; import { attachRequiredFieldValue } from "~/content/plugins/graphqlFields/requiredField" ; const createListFilters = ( { field } ) => { return `
        ${ field . fieldId }: String
        ${ field . fieldId }_not: String
        ${ field . fieldId }_in: [String]
        ${ field . fieldId }_not_in: [String]
        ${ field . fieldId }_contains: String
        ${ field . fieldId }_not_contains: String
    ` ; } ; const plugin = { name : "cms-model-field-to-graphql-text" , type : "cms-model-field-to-graphql" , fieldType : "text" , isSortable : true , isSearchable : true , read : { createTypeField ( { field } ) { if ( field . multipleValues ) { return `${ field . fieldId }: [String]` ; } return `${ field . fieldId }: String` ; } , createGetFilters ( { field } ) { return `${ field . fieldId }: String` ; } , createListFilters } , manage : { createListFilters , createTypeField ( { field } ) { if ( field . multipleValues ) { return `${ field . fieldId }: [String]` ; } return `${ field . fieldId }: String` ; } , createInputField ( { field } ) { if ( field . multipleValues ) { return attachRequiredFieldValue ( field . fieldId + ": [String]" , field ) ; } return attachRequiredFieldValue ( field . fieldId + ": String" , field ) ; } } } ; export default plugin ;