mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-07-11 01:24:46 +02:00
feat(graphql): deprecate internal queries and fields (#1169)
This commit is contained in:
@@ -4,10 +4,11 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\GraphQL\Schema\Fields\Admin\Feature;
|
||||
|
||||
use App\Contracts\GraphQL\Fields\DeprecatedField;
|
||||
use App\GraphQL\Schema\Fields\StringField;
|
||||
use App\Models\Admin\Feature;
|
||||
|
||||
class FeatureNameField extends StringField
|
||||
class FeatureNameField extends StringField implements DeprecatedField
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
@@ -18,4 +19,9 @@ class FeatureNameField extends StringField
|
||||
{
|
||||
return 'The title of the resource';
|
||||
}
|
||||
|
||||
public function deprecationReason(): string
|
||||
{
|
||||
return 'Internal use only';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,11 +4,12 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\GraphQL\Schema\Fields\Admin\Feature;
|
||||
|
||||
use App\Contracts\GraphQL\Fields\DeprecatedField;
|
||||
use App\Contracts\GraphQL\Fields\UpdatableField;
|
||||
use App\GraphQL\Schema\Fields\StringField;
|
||||
use App\Models\Admin\Feature;
|
||||
|
||||
class FeatureValueField extends StringField implements UpdatableField
|
||||
class FeatureValueField extends StringField implements DeprecatedField, UpdatableField
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
@@ -32,4 +33,9 @@ class FeatureValueField extends StringField implements UpdatableField
|
||||
'max:192',
|
||||
];
|
||||
}
|
||||
|
||||
public function deprecationReason(): string
|
||||
{
|
||||
return 'Internal use only';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ abstract class Field
|
||||
return $type;
|
||||
}
|
||||
|
||||
public function deprecate(string $reason): self
|
||||
public function deprecate(string $reason): static
|
||||
{
|
||||
$this->deprecationReason = $reason;
|
||||
|
||||
|
||||
@@ -5,12 +5,13 @@ declare(strict_types=1);
|
||||
namespace App\GraphQL\Schema\Queries\Models\Pagination\Admin;
|
||||
|
||||
use App\Constants\FeatureConstants;
|
||||
use App\Contracts\GraphQL\Fields\DeprecatedField;
|
||||
use App\GraphQL\Schema\Queries\Models\Pagination\EloquentPaginationQuery;
|
||||
use App\GraphQL\Schema\Types\Admin\FeatureType;
|
||||
use App\Models\Admin\Feature;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class FeaturePaginationQuery extends EloquentPaginationQuery
|
||||
class FeaturePaginationQuery extends EloquentPaginationQuery implements DeprecatedField
|
||||
{
|
||||
public function name(): string
|
||||
{
|
||||
@@ -34,4 +35,9 @@ class FeaturePaginationQuery extends EloquentPaginationQuery
|
||||
{
|
||||
return $builder->where(Feature::ATTRIBUTE_SCOPE, FeatureConstants::NULL_SCOPE);
|
||||
}
|
||||
|
||||
public function deprecationReason(): string
|
||||
{
|
||||
return 'Internal use only';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\GraphQL\Schema\Queries\Models\Pagination\Admin;
|
||||
|
||||
use App\Contracts\GraphQL\Fields\DeprecatedField;
|
||||
use App\Enums\Http\Api\Filter\ComparisonOperator;
|
||||
use App\GraphQL\Schema\Queries\Models\Pagination\EloquentPaginationQuery;
|
||||
use App\GraphQL\Schema\Types\Admin\FeaturedThemeType;
|
||||
@@ -11,7 +12,7 @@ use App\Models\Admin\FeaturedTheme;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Support\Facades\Date;
|
||||
|
||||
class FeaturedThemePaginationQuery extends EloquentPaginationQuery
|
||||
class FeaturedThemePaginationQuery extends EloquentPaginationQuery implements DeprecatedField
|
||||
{
|
||||
public function name(): string
|
||||
{
|
||||
@@ -36,4 +37,9 @@ class FeaturedThemePaginationQuery extends EloquentPaginationQuery
|
||||
return $builder->whereNotNull(FeaturedTheme::ATTRIBUTE_START_AT)
|
||||
->whereDate(FeaturedTheme::ATTRIBUTE_START_AT, ComparisonOperator::LTE->value, Date::now());
|
||||
}
|
||||
|
||||
public function deprecationReason(): string
|
||||
{
|
||||
return 'Internal use only';
|
||||
}
|
||||
}
|
||||
|
||||
+7
-1
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\GraphQL\Schema\Queries\Models\Pagination\List\Playlist;
|
||||
|
||||
use App\Contracts\GraphQL\Fields\DeprecatedField;
|
||||
use App\GraphQL\Argument\Argument;
|
||||
use App\GraphQL\Schema\Fields\List\Playlist\PlaylistTrack\PlaylistTrackPlaylistField;
|
||||
use App\GraphQL\Schema\Queries\Models\Pagination\EloquentPaginationQuery;
|
||||
@@ -13,7 +14,7 @@ use App\Models\List\Playlist\PlaylistTrack;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class PlaylistTrackPaginationQuery extends EloquentPaginationQuery
|
||||
class PlaylistTrackPaginationQuery extends EloquentPaginationQuery implements DeprecatedField
|
||||
{
|
||||
public function name(): string
|
||||
{
|
||||
@@ -56,4 +57,9 @@ class PlaylistTrackPaginationQuery extends EloquentPaginationQuery
|
||||
|
||||
return $builder;
|
||||
}
|
||||
|
||||
public function deprecationReason(): string
|
||||
{
|
||||
return 'Internal use only. Use the playlistPagination.tracks relationship instead.';
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -30,6 +30,6 @@ class AnimeSynonymPaginationQuery extends EloquentPaginationQuery implements Dep
|
||||
|
||||
public function deprecationReason(): string
|
||||
{
|
||||
return 'Use synonymPagination query instead.';
|
||||
return 'Internal use only.';
|
||||
}
|
||||
}
|
||||
|
||||
+7
-1
@@ -4,12 +4,13 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\GraphQL\Schema\Queries\Models\Pagination\Wiki\Anime;
|
||||
|
||||
use App\Contracts\GraphQL\Fields\DeprecatedField;
|
||||
use App\GraphQL\Argument\Argument;
|
||||
use App\GraphQL\Argument\SearchArgument;
|
||||
use App\GraphQL\Schema\Queries\Models\Pagination\EloquentPaginationQuery;
|
||||
use App\GraphQL\Schema\Types\Wiki\Anime\AnimeThemeType;
|
||||
|
||||
class AnimeThemePaginationQuery extends EloquentPaginationQuery
|
||||
class AnimeThemePaginationQuery extends EloquentPaginationQuery implements DeprecatedField
|
||||
{
|
||||
public function name(): string
|
||||
{
|
||||
@@ -42,4 +43,9 @@ class AnimeThemePaginationQuery extends EloquentPaginationQuery
|
||||
new SearchArgument(),
|
||||
];
|
||||
}
|
||||
|
||||
public function deprecationReason(): string
|
||||
{
|
||||
return 'Internal use only';
|
||||
}
|
||||
}
|
||||
|
||||
+7
-1
@@ -4,10 +4,11 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\GraphQL\Schema\Queries\Models\Pagination\Wiki\Anime\Theme;
|
||||
|
||||
use App\Contracts\GraphQL\Fields\DeprecatedField;
|
||||
use App\GraphQL\Schema\Queries\Models\Pagination\EloquentPaginationQuery;
|
||||
use App\GraphQL\Schema\Types\Wiki\Anime\Theme\AnimeThemeEntryType;
|
||||
|
||||
class AnimeThemeEntryPaginationQuery extends EloquentPaginationQuery
|
||||
class AnimeThemeEntryPaginationQuery extends EloquentPaginationQuery implements DeprecatedField
|
||||
{
|
||||
public function name(): string
|
||||
{
|
||||
@@ -26,4 +27,9 @@ class AnimeThemeEntryPaginationQuery extends EloquentPaginationQuery
|
||||
{
|
||||
return new AnimeThemeEntryType();
|
||||
}
|
||||
|
||||
public function deprecationReason(): string
|
||||
{
|
||||
return 'Internal use only';
|
||||
}
|
||||
}
|
||||
|
||||
+7
-1
@@ -4,10 +4,11 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\GraphQL\Schema\Queries\Models\Pagination\Wiki\Song;
|
||||
|
||||
use App\Contracts\GraphQL\Fields\DeprecatedField;
|
||||
use App\GraphQL\Schema\Queries\Models\Pagination\EloquentPaginationQuery;
|
||||
use App\GraphQL\Schema\Types\Wiki\Song\PerformanceType;
|
||||
|
||||
class PerformancePaginationQuery extends EloquentPaginationQuery
|
||||
class PerformancePaginationQuery extends EloquentPaginationQuery implements DeprecatedField
|
||||
{
|
||||
public function name(): string
|
||||
{
|
||||
@@ -26,4 +27,9 @@ class PerformancePaginationQuery extends EloquentPaginationQuery
|
||||
{
|
||||
return new PerformanceType();
|
||||
}
|
||||
|
||||
public function deprecationReason(): string
|
||||
{
|
||||
return 'Internal use only';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,10 +4,11 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\GraphQL\Schema\Queries\Models\Pagination\Wiki;
|
||||
|
||||
use App\Contracts\GraphQL\Fields\DeprecatedField;
|
||||
use App\GraphQL\Schema\Queries\Models\Pagination\EloquentPaginationQuery;
|
||||
use App\GraphQL\Schema\Types\Wiki\SynonymType;
|
||||
|
||||
class SynonymPaginationQuery extends EloquentPaginationQuery
|
||||
class SynonymPaginationQuery extends EloquentPaginationQuery implements DeprecatedField
|
||||
{
|
||||
public function name(): string
|
||||
{
|
||||
@@ -26,4 +27,9 @@ class SynonymPaginationQuery extends EloquentPaginationQuery
|
||||
{
|
||||
return new SynonymType();
|
||||
}
|
||||
|
||||
public function deprecationReason(): string
|
||||
{
|
||||
return 'Internal use only';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,11 +94,8 @@ use App\GraphQL\Schema\Types\Wiki\SynonymType;
|
||||
use App\GraphQL\Schema\Types\Wiki\ThemeGroupType;
|
||||
use App\GraphQL\Schema\Types\Wiki\Video\VideoScriptType;
|
||||
use App\GraphQL\Schema\Types\Wiki\VideoType;
|
||||
use App\GraphQL\Schema\Unions\ImageableUnion;
|
||||
use App\GraphQL\Schema\Unions\LikeableUnion;
|
||||
use App\GraphQL\Schema\Unions\NotificationUnion;
|
||||
use App\GraphQL\Schema\Unions\ResourceableUnion;
|
||||
use App\GraphQL\Schema\Unions\SynonymableUnion;
|
||||
use App\Http\Middleware\GraphQL\LogGraphQLRequest;
|
||||
use App\Http\Middleware\GraphQL\MaxCount;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
@@ -241,11 +238,8 @@ class V1Schema implements ConfigConvertible
|
||||
ArtistMemberType::class,
|
||||
|
||||
// Unions
|
||||
ImageableUnion::class,
|
||||
LikeableUnion::class,
|
||||
NotificationUnion::class,
|
||||
ResourceableUnion::class,
|
||||
SynonymableUnion::class,
|
||||
|
||||
// Scalars
|
||||
MixedScalar::class,
|
||||
|
||||
@@ -9,10 +9,8 @@ use App\GraphQL\Schema\Fields\Base\UpdatedAtField;
|
||||
use App\GraphQL\Schema\Fields\Field;
|
||||
use App\GraphQL\Schema\Fields\Pivot\Morph\Imageable\ImageableDepthField;
|
||||
use App\GraphQL\Schema\Fields\Relations\BelongsToRelation;
|
||||
use App\GraphQL\Schema\Fields\Relations\MorphToRelation;
|
||||
use App\GraphQL\Schema\Types\Pivot\PivotType;
|
||||
use App\GraphQL\Schema\Types\Wiki\ImageType;
|
||||
use App\GraphQL\Schema\Unions\ImageableUnion;
|
||||
use App\Pivots\Morph\Imageable;
|
||||
|
||||
class ImageableType extends PivotType
|
||||
@@ -36,8 +34,6 @@ class ImageableType extends PivotType
|
||||
|
||||
new BelongsToRelation(new ImageType(), Imageable::RELATION_IMAGE)
|
||||
->nonNullable(),
|
||||
new MorphToRelation(new ImageableUnion(), Imageable::RELATION_IMAGEABLE)
|
||||
->nonNullable(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,10 +9,8 @@ use App\GraphQL\Schema\Fields\Base\UpdatedAtField;
|
||||
use App\GraphQL\Schema\Fields\Field;
|
||||
use App\GraphQL\Schema\Fields\Pivot\Morph\Resourceable\ResourceableAsField;
|
||||
use App\GraphQL\Schema\Fields\Relations\BelongsToRelation;
|
||||
use App\GraphQL\Schema\Fields\Relations\MorphToRelation;
|
||||
use App\GraphQL\Schema\Types\Pivot\PivotType;
|
||||
use App\GraphQL\Schema\Types\Wiki\ExternalResourceType;
|
||||
use App\GraphQL\Schema\Unions\ResourceableUnion;
|
||||
use App\Pivots\Morph\Resourceable;
|
||||
|
||||
class ResourceableType extends PivotType
|
||||
@@ -36,8 +34,6 @@ class ResourceableType extends PivotType
|
||||
|
||||
new BelongsToRelation(new ExternalResourceType(), Resourceable::RELATION_RESOURCE)
|
||||
->nonNullable(),
|
||||
new MorphToRelation(new ResourceableUnion(), Resourceable::RELATION_RESOURCEABLE)
|
||||
->nonNullable(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,11 +10,9 @@ use App\GraphQL\Schema\Fields\Base\IdField;
|
||||
use App\GraphQL\Schema\Fields\Base\UpdatedAtField;
|
||||
use App\GraphQL\Schema\Fields\Field;
|
||||
use App\GraphQL\Schema\Fields\LocalizedEnumField;
|
||||
use App\GraphQL\Schema\Fields\Relations\MorphToRelation;
|
||||
use App\GraphQL\Schema\Fields\Wiki\Synonym\SynonymTextField;
|
||||
use App\GraphQL\Schema\Fields\Wiki\Synonym\SynonymTypeField;
|
||||
use App\GraphQL\Schema\Types\EloquentType;
|
||||
use App\GraphQL\Schema\Unions\SynonymableUnion;
|
||||
use App\Models\Wiki\Synonym;
|
||||
|
||||
class SynonymType extends EloquentType
|
||||
@@ -39,9 +37,6 @@ class SynonymType extends EloquentType
|
||||
new CreatedAtField(),
|
||||
new UpdatedAtField(),
|
||||
new DeletedAtField(),
|
||||
|
||||
new MorphToRelation(new SynonymableUnion(), Synonym::RELATION_SYNONYMABLE)
|
||||
->nonNullable(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\GraphQL\Schema\Unions;
|
||||
|
||||
use App\GraphQL\Schema\Types\BaseType;
|
||||
use App\GraphQL\Schema\Types\Wiki\AnimeType;
|
||||
use App\GraphQL\Schema\Types\Wiki\ArtistType;
|
||||
use App\GraphQL\Schema\Types\Wiki\StudioType;
|
||||
|
||||
class ImageableUnion extends BaseUnion
|
||||
{
|
||||
public function description(): string
|
||||
{
|
||||
return 'Represents the types that have images';
|
||||
}
|
||||
|
||||
/**
|
||||
* The types that this union can resolve to.
|
||||
*
|
||||
* @return BaseType[]
|
||||
*/
|
||||
public function baseTypes(): array
|
||||
{
|
||||
return [
|
||||
new AnimeType(),
|
||||
new ArtistType(),
|
||||
new StudioType(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\GraphQL\Schema\Unions;
|
||||
|
||||
use App\GraphQL\Schema\Types\BaseType;
|
||||
use App\GraphQL\Schema\Types\Wiki\AnimeType;
|
||||
use App\GraphQL\Schema\Types\Wiki\ArtistType;
|
||||
use App\GraphQL\Schema\Types\Wiki\SongType;
|
||||
use App\GraphQL\Schema\Types\Wiki\StudioType;
|
||||
|
||||
class ResourceableUnion extends BaseUnion
|
||||
{
|
||||
public function description(): string
|
||||
{
|
||||
return 'Represents the types that have resources';
|
||||
}
|
||||
|
||||
/**
|
||||
* The types that this union can resolve to.
|
||||
*
|
||||
* @return BaseType[]
|
||||
*/
|
||||
public function baseTypes(): array
|
||||
{
|
||||
return [
|
||||
new AnimeType(),
|
||||
new ArtistType(),
|
||||
new SongType(),
|
||||
new StudioType(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\GraphQL\Schema\Unions;
|
||||
|
||||
use App\GraphQL\Schema\Types\BaseType;
|
||||
use App\GraphQL\Schema\Types\Wiki\AnimeType;
|
||||
use App\GraphQL\Schema\Types\Wiki\ArtistType;
|
||||
|
||||
class SynonymableUnion extends BaseUnion
|
||||
{
|
||||
public function description(): string
|
||||
{
|
||||
return 'Represents the types that have synonyms';
|
||||
}
|
||||
|
||||
/**
|
||||
* The types that this union can resolve to.
|
||||
*
|
||||
* @return BaseType[]
|
||||
*/
|
||||
public function baseTypes(): array
|
||||
{
|
||||
return [
|
||||
new AnimeType(),
|
||||
new ArtistType(),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user