Config Object Tree

Only schema is mandatory.

let config = {
    schema: printSchema(schema), 
    uploadRoot: '/var/www/site.com/public/stc', // String
    exclude: ['paymentType', 'invoiceType'], // Array of String
    rules: {
        [GraphQL Type name]: { 
            label: 'Categories', // String
            uploadPath: 'product', // String
            listHeader: {
                id: ['id'], // Array of String
                title: ['description'] // Array of String
            },
            resolvers: {                
                find: {
                    resolver: 'categories.find' // String
                },
                create: {
                    resolver: 'categories.create' // String
                    allowed: true // Boolean, by default true
                },
                update: {
                    resolver: 'categories.update'  // String
                },
                remove: {
                    allowed: false // Boolean
                }
            },
            fields: {
                [field_name]: {
                    label: 'custom field name to show in UI', // String
                    inputControl: 'input', // String
                    inputType: 'file', // String
                    list: {
                      label: 'title' // String
                    }
                    disabled: false, //Boolean, by default false
                    exclude: false //Boolean, by default false
                }
            }
        }
    }
}

Props definition:

  1. schema - your printed schema [required]
  2. uploadRoot - full path to your public folder
  3. exclude - GraphQL Types which you don't want to show in CMS
  4. rules - rules object is a tree with rules for each or any GraphQL Types. CMS in addition will use the same order for side menu and fields in the view page as you will provide in this object
    1. [GraphQL Type name] - GraphQL Type name by default will be used as name for side menu
      1. label - custom side menu name
      2. uploadPath - custom folder where to upload files for this type
      3. listHeader - data from this fields will be used to show on the first column [id] and second [title] on list page. You can provide couple of fields for each column so it will shows as 'String' + ' | ' + 'String'
        1. id - fields for first column
        2. title - fields for second column
      4. resolvers - if you don't want to use the naming pattern you need to provide Query's and Mutation's method name for each GraphQL Type
        1. [find, create, update, remove]
          1. resolver - GraphQL Query or Mutation method name
          2. allowed - if you don't want to provide some method to client side you can depreciate it for any action besides 'find'
      5. fields - fields of current GraphQL Type
        1. [field_name]
          1. label -
          2. inputControl - can be 'input' or 'textarea'
          3. inputType - type for 'input', file, number, text, etc.
          4. list.label - name of property, wich will be used to show in dropdown menu with options
          5. disabled - disabled field editing
          6. exclude - don't render this field in CMS, never exclude field '_id' or 'id'

results matching ""

    No results matching ""