Compare commits
19 Commits
78acb54845
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 172128b37b | |||
| 8bb522ec33 | |||
| f32d3a4877 | |||
| 0fe449538e | |||
| c797cb9f24 | |||
| e884b0e97d | |||
| 9b153dacd8 | |||
| fdf7e89afe | |||
| 7baa903f7a | |||
| 3e0ba5f209 | |||
| a5598130db | |||
| e6ceea1b1b | |||
| 064e8a8054 | |||
| 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
|
||||||
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
<?php namespace GermanAirlinesVa\Graphql;
|
|
||||||
|
|
||||||
use Closure;
|
|
||||||
|
|
||||||
class Authentication
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Handle an incoming request.
|
|
||||||
*
|
|
||||||
* @param \Illuminate\Http\Request $request
|
|
||||||
* @param \Closure $next
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function handle($request, Closure $next)
|
|
||||||
{
|
|
||||||
if ($request->input('gql_session') === 'SUPER_SECRET_TOKEN') {
|
|
||||||
return "false";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return "true";
|
|
||||||
}
|
|
||||||
|
|
||||||
return $next($request);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+6
-2
@@ -5,6 +5,7 @@ use System\Classes\PluginBase;
|
|||||||
use App;
|
use App;
|
||||||
use Config;
|
use Config;
|
||||||
use Illuminate\Database\DatabaseManager;
|
use Illuminate\Database\DatabaseManager;
|
||||||
|
use Illuminate\Support\Facades\Broadcast;
|
||||||
use Illuminate\Foundation\AliasLoader;
|
use Illuminate\Foundation\AliasLoader;
|
||||||
use GermanAirlinesVa\Graphql\Classes\GraphqlServiceProvider;
|
use GermanAirlinesVa\Graphql\Classes\GraphqlServiceProvider;
|
||||||
use Nuwave\Lighthouse\Subscriptions\SubscriptionServiceProvider;
|
use Nuwave\Lighthouse\Subscriptions\SubscriptionServiceProvider;
|
||||||
@@ -43,10 +44,13 @@ 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']);
|
Broadcast::routes([
|
||||||
require("channels/channels.php");
|
'prefix' => '',
|
||||||
|
'middleware' => 'GermanAirlinesVA\\Graphql\\Classes\\Authentication',
|
||||||
|
]);
|
||||||
|
|
||||||
Config::set('database.connections.germanairlinesva_graphql', Config::get('germanairlinesva.graphql::connection'));
|
Config::set('database.connections.germanairlinesva_graphql', Config::get('germanairlinesva.graphql::connection'));
|
||||||
|
Config::push('system.unencrypt_cookies', 'graphql-session-id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function bootPackages()
|
public function bootPackages()
|
||||||
|
|||||||
@@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
## GraphQLKeys
|
## GraphQLKeys
|
||||||
|
|
||||||
- **TODO** BelongsTo Member (External DB)
|
- BelongsTo Member (External DB, creation in Social Plugin)
|
||||||
|
|||||||
@@ -32920,7 +32920,7 @@ var _validUrl = __webpack_require__(429);
|
|||||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
||||||
|
|
||||||
var options = { method: 'post', headers: { 'Content-Type': 'application/json' } };
|
var options = { method: 'post', headers: { 'Content-Type': 'application/json' } };
|
||||||
var endpoint = 'http://localhost/graphql/'; // Initial
|
var endpoint = 'http://' + window.location.host + '/graphql/'; // Initial
|
||||||
|
|
||||||
var defaultQuery = '\n# Welcome to GraphiQL\n#\n# GraphiQL is an in-browser tool for writing, validating, and\n# testing GraphQL queries.\n#\n# Type queries into this side of the screen, and you will see intelligent\n# typeaheads aware of the current GraphQL type schema and live syntax and\n# validation errors highlighted within the text.\n#\n# GraphQL queries typically start with a "{" character. Lines that starts\n# with a # are ignored.\n#\n# An example GraphQL query might look like:\n#\n# {\n# field(arg: "value") {\n# subField\n# }\n# }\n#\n# Keyboard shortcuts:\n#\n# Run Query: Ctrl-Enter (or press the play button above)\n#\n# Auto Complete: Ctrl-Space (or just start typing)\n#\n# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #\n# Default endpoint is an instance of https://www.graph.cool/\n# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #\n\nquery {\n countries {\n name\n }\n}\n';
|
var defaultQuery = '\n# Welcome to GraphiQL\n#\n# GraphiQL is an in-browser tool for writing, validating, and\n# testing GraphQL queries.\n#\n# Type queries into this side of the screen, and you will see intelligent\n# typeaheads aware of the current GraphQL type schema and live syntax and\n# validation errors highlighted within the text.\n#\n# GraphQL queries typically start with a "{" character. Lines that starts\n# with a # are ignored.\n#\n# An example GraphQL query might look like:\n#\n# {\n# field(arg: "value") {\n# subField\n# }\n# }\n#\n# Keyboard shortcuts:\n#\n# Run Query: Ctrl-Enter (or press the play button above)\n#\n# Auto Complete: Ctrl-Space (or just start typing)\n#\n# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #\n# Default endpoint is an instance of https://www.graph.cool/\n# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #\n\nquery {\n countries {\n name\n }\n}\n';
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -1,18 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Broadcast;
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Broadcast Channels
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Here you may register all of the event broadcasting channels that your
|
|
||||||
| application supports. The given channel authorization callbacks are
|
|
||||||
| used to check if an authenticated user can listen to the channel.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
Broadcast::channel('lighthouse-*', function ($user) {
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
@@ -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);
|
||||||
|
|||||||
+1
-1
@@ -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];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?php namespace GermanAirlinesVa\Graphql\Controllers;
|
||||||
|
|
||||||
|
use Backend\Classes\Controller;
|
||||||
|
|
||||||
|
class GraphqlKey extends Controller
|
||||||
|
{
|
||||||
|
public $implement = ['Backend\Behaviors\ListController'];
|
||||||
|
|
||||||
|
public $listConfig = 'config_list.yaml';
|
||||||
|
|
||||||
|
public $requiredPermissions = ['germanairlinesva.graphql.master'];
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,17 +1,16 @@
|
|||||||
<?php namespace GermanAirlinesVa\Graphql\Controllers;
|
<?php namespace GermanAirlinesVa\Graphql\Controllers;
|
||||||
|
|
||||||
use Backend\Classes\Controller;
|
use Backend\Classes\Controller;
|
||||||
use BackendMenu;
|
|
||||||
|
|
||||||
class Playground extends Controller
|
class Playground extends Controller
|
||||||
{
|
{
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
BackendMenu::setContext('GermanAirlinesVa.Graphql', 'menu', 'playground');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public $requiredPermissions = ['germanairlinesva.graphql.master'];
|
||||||
|
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$this->pageTitle = 'germanairlinesva.graphql::lang.menu.playground';
|
$this->pageTitle = 'germanairlinesva.graphql::lang.menu.playground';
|
||||||
|
|||||||
@@ -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() ?>
|
||||||
+11
-3
@@ -1,4 +1,3 @@
|
|||||||
title = "CMS"
|
|
||||||
==
|
==
|
||||||
<?php
|
<?php
|
||||||
use Cms\Classes\Theme;
|
use Cms\Classes\Theme;
|
||||||
@@ -14,8 +13,17 @@ function resolveCmsContent($root, $args) {
|
|||||||
?>
|
?>
|
||||||
==
|
==
|
||||||
# Content
|
# Content
|
||||||
extend type Query { cmsContent(name: String!): CmsContent! }
|
extend type Query {
|
||||||
type CmsContent { fileName: String! content: String markup: String parsedMarkup: String }
|
cmsContent(name: String!): CmsContent!
|
||||||
|
}
|
||||||
|
|
||||||
|
type CmsContent {
|
||||||
|
fileName: String!
|
||||||
|
content: String
|
||||||
|
markup: String
|
||||||
|
parsedMarkup: String
|
||||||
|
}
|
||||||
|
|
||||||
# CMS-wide types
|
# CMS-wide types
|
||||||
# Backend\Models\User
|
# Backend\Models\User
|
||||||
type BackendUser { id: ID! }
|
type BackendUser { id: ID! }
|
||||||
|
|||||||
+7
-12
@@ -1,4 +1,3 @@
|
|||||||
title = "Fleet"
|
|
||||||
==
|
==
|
||||||
==
|
==
|
||||||
# Content
|
# Content
|
||||||
@@ -6,19 +5,12 @@ extend type Query {
|
|||||||
aircraft: [Aircraft] @all(model: "GermanAirlinesVa\\Fleet\\Models\\Aircraft")
|
aircraft: [Aircraft] @all(model: "GermanAirlinesVa\\Fleet\\Models\\Aircraft")
|
||||||
aircraftType: [AircraftType] @all(model: "GermanAirlinesVa\\Fleet\\Models\\AircraftType")
|
aircraftType: [AircraftType] @all(model: "GermanAirlinesVa\\Fleet\\Models\\AircraftType")
|
||||||
}
|
}
|
||||||
|
|
||||||
extend type Subscription {
|
extend type Subscription {
|
||||||
aircraftAdded: Aircraft @subscription(class: "GermanAirlinesVa\\Fleet\\Classes\\AircraftAdded")
|
aircraftAdded: Aircraft @subscription(class: "GermanAirlinesVa\\Fleet\\Classes\\AircraftAdded")
|
||||||
}
|
}
|
||||||
|
|
||||||
extend type Mutation {
|
extend type Mutation {
|
||||||
addAircraft(
|
addAircraft(aircraft_type_id: ID!, home_airport_id: ID!, name: String!, registration: String! ): Aircraft
|
||||||
aircraft_type_id: ID!,
|
@create(model:"GermanAirlinesVa\\Fleet\\Models\\Aircraft")
|
||||||
home_airport_id: ID!,
|
|
||||||
name: String!,
|
|
||||||
registration: String!
|
|
||||||
): Aircraft
|
|
||||||
@create(model: "GermanAirlinesVa\\Fleet\\Models\\Aircraft")
|
|
||||||
@broadcast(subscription: "aircraftAdded")
|
@broadcast(subscription: "aircraftAdded")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,4 +21,7 @@ type Aircraft {
|
|||||||
name: String!
|
name: String!
|
||||||
registration: String!
|
registration: String!
|
||||||
}
|
}
|
||||||
type AircraftType { type: String! aircrafts: [Aircraft] @hasMany }
|
type AircraftType {
|
||||||
|
type: String!
|
||||||
|
aircrafts: [Aircraft] @hasMany
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,150 @@
|
|||||||
|
==
|
||||||
|
<?php
|
||||||
|
function resolveExamMemberRanks($root, $args) {
|
||||||
|
$exams = \GermanAirlinesVa\Schooling\Models\ExamMemberRank::where('member_id', $args['memberID'])->get();
|
||||||
|
foreach($exams as $exam) {
|
||||||
|
$exam->load([
|
||||||
|
'exam_questions' => function ($query) {
|
||||||
|
$query->groupBy('id');
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
return $exams;
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolveExamTyperatings($root, $args) {
|
||||||
|
$exams = \GermanAirlinesVa\Schooling\Models\ExamTyperating::where('member_id', $args['memberID'])->get();
|
||||||
|
foreach($exams as $exam) {
|
||||||
|
$exam->load([
|
||||||
|
'exam_questions' => function ($query) {
|
||||||
|
$query->groupBy('id');
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
return $exams;
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolveTyperatings() {
|
||||||
|
$typeratings = GermanAirlinesVa\Schooling\Models\Typerating::all();
|
||||||
|
foreach($typeratings as $typerating) {
|
||||||
|
$typerating->load([
|
||||||
|
'exam_questions' => function($query) {
|
||||||
|
$query->groupBy('id');
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
return $typeratings;
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolveMemberRanks() {
|
||||||
|
$ranks = GermanAirlinesVa\Schooling\Models\MemberRank::all();
|
||||||
|
foreach($ranks as $rank) {
|
||||||
|
$rank->load([
|
||||||
|
'exam_questions' => function($query) {
|
||||||
|
$query->groupBy('id');
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
return $rank;
|
||||||
|
}
|
||||||
|
|
||||||
|
function createExamMemberRank($root, $args) {
|
||||||
|
return GermanAirlinesVa\Schooling\Models\ExamMemberRank::createNew($args['memberID'], $args['memberRankID']);
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolveCreateExamTyperating($root, $args) {
|
||||||
|
return GermanAirlinesVa\Schooling\Models\ExamTyperating::createNew($args['memberID'], $args['typeratingID']);
|
||||||
|
}
|
||||||
|
==
|
||||||
|
# Content
|
||||||
|
extend type Query {
|
||||||
|
memberRanks: [MemberRank]!
|
||||||
|
typeratings: [Typerating]!
|
||||||
|
examMemberRanks(memberID: ID!): [ExamMemberRank]!
|
||||||
|
examTyperatings(memberID: ID!): [ExamTyperating]!
|
||||||
|
}
|
||||||
|
extend type Mutation {
|
||||||
|
createExamMemberRank(memberID: ID!, memberRankID: ID!): ExamMemberRank!
|
||||||
|
createExamTyperating(memberID: ID!, typeratingID: ID!): ExamTyperating!
|
||||||
|
}
|
||||||
|
|
||||||
|
type MemberRank {
|
||||||
|
id: ID!
|
||||||
|
name: String!
|
||||||
|
description: String!
|
||||||
|
points: Int!
|
||||||
|
price: Int!
|
||||||
|
badge: String!
|
||||||
|
region: String!
|
||||||
|
exam_questions: [ExamMemberRankQuestion]! @hasMany
|
||||||
|
exams: [ExamMemberRank]! @hasMany
|
||||||
|
}
|
||||||
|
type Typerating {
|
||||||
|
id: ID!
|
||||||
|
name: String!
|
||||||
|
price: Int!
|
||||||
|
exam_questions: [ExamTyperatingQuestion]! @hasMany
|
||||||
|
exams: [ExamTyperating]! @hasMany
|
||||||
|
}
|
||||||
|
type ExamMemberRank {
|
||||||
|
id: ID!
|
||||||
|
member_id: ID!
|
||||||
|
member_rank: MemberRank! @belongsTo
|
||||||
|
start: DateTime!
|
||||||
|
status: ExamStatus!
|
||||||
|
exam_questions: [ExamMemberRankQuestion]! @belongsToMany
|
||||||
|
exam_answers: [ExamMemberRankAnswer]! @belongsToMany
|
||||||
|
}
|
||||||
|
type ExamTyperating {
|
||||||
|
id: ID!
|
||||||
|
member_id: ID!
|
||||||
|
typerating: Typerating! @belongsTo
|
||||||
|
start: DateTime!
|
||||||
|
status: ExamStatus!
|
||||||
|
exam_questions: [ExamTyperatingQuestion]! @belongsToMany
|
||||||
|
exam_answers: [ExamTyperatingAnswer]! @belongsToMany
|
||||||
|
}
|
||||||
|
type ExamMemberRankQuestion {
|
||||||
|
id: ID!
|
||||||
|
member_rank: MemberRank! @belongsTo
|
||||||
|
in_use: Boolean!
|
||||||
|
mandatory: Boolean!
|
||||||
|
text: String!
|
||||||
|
picture: String!
|
||||||
|
exam_answers: [ExamMemberRankAnswer]! @hasMany
|
||||||
|
exam_member_ranks: [ExamMemberRank]! @belongsToMany
|
||||||
|
}
|
||||||
|
type ExamTyperatingQuestion {
|
||||||
|
id: ID!
|
||||||
|
typerating: Typerating! @belongsTo
|
||||||
|
in_use: Boolean!
|
||||||
|
mandatory: Boolean!
|
||||||
|
text: String!
|
||||||
|
picture: String!
|
||||||
|
exam_answers: [ExamTyperatingAnswer]! @hasMany
|
||||||
|
exma_typeratings: [ExamTyperating]! @belongsToMany
|
||||||
|
}
|
||||||
|
type ExamMemberRankAnswer {
|
||||||
|
id: ID!
|
||||||
|
exam_question: ExamMemberRankQuestion! @belongsTo
|
||||||
|
text: String!
|
||||||
|
is_correct: Boolean!
|
||||||
|
exam_member_ranks: [ExamMemberRank]! @belongsToMany
|
||||||
|
}
|
||||||
|
type ExamTyperatingAnswer {
|
||||||
|
id: ID!
|
||||||
|
exam_question: ExamTyperatingQuestion! @belongsTo
|
||||||
|
text: String!
|
||||||
|
is_correct: Boolean!
|
||||||
|
exam_typeratings: [ExamTyperating]! @belongsToMany
|
||||||
|
}
|
||||||
|
|
||||||
|
enum ExamStatus {
|
||||||
|
open
|
||||||
|
pending
|
||||||
|
closed
|
||||||
|
validated
|
||||||
|
}
|
||||||
|
|
||||||
|
scalar DateTime
|
||||||
|
@scalar(class: "Nuwave\\Lighthouse\\Schema\\Types\\Scalars\\DateTime")
|
||||||
+3
-1
@@ -4,7 +4,9 @@
|
|||||||
'description' => '',
|
'description' => '',
|
||||||
],
|
],
|
||||||
'menu' => [
|
'menu' => [
|
||||||
'playground' => 'GA GraphiQL',
|
'main' => 'GA GraphQL',
|
||||||
|
'keys' => 'GraphQL Keys',
|
||||||
|
'playground' => 'GraphiQL',
|
||||||
],
|
],
|
||||||
'permission' => [
|
'permission' => [
|
||||||
'tab' => [
|
'tab' => [
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php namespace GermanAirlinesVa\Graphql\Models;
|
||||||
|
|
||||||
|
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',
|
||||||
|
];
|
||||||
|
|
||||||
|
public $belongsTo = [
|
||||||
|
'member' => 'GermanAirlinesVa\Social\Models\Member',
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
<?php namespace GermanAirlinesVa\Graphql\Models;
|
<?php namespace GermanAirlinesVa\Graphql\Models;
|
||||||
|
|
||||||
use Cms\Classes\Theme;
|
|
||||||
use Model;
|
use Model;
|
||||||
|
|
||||||
class Settings extends Model
|
class Settings extends Model
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
columns:
|
||||||
|
id:
|
||||||
|
label: id
|
||||||
|
type: number
|
||||||
|
member:
|
||||||
|
label: member
|
||||||
|
type: text
|
||||||
|
relation: member
|
||||||
|
valueFrom: name
|
||||||
|
valid_from:
|
||||||
|
label: valid_from
|
||||||
|
type: datetime
|
||||||
|
key:
|
||||||
|
label: key
|
||||||
|
type: text
|
||||||
+4
-3
@@ -6,10 +6,11 @@
|
|||||||
"author": "German Airlines VA",
|
"author": "German Airlines VA",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@prettier/plugin-php": "^0.16.3",
|
"@prettier/plugin-php": "^0.17.3",
|
||||||
"prettier": "^2.3.0"
|
"prettier": "^2.3.2"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"format": "prettier --write './**/*.{php,html,htm,yaml}'"
|
"preinstall": "git config core.hooksPath .hooks",
|
||||||
|
"format": "prettier --write './**/*.{php,html,yaml}'"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-4
@@ -5,13 +5,22 @@ plugin:
|
|||||||
icon: oc-icon-database
|
icon: oc-icon-database
|
||||||
homepage: ''
|
homepage: ''
|
||||||
permissions:
|
permissions:
|
||||||
schemas:
|
germanairlinesva.graphql.master:
|
||||||
tab: 'germanairlinesva.graphql::lang.permission.tab.schemas'
|
tab: 'germanairlinesva.graphql::lang.permission.tab.schemas'
|
||||||
label: 'germanairlinesva.graphql::lang.permission.label.schemas'
|
label: 'germanairlinesva.graphql::lang.permission.label.schemas'
|
||||||
navigation:
|
navigation:
|
||||||
menu:
|
menu:
|
||||||
label: 'germanairlinesva.graphql::lang.menu.playground'
|
label: 'germanairlinesva.graphql::lang.menu.main'
|
||||||
url: germanairlinesva/graphql/playground
|
url: /
|
||||||
icon: icon-database
|
icon: icon-database
|
||||||
permissions:
|
permissions:
|
||||||
- schemas
|
- germanairlinesva.graphql.master
|
||||||
|
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,5 +0,0 @@
|
|||||||
# Relations
|
|
||||||
|
|
||||||
## GraphQLKeys
|
|
||||||
|
|
||||||
- **TODO** BelongsTo Member (External DB)
|
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
<?php namespace GermanAirlinesVa\GraphQl\Updates;
|
<?php namespace GermanAirlinesVa\GraphQl\Updates;
|
||||||
|
|
||||||
use Config;
|
|
||||||
use Schema;
|
use Schema;
|
||||||
use October\Rain\Database\Updates\Migration;
|
use October\Rain\Database\Updates\Migration;
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
<?php namespace GermanAirlinesVa\GraphQl\Updates;
|
<?php namespace GermanAirlinesVa\Graphql\Updates;
|
||||||
|
|
||||||
use DB;
|
use DB;
|
||||||
use Schema;
|
use Schema;
|
||||||
use October\Rain\Database\Updates\Migration;
|
use October\Rain\Database\Updates\Migration;
|
||||||
|
|
||||||
class BuilderTableCreateGermanAirlinesVaGraphQlGraphQlKeys extends Migration
|
class BuilderTableCreateGermanAirlinesVaGraphqlGraphqlKeys extends Migration
|
||||||
{
|
{
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::connection('germanairlinesva_graphql')->create('graphql_keys', function ($table) {
|
Schema::connection('germanairlinesva_graphql')->create('graphql_keys', function ($table) {
|
||||||
$table->engine = 'InnoDB';
|
$table->engine = 'InnoDB';
|
||||||
$table->bigIncrements('id')->unsigned();
|
$table->bigIncrements('id')->unsigned();
|
||||||
|
$table->bigInteger('member_id')->unsigned();
|
||||||
$table->datetime('valid_from')->default(DB::raw('NOW()'));
|
$table->datetime('valid_from')->default(DB::raw('NOW()'));
|
||||||
$table->datetime('valid_to')->default(DB::raw('NOW()'));
|
|
||||||
$table->string('key');
|
$table->string('key');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,14 +2,14 @@
|
|||||||
# yarn lockfile v1
|
# yarn lockfile v1
|
||||||
|
|
||||||
|
|
||||||
"@prettier/plugin-php@^0.16.3":
|
"@prettier/plugin-php@^0.17.3":
|
||||||
version "0.16.3"
|
version "0.17.3"
|
||||||
resolved "https://registry.yarnpkg.com/@prettier/plugin-php/-/plugin-php-0.16.3.tgz#74867210079ba3c0c3ae843029d76e25ff0aadf3"
|
resolved "https://registry.yarnpkg.com/@prettier/plugin-php/-/plugin-php-0.17.3.tgz#193a18e308db7416f26f6e1dc0d2605d1ff01416"
|
||||||
integrity sha512-DNidzeGpP+/wmcCAZNSHxgoAnhEosYG+no4jJRqln19e1o3Okpuir/2JMxb07VCwdG50IWjtNgVwNPVl4uj0Hg==
|
integrity sha512-kD5IrGyKWF/p3XActVZ+GfbMl9knoK3XKBTG2bytpOtCO0+Q8eozimSgk/493rgFkXL3W2Ap/4GKgZf7u64+ow==
|
||||||
dependencies:
|
dependencies:
|
||||||
linguist-languages "^7.5.1"
|
linguist-languages "^7.5.1"
|
||||||
mem "^8.0.0"
|
mem "^8.0.0"
|
||||||
php-parser "3.0.2"
|
php-parser "https://github.com/glayzzle/php-parser#e61e26102144f267ecf5e09020865a9baa6ca2f1"
|
||||||
|
|
||||||
linguist-languages@^7.5.1:
|
linguist-languages@^7.5.1:
|
||||||
version "7.15.0"
|
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"
|
resolved "https://registry.yarnpkg.com/p-defer/-/p-defer-1.0.0.tgz#9f6eb182f6c9aa8cd743004a7d4f96b196b0fb0c"
|
||||||
integrity sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=
|
integrity sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=
|
||||||
|
|
||||||
php-parser@3.0.2:
|
"php-parser@https://github.com/glayzzle/php-parser#e61e26102144f267ecf5e09020865a9baa6ca2f1":
|
||||||
version "3.0.2"
|
version "3.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/php-parser/-/php-parser-3.0.2.tgz#a86dbbc110e57378cba71ab4cd9b0d18f3872ac3"
|
resolved "https://github.com/glayzzle/php-parser#e61e26102144f267ecf5e09020865a9baa6ca2f1"
|
||||||
integrity sha512-a7y1+odEGsceLDLpu7oNyspZ0pK8FMWJOoim4/yd82AtnEZNLdCLZ67arnOQZ9K0lHJiSp4/7lVUpGELVxE14w==
|
|
||||||
|
|
||||||
prettier@^2.3.0:
|
prettier@^2.3.2:
|
||||||
version "2.3.0"
|
version "2.3.2"
|
||||||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.3.0.tgz#b6a5bf1284026ae640f17f7ff5658a7567fc0d18"
|
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.3.2.tgz#ef280a05ec253712e486233db5c6f23441e7342d"
|
||||||
integrity sha512-kXtO4s0Lz/DW/IJ9QdWhAf7/NmPWQXkFr/r/WkR3vyI+0v8amTDxiaQSLzs8NBlytfLWX/7uQUMIW677yLKl4w==
|
integrity sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ==
|
||||||
|
|||||||
Reference in New Issue
Block a user