mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-07-11 01:24:46 +02:00
61 lines
1.6 KiB
PHP
61 lines
1.6 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\GraphQL\Definition\Fields;
|
|
|
|
use App\Contracts\GraphQL\Fields\DisplayableField;
|
|
use App\Contracts\GraphQL\Fields\FilterableField;
|
|
use App\Contracts\GraphQL\Fields\SortableField;
|
|
use App\Enums\GraphQL\SortType;
|
|
use App\GraphQL\Support\Directives\Filters\EqFilterDirective;
|
|
use App\GraphQL\Support\Directives\Filters\FilterDirective;
|
|
use App\GraphQL\Support\Directives\Filters\GreaterFilterDirective;
|
|
use App\GraphQL\Support\Directives\Filters\InFilterDirective;
|
|
use App\GraphQL\Support\Directives\Filters\LesserFilterDirective;
|
|
use App\GraphQL\Support\Directives\Filters\NotInFilterDirective;
|
|
use GraphQL\Type\Definition\Type;
|
|
|
|
abstract class FloatField extends Field implements DisplayableField, FilterableField, SortableField
|
|
{
|
|
/**
|
|
* The type returned by the field.
|
|
*/
|
|
public function type(): Type
|
|
{
|
|
return Type::float();
|
|
}
|
|
|
|
/**
|
|
* Determine if the field should be displayed to the user.
|
|
*/
|
|
public function canBeDisplayed(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* The directives available for this filter.
|
|
*
|
|
* @return FilterDirective[]
|
|
*/
|
|
public function filterDirectives(): array
|
|
{
|
|
return [
|
|
new EqFilterDirective($this),
|
|
new InFilterDirective($this),
|
|
new NotInFilterDirective($this),
|
|
new LesserFilterDirective($this),
|
|
new GreaterFilterDirective($this),
|
|
];
|
|
}
|
|
|
|
/**
|
|
* The sort type of the field.
|
|
*/
|
|
public function sortType(): SortType
|
|
{
|
|
return SortType::ROOT;
|
|
}
|
|
}
|