66 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			66 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
 | 
						|
namespace dominion\file\schema;
 | 
						|
 | 
						|
use GraphQL\Type\Definition\ObjectType;
 | 
						|
use GraphQL\Type\Definition\Type;
 | 
						|
use dominion\file\Config;
 | 
						|
 | 
						|
class FileConfigMutationType extends ObjectType
 | 
						|
{
 | 
						|
    public function __construct()
 | 
						|
    {
 | 
						|
        $config = [
 | 
						|
            'fields' => function() {
 | 
						|
                return [
 | 
						|
                    'save' => [
 | 
						|
                        'type' => Type::int(),
 | 
						|
                        'description' => 'Сохранение наклейки',
 | 
						|
                        'args' => [
 | 
						|
                            'module' => Type::nonNull(Type::string()),
 | 
						|
                            'type' => Type::nonNull(Type::string()),
 | 
						|
                            'height' => Type::nonNull(Type::int()),
 | 
						|
                            'width' => Type::nonNull(Type::int()),
 | 
						|
                            'name' => Type::string(),
 | 
						|
                            'crop' => Type::boolean(),
 | 
						|
                            'cut' => Type::boolean(),
 | 
						|
                            'addBorder' => Type::boolean(),
 | 
						|
                            'border_top' => Type::int(),
 | 
						|
                            'border_right' => Type::int(),
 | 
						|
                            'border_left' => Type::int(),
 | 
						|
                            'border_bottom' => Type::int(),
 | 
						|
                            'quality' => Type::int(),
 | 
						|
                            'file' => Type::string(),
 | 
						|
                            'fileName' => Type::string(),
 | 
						|
                            'fileDelete' => Type::boolean(),
 | 
						|
                        ],
 | 
						|
                        'resolve' => function(Config $root, $args) {
 | 
						|
                            return $root->customSave($args);
 | 
						|
                        },
 | 
						|
                    ],
 | 
						|
                    'delete' => [
 | 
						|
                        'type' => Type::int(),
 | 
						|
                        'description' => 'Удаление',
 | 
						|
                        'resolve' => function(Config $root, $args) {
 | 
						|
                            return $root->delete();
 | 
						|
                        },
 | 
						|
                    ],
 | 
						|
                    'resize' => [
 | 
						|
                        'type' => Types::fileConfigResizeStep(),
 | 
						|
                        'description' => 'Сохранение наклейки',
 | 
						|
                        'args' => [
 | 
						|
                            'all' => Type::boolean(),
 | 
						|
                            'fileId' => Type::int()
 | 
						|
                        ],
 | 
						|
                        'resolve' => function(Config $root, $args) {
 | 
						|
                            return $root->resize($args);
 | 
						|
                        },
 | 
						|
                    ],
 | 
						|
                ];
 | 
						|
            }
 | 
						|
        ];
 | 
						|
 | 
						|
        parent::__construct($config);
 | 
						|
    }
 | 
						|
} |