This commit is contained in:
Your Name 2021-08-04 00:56:18 +02:00
parent 51941b88ee
commit f01509cab1
12 changed files with 112 additions and 139 deletions

View File

@ -14,10 +14,9 @@ class Authentication
public function handle($request, Closure $next) public function handle($request, Closure $next)
{ {
if ($request->input('gql_session') === 'SUPER_SECRET_TOKEN') { if ($request->input('gql_session') === 'SUPER_SECRET_TOKEN') {
return "false"; return 'false';
} } else {
else { return 'true';
return "true";
} }
return $next($request); return $next($request);

View File

@ -43,8 +43,11 @@ class Plugin extends PluginBase
$this->app->singleton(DatabaseManager::class, function ($app) { $this->app->singleton(DatabaseManager::class, function ($app) {
return $app->make('db'); return $app->make('db');
}); });
\Illuminate\Support\Facades\Broadcast::routes(['prefix' => '', 'middleware' => 'GermanAirlinesVA\\Graphql\\Classes\\Authentication']); \Illuminate\Support\Facades\Broadcast::routes([
require("channels/channels.php"); 'prefix' => '',
'middleware' => 'GermanAirlinesVA\\Graphql\\Classes\\Authentication',
]);
require 'channels/channels.php';
Config::set('database.connections.germanairlinesva_graphql', Config::get('germanairlinesva.graphql::connection')); Config::set('database.connections.germanairlinesva_graphql', Config::get('germanairlinesva.graphql::connection'));
} }

View File

@ -15,10 +15,9 @@ class Authentication
public function handle($request, Closure $next) public function handle($request, Closure $next)
{ {
if ($request->header('Gql-Session') === 'SUPER_SECRET_KEY_HEADER') { if ($request->header('Gql-Session') === 'SUPER_SECRET_KEY_HEADER') {
return ""; return '';
} } else {
else { throw new AccessDeniedHttpException();
throw new AccessDeniedHttpException;
} }
return $next($request); return $next($request);

View File

@ -69,6 +69,6 @@ class Dummy extends GraphQLSubscription
*/ */
public function resolve($root, array $args, GraphQLContext $context, ResolveInfo $resolveInfo): array public function resolve($root, array $args, GraphQLContext $context, ResolveInfo $resolveInfo): array
{ {
return array($root); return [$root];
} }
} }

View File

@ -11,7 +11,8 @@
data-trigger=".control-list input[type=checkbox]" data-trigger=".control-list input[type=checkbox]"
data-trigger-condition="checked" data-trigger-condition="checked"
data-request-success="$(this).prop('disabled', true)" data-request-success="$(this).prop('disabled', true)"
data-stripe-load-indicator> data-stripe-load-indicator
>
<?= e(trans('backend::lang.list.delete_selected')) ?> <?= e(trans('backend::lang.list.delete_selected')) ?>
</button> </button>
</div> </div>

View File

@ -1,5 +1,4 @@
title = "CMS" title = "CMS" ==
==
<?php <?php
use Cms\Classes\Theme; use Cms\Classes\Theme;
use Cms\Classes\Content; use Cms\Classes\Content;
@ -12,12 +11,6 @@ function resolveCmsContent($root, $args) {
return Content::loadCached($theme, $args['name']); return Content::loadCached($theme, $args['name']);
} }
?> ?>
== == # Content extend type Query { cmsContent(name: String!): CmsContent! } type CmsContent { fileName: String! content:
# Content String markup: String parsedMarkup: String } # CMS-wide types # Backend\Models\User type BackendUser { id: ID! }
extend type Query { cmsContent(name: String!): CmsContent! } #System\Models\File type SystemFile { id: ID path: String title: String description: String }
type CmsContent { fileName: String! content: String markup: String parsedMarkup: String }
# CMS-wide types
# Backend\Models\User
type BackendUser { id: ID! }
#System\Models\File
type SystemFile { id: ID path: String title: String description: String }

View File

@ -1,32 +1,8 @@
title = "Fleet" title = "Fleet" == == # Content extend type Query { aircraft: [Aircraft] @all(model:
== "GermanAirlinesVa\\Fleet\\Models\\Aircraft") aircraftType: [AircraftType] @all(model:
== "GermanAirlinesVa\\Fleet\\Models\\AircraftType") } extend type Subscription { aircraftAdded: Aircraft
# Content @subscription(class: "GermanAirlinesVa\\Fleet\\Classes\\AircraftAdded") } extend type Mutation { addAircraft(
extend type Query { aircraft_type_id: ID!, home_airport_id: ID!, name: String!, registration: String! ): Aircraft @create(model:
aircraft: [Aircraft] @all(model: "GermanAirlinesVa\\Fleet\\Models\\Aircraft") "GermanAirlinesVa\\Fleet\\Models\\Aircraft") @broadcast(subscription: "aircraftAdded") } type Aircraft { id: ID!
aircraftType: [AircraftType] @all(model: "GermanAirlinesVa\\Fleet\\Models\\AircraftType") aircraft_type_id: ID! home_airport_id: ID! name: String! registration: String! } type AircraftType { type: String!
} aircrafts: [Aircraft] @hasMany }
extend type Subscription {
aircraftAdded: Aircraft @subscription(class: "GermanAirlinesVa\\Fleet\\Classes\\AircraftAdded")
}
extend type Mutation {
addAircraft(
aircraft_type_id: ID!,
home_airport_id: ID!,
name: String!,
registration: String!
): Aircraft
@create(model: "GermanAirlinesVa\\Fleet\\Models\\Aircraft")
@broadcast(subscription: "aircraftAdded")
}
type Aircraft {
id: ID!
aircraft_type_id: ID!
home_airport_id: ID!
name: String!
registration: String!
}
type AircraftType { type: String! aircrafts: [Aircraft] @hasMany }

View File

@ -23,11 +23,13 @@
'engine' => 'Engine', 'engine' => 'Engine',
'enable_cache' => [ 'enable_cache' => [
'label' => 'Enable Schema Cache', 'label' => 'Enable Schema Cache',
'comment' => 'A large part of the Schema generation is parsing the various graph definition into an AST. These operations are pretty expensive so it is recommended to enable caching in production mode.', 'comment' =>
'A large part of the Schema generation is parsing the various graph definition into an AST. These operations are pretty expensive so it is recommended to enable caching in production mode.',
], ],
'batched_queries' => [ 'batched_queries' => [
'label' => 'Batched Queries', 'label' => 'Batched Queries',
'comment' => 'GraphQL query batching means sending multiple queries to the server in one request. You may set this flag to process/deny batched queries.', 'comment' =>
'GraphQL query batching means sending multiple queries to the server in one request. You may set this flag to process/deny batched queries.',
], ],
], ],
]; ];