kuvalda-file/schema/FileConfigPaginationType.php

43 lines
1.3 KiB
PHP
Raw Normal View History

2024-11-20 15:56:54 +03:00
<?php
namespace dominion\file\schema;
use GraphQL\Type\Definition\Type;
use dominion\api\GraphQLSchemaPagination;
use dominion\file\Config;
use dominion\api\GraphQLPagination;
class FileConfigPaginationType extends GraphQLSchemaPagination
{
public function __construct()
{
$config = [
'fields' => function(){
$output = $this->getCustomFields();
$output['data'] = [
'type' => Type::listOf(Types::fileConfig()),
'description' => 'Конфигурация миниатюр',
'args' => GraphQLPagination::argumentModify([
'id' => [
'type' => Type::int(),
'description' => 'Id конфига',
],
'sort' => [
'type' => Type::string(),
'description' => 'Сортировка (пример "isNew_asc" или "isVisible_desc")',
],
]),
'resolve' => function($root, $args){
return Config::getData($args, $root);
}
];
return $output;
}
];
parent::__construct($config);
}
}