Compare commits
6 Commits
78acb54845
...
52ecda573b
| Author | SHA1 | Date | |
|---|---|---|---|
| 52ecda573b | |||
| a88999cd18 | |||
| 40d396908d | |||
| f01509cab1 | |||
| 51941b88ee | |||
| 222194e554 |
Executable
+12
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
FILES=$(git diff --cached --name-only --diff-filter=ACMR -- '*.php' '*.html' '*.yaml' | sed 's| |\\ |g')
|
||||
[ -z "$FILES" ] && exit 0
|
||||
|
||||
# Prettify all selected files
|
||||
echo "$FILES" | xargs ./node_modules/.bin/prettier --ignore-unknown --write
|
||||
|
||||
# Add back the modified/prettified files to staging
|
||||
echo "$FILES" | xargs git add
|
||||
|
||||
exit 0
|
||||
|
||||
+3
-4
@@ -14,10 +14,9 @@ class Authentication
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if ($request->input('gql_session') === 'SUPER_SECRET_TOKEN') {
|
||||
return "false";
|
||||
}
|
||||
else {
|
||||
return "true";
|
||||
return 'false';
|
||||
} else {
|
||||
return 'true';
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
|
||||
+5
-2
@@ -43,8 +43,11 @@ class Plugin extends PluginBase
|
||||
$this->app->singleton(DatabaseManager::class, function ($app) {
|
||||
return $app->make('db');
|
||||
});
|
||||
\Illuminate\Support\Facades\Broadcast::routes(['prefix' => '', 'middleware' => 'GermanAirlinesVA\\Graphql\\Classes\\Authentication']);
|
||||
require("channels/channels.php");
|
||||
\Illuminate\Support\Facades\Broadcast::routes([
|
||||
'prefix' => '',
|
||||
'middleware' => 'GermanAirlinesVA\\Graphql\\Classes\\Authentication',
|
||||
]);
|
||||
require 'channels/channels.php';
|
||||
|
||||
Config::set('database.connections.germanairlinesva_graphql', Config::get('germanairlinesva.graphql::connection'));
|
||||
}
|
||||
|
||||
@@ -15,10 +15,9 @@ class Authentication
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if ($request->header('Gql-Session') === 'SUPER_SECRET_KEY_HEADER') {
|
||||
return "";
|
||||
}
|
||||
else {
|
||||
throw new AccessDeniedHttpException;
|
||||
return '';
|
||||
} else {
|
||||
throw new AccessDeniedHttpException();
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
|
||||
+1
-1
@@ -69,6 +69,6 @@ class Dummy extends GraphQLSubscription
|
||||
*/
|
||||
public function resolve($root, array $args, GraphQLContext $context, ResolveInfo $resolveInfo): array
|
||||
{
|
||||
return array($root);
|
||||
return [$root];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php namespace GermanAirlinesVa\Graphql\Controllers;
|
||||
|
||||
use Backend\Classes\Controller;
|
||||
use BackendMenu;
|
||||
|
||||
class GraphqlKey extends Controller
|
||||
{
|
||||
public $implement = ['Backend\Behaviors\ListController'];
|
||||
|
||||
public $listConfig = 'config_list.yaml';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,6 @@ class Playground extends Controller
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
BackendMenu::setContext('GermanAirlinesVa.Graphql', 'menu', 'playground');
|
||||
}
|
||||
|
||||
public function index()
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<div data-control="toolbar">
|
||||
<button
|
||||
class="btn btn-default oc-icon-trash-o"
|
||||
disabled="disabled"
|
||||
onclick="$(this).data('request-data', {
|
||||
checked: $('.control-list').listWidget('getChecked')
|
||||
})"
|
||||
data-request="onDelete"
|
||||
data-request-confirm="<?= e(trans('backend::lang.list.delete_selected_confirm')) ?>"
|
||||
data-trigger-action="enable"
|
||||
data-trigger=".control-list input[type=checkbox]"
|
||||
data-trigger-condition="checked"
|
||||
data-request-success="$(this).prop('disabled', true)"
|
||||
data-stripe-load-indicator
|
||||
>
|
||||
<?= e(trans('backend::lang.list.delete_selected')) ?>
|
||||
</button>
|
||||
</div>
|
||||
@@ -0,0 +1,11 @@
|
||||
list: $/germanairlinesva/graphql/models/graphqlkey/columns.yaml
|
||||
modelClass: GermanAirlinesVa\Graphql\Models\GraphqlKey
|
||||
title: GraphQL Keys
|
||||
noRecordsMessage: 'backend::lang.list.no_records'
|
||||
showSetup: true
|
||||
showCheckboxes: true
|
||||
recordsPerPage: 20
|
||||
toolbar:
|
||||
buttons: list_toolbar
|
||||
search:
|
||||
prompt: 'backend::lang.list.search_prompt'
|
||||
@@ -0,0 +1 @@
|
||||
<?= $this->listRender() ?>
|
||||
@@ -1,2 +1 @@
|
||||
<div id="mount"></div>
|
||||
<script type="text/javascript" src="/plugins/germanairlinesva/graphql/assets/js/graphiql.js"></script>
|
||||
|
||||
+4
-11
@@ -1,5 +1,4 @@
|
||||
title = "CMS"
|
||||
==
|
||||
title = "CMS" ==
|
||||
<?php
|
||||
use Cms\Classes\Theme;
|
||||
use Cms\Classes\Content;
|
||||
@@ -12,12 +11,6 @@ function resolveCmsContent($root, $args) {
|
||||
return Content::loadCached($theme, $args['name']);
|
||||
}
|
||||
?>
|
||||
==
|
||||
# Content
|
||||
extend type Query { cmsContent(name: String!): CmsContent! }
|
||||
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 }
|
||||
== # Content extend type Query { cmsContent(name: String!): CmsContent! } 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 }
|
||||
|
||||
+8
-32
@@ -1,32 +1,8 @@
|
||||
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 @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 }
|
||||
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
|
||||
@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 }
|
||||
|
||||
+3
-1
@@ -4,7 +4,9 @@
|
||||
'description' => '',
|
||||
],
|
||||
'menu' => [
|
||||
'playground' => 'GA GraphiQL',
|
||||
'main' => 'GA GraphQL',
|
||||
'keys' => 'GraphQL Keys',
|
||||
'playground' => 'GraphiQL',
|
||||
],
|
||||
'permission' => [
|
||||
'tab' => [
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php namespace GermanAirlinesVa\Graphql\Models;
|
||||
|
||||
use Cms\Classes\Theme;
|
||||
use Model;
|
||||
|
||||
class GraphqlKey extends Model
|
||||
{
|
||||
use \October\Rain\Database\Traits\Validation;
|
||||
|
||||
/*
|
||||
* Disable timestamps by default.
|
||||
* Remove this line if timestamps are defined in the database table.
|
||||
*/
|
||||
public $timestamps = false;
|
||||
|
||||
/**
|
||||
* @var string The database table used by the model.
|
||||
*/
|
||||
public $table = 'graphql_keys';
|
||||
protected $connection = 'germanairlinesva_graphql';
|
||||
|
||||
/**
|
||||
* @var array Validation rules
|
||||
*/
|
||||
public $rules = [
|
||||
'member_id' => 'required',
|
||||
'key' => 'required',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
columns:
|
||||
id:
|
||||
label: id
|
||||
type: number
|
||||
member_id:
|
||||
label: member_id
|
||||
type: number
|
||||
valid_from:
|
||||
label: valid_from
|
||||
type: datetime
|
||||
key:
|
||||
label: key
|
||||
type: text
|
||||
+3
-2
@@ -6,10 +6,11 @@
|
||||
"author": "German Airlines VA",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@prettier/plugin-php": "^0.16.3",
|
||||
"prettier": "^2.3.0"
|
||||
"@prettier/plugin-php": "^0.17.3",
|
||||
"prettier": "^2.3.2"
|
||||
},
|
||||
"scripts": {
|
||||
"preinstall": "git config core.hooksPath .hooks",
|
||||
"format": "prettier --write './**/*.{php,html,htm,yaml}'"
|
||||
}
|
||||
}
|
||||
|
||||
+11
-2
@@ -10,8 +10,17 @@ permissions:
|
||||
label: 'germanairlinesva.graphql::lang.permission.label.schemas'
|
||||
navigation:
|
||||
menu:
|
||||
label: 'germanairlinesva.graphql::lang.menu.playground'
|
||||
url: germanairlinesva/graphql/playground
|
||||
label: 'germanairlinesva.graphql::lang.menu.main'
|
||||
url: /
|
||||
icon: icon-database
|
||||
permissions:
|
||||
- schemas
|
||||
sideMenu:
|
||||
side-menu-item:
|
||||
label: 'germanairlinesva.graphql::lang.menu.playground'
|
||||
url: germanairlinesva/graphql/playground
|
||||
icon: icon-database
|
||||
side-menu-item2:
|
||||
label: 'germanairlinesva.graphql::lang.menu.keys'
|
||||
url: germanairlinesva/graphql/graphqlkey
|
||||
icon: icon-key
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
<?php namespace GermanAirlinesVa\GraphQl\Updates;
|
||||
<?php namespace GermanAirlinesVa\Graphql\Updates;
|
||||
|
||||
use DB;
|
||||
use Schema;
|
||||
use October\Rain\Database\Updates\Migration;
|
||||
|
||||
class BuilderTableCreateGermanAirlinesVaGraphQlGraphQlKeys extends Migration
|
||||
class BuilderTableCreateGermanAirlinesVaGraphqlGraphqlKeys extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::connection('germanairlinesva_graphql')->create('graphql_keys', function ($table) {
|
||||
$table->engine = 'InnoDB';
|
||||
$table->bigIncrements('id')->unsigned();
|
||||
$table->bigInteger('member_id')->unsigned();
|
||||
$table->datetime('valid_from')->default(DB::raw('NOW()'));
|
||||
$table->datetime('valid_to')->default(DB::raw('NOW()'));
|
||||
$table->string('key');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
"@prettier/plugin-php@^0.16.3":
|
||||
version "0.16.3"
|
||||
resolved "https://registry.yarnpkg.com/@prettier/plugin-php/-/plugin-php-0.16.3.tgz#74867210079ba3c0c3ae843029d76e25ff0aadf3"
|
||||
integrity sha512-DNidzeGpP+/wmcCAZNSHxgoAnhEosYG+no4jJRqln19e1o3Okpuir/2JMxb07VCwdG50IWjtNgVwNPVl4uj0Hg==
|
||||
"@prettier/plugin-php@^0.17.3":
|
||||
version "0.17.3"
|
||||
resolved "https://registry.yarnpkg.com/@prettier/plugin-php/-/plugin-php-0.17.3.tgz#193a18e308db7416f26f6e1dc0d2605d1ff01416"
|
||||
integrity sha512-kD5IrGyKWF/p3XActVZ+GfbMl9knoK3XKBTG2bytpOtCO0+Q8eozimSgk/493rgFkXL3W2Ap/4GKgZf7u64+ow==
|
||||
dependencies:
|
||||
linguist-languages "^7.5.1"
|
||||
mem "^8.0.0"
|
||||
php-parser "3.0.2"
|
||||
php-parser "https://github.com/glayzzle/php-parser#e61e26102144f267ecf5e09020865a9baa6ca2f1"
|
||||
|
||||
linguist-languages@^7.5.1:
|
||||
version "7.15.0"
|
||||
@@ -41,12 +41,11 @@ p-defer@^1.0.0:
|
||||
resolved "https://registry.yarnpkg.com/p-defer/-/p-defer-1.0.0.tgz#9f6eb182f6c9aa8cd743004a7d4f96b196b0fb0c"
|
||||
integrity sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=
|
||||
|
||||
php-parser@3.0.2:
|
||||
"php-parser@git+https://github.com/glayzzle/php-parser.git#e61e26102144f267ecf5e09020865a9baa6ca2f1":
|
||||
version "3.0.2"
|
||||
resolved "https://registry.yarnpkg.com/php-parser/-/php-parser-3.0.2.tgz#a86dbbc110e57378cba71ab4cd9b0d18f3872ac3"
|
||||
integrity sha512-a7y1+odEGsceLDLpu7oNyspZ0pK8FMWJOoim4/yd82AtnEZNLdCLZ67arnOQZ9K0lHJiSp4/7lVUpGELVxE14w==
|
||||
resolved "git+https://github.com/glayzzle/php-parser.git#e61e26102144f267ecf5e09020865a9baa6ca2f1"
|
||||
|
||||
prettier@^2.3.0:
|
||||
version "2.3.0"
|
||||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.3.0.tgz#b6a5bf1284026ae640f17f7ff5658a7567fc0d18"
|
||||
integrity sha512-kXtO4s0Lz/DW/IJ9QdWhAf7/NmPWQXkFr/r/WkR3vyI+0v8amTDxiaQSLzs8NBlytfLWX/7uQUMIW677yLKl4w==
|
||||
prettier@^2.3.2:
|
||||
version "2.3.2"
|
||||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.3.2.tgz#ef280a05ec253712e486233db5c6f23441e7342d"
|
||||
integrity sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ==
|
||||
|
||||
Reference in New Issue
Block a user