89 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			89 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
namespace dominion\file\schema;
 | 
						|
 | 
						|
use GraphQL\Type\Definition\ObjectType;
 | 
						|
use GraphQL\Type\Definition\Type;
 | 
						|
 | 
						|
class FileConfigType extends ObjectType
 | 
						|
{
 | 
						|
    public function __construct()
 | 
						|
    {
 | 
						|
        $config = [
 | 
						|
            'fields' => function() {
 | 
						|
                return [
 | 
						|
                    'id' => [
 | 
						|
                        'type' => Type::int(),
 | 
						|
                        'description' => 'Id',
 | 
						|
                    ],
 | 
						|
                    'module' => [
 | 
						|
                        'type' => Type::string(),
 | 
						|
                        'description' => 'module',
 | 
						|
                    ],
 | 
						|
                    'type' => [
 | 
						|
                        'type' => Type::string(),
 | 
						|
                        'description' => 'type',
 | 
						|
                    ],
 | 
						|
                    'height' => [
 | 
						|
                        'type' => Type::int(),
 | 
						|
                        'description' => 'height',
 | 
						|
                    ],
 | 
						|
                    'width' => [
 | 
						|
                        'type' => Type::int(),
 | 
						|
                        'description' => 'width',
 | 
						|
                    ],
 | 
						|
                    'name' => [
 | 
						|
                        'type' => Type::string(),
 | 
						|
                        'description' => 'name',
 | 
						|
                    ],
 | 
						|
                    'cut' => [
 | 
						|
                        'type' => Type::boolean(),
 | 
						|
                        'description' => 'cut',
 | 
						|
                    ],
 | 
						|
                    'crop' => [
 | 
						|
                        'type' => Type::boolean(),
 | 
						|
                        'description' => 'crop',
 | 
						|
                    ],
 | 
						|
                    'addBorder' => [
 | 
						|
                        'type' => Type::boolean(),
 | 
						|
                        'description' => 'addBorder',
 | 
						|
                    ],
 | 
						|
                    'fileId' => [
 | 
						|
                        'type' => Type::int(),
 | 
						|
                        'description' => 'Шаблон изображения',
 | 
						|
                    ],
 | 
						|
                    'border_top' => [
 | 
						|
                        'type' => Type::int(),
 | 
						|
                        'description' => 'отступы для окна внутри шаблона (сверху)',
 | 
						|
                    ],
 | 
						|
                    'border_right' => [
 | 
						|
                        'type' => Type::int(),
 | 
						|
                        'description' => 'тступы для окна внутри шаблона (справа)',
 | 
						|
                    ],
 | 
						|
                    'border_left' => [
 | 
						|
                        'type' => Type::int(),
 | 
						|
                        'description' => 'отступы для окна внутри шаблона (слева)',
 | 
						|
                    ],
 | 
						|
                    'border_bottom' => [
 | 
						|
                        'type' => Type::int(),
 | 
						|
                        'description' => 'отступы для окна внутри шаблона (снизу)',
 | 
						|
                    ],
 | 
						|
                    'quality' => [
 | 
						|
                        'type' => Type::int(),
 | 
						|
                        'description' => 'качество (степень сжатия)',
 | 
						|
                    ],
 | 
						|
                    'fileObj' => [
 | 
						|
                        'type' => Types::fileTemplate(),
 | 
						|
                        'description' => 'объект файла',
 | 
						|
                        'resolve' => function($root, $args) {
 | 
						|
                            return $root->file;
 | 
						|
                        }
 | 
						|
                    ],
 | 
						|
                ];
 | 
						|
            }
 | 
						|
        ];
 | 
						|
 | 
						|
        parent::__construct($config);
 | 
						|
    }
 | 
						|
 | 
						|
} |