Compare commits

...

29 Commits

Author SHA1 Message Date
Kilian dda6143f8a Controller Permission 2021-08-14 19:51:48 +02:00
Kilian 52d0e89a35 Remove commented FK 2021-08-14 18:20:58 +02:00
Kilian 24a1b0e8cf Namespace Permission 2021-08-14 14:18:09 +02:00
Kilian b5b7967eb7 Aircraft Airport ICAO instead of Name field 2021-08-05 01:23:45 +02:00
Kilian 683c6f52ad Repository and Name 2021-08-04 19:20:04 +02:00
Kilian a49e7d8fb5 Unused use removed 2021-08-04 19:14:40 +02:00
Your Name fe3bc46636 Aircraft Airport Relation 2021-08-04 17:42:26 +02:00
Your Name 7244639051 Readme 2021-08-04 13:42:58 +02:00
Your Name 33ed2f4d00 AC Type Relation 2021-08-04 13:41:40 +02:00
Your Name f75136f1e5 Formating .htm removed 2021-08-04 12:35:30 +02:00
Your Name e7d5089e2d Updated 2021-08-04 01:59:12 +02:00
Your Name 695bea264d Yarn 2021-08-04 01:49:42 +02:00
Your Name 7ee76e1f70 Hooks 2021-08-04 01:29:20 +02:00
Your Name 8978db32ce Hooks 2021-08-04 01:23:34 +02:00
Your Name e306c911c3 Hooks 2021-08-04 01:22:39 +02:00
Your Name a235246d65 Hooks 2021-08-04 01:03:20 +02:00
Your Name 91b3ca5618 Hooks 2021-08-04 01:02:26 +02:00
Your Name f7cabcce8f Lockfile 2021-08-04 00:55:54 +02:00
Your Name a4ea1f6a4a Naming adjusted for consistency 2021-07-29 01:29:38 +02:00
Your Name 9a60bf1659 Auth 2021-07-28 21:59:31 +02:00
Your Name 17a994f0d5 Mutations 2021-07-28 19:11:00 +02:00
Your Name eb9b7a473a Array 2021-07-26 20:21:42 +02:00
Gogs 3d657ecfd8 Composer.json 2021-07-25 17:32:06 +02:00
Gogs b28e53d333 Subscription testing 2021-07-25 01:06:13 +02:00
Gogs d8b5904ef5 format 2021-06-16 22:14:17 +02:00
Gogs 9bdf500359 Switch fields 2021-06-16 22:07:08 +02:00
Gogs 4375975002 Deferred Bindings 2021-06-14 16:07:36 +02:00
Gogs 3096af9c7a Naming 2021-06-14 00:39:21 +02:00
Gogs f01610d30d Typerating FK and editor changes to match 2021-06-14 00:06:07 +02:00
23 changed files with 204 additions and 68 deletions
+12
View File
@@ -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
+11 -13
View File
@@ -1,23 +1,21 @@
# Relations
## AircraftManufacturers
## AircraftManufacturer
- HasMany AircraftType
## AircraftTypes
## AircraftType
- BelongsTo AircraftManufacturers
- **TODO** BelongsTo Typeratings (External DB)
- HasMany Aircrafts
- BelongsTo AircraftManufacturer
- BelongsTo Typerating (External DB, creation in Schooling Plugin)
- HasMany Aircraft
## Aircrafts
## Aircraft
- BelongsTo AircraftTypes
- BelongsToMany AircraftTypeGroups
- **TODO** BelongsTo Airports (External DB, Multiple)
- BelongsTo AircraftType
- BelongsToMany AircraftTypeGroup
- BelongsTo Airport (2x, External DB, creation in Routes Plugin)
## AircraftTypeGroups
## AircraftTypeGroup
- BelongsToMany AircraftTypes
---
- BelongsToMany AircraftType
+75
View File
@@ -0,0 +1,75 @@
<?php namespace GermanAirlinesVa\Fleet\Classes;
use GermanAirlinesVa\Fleet\Models\Aircraft;
use Illuminate\Support\Str;
use Illuminate\Http\Request;
use GraphQL\Type\Definition\ResolveInfo;
use Nuwave\Lighthouse\Subscriptions\Subscriber;
use Nuwave\Lighthouse\Schema\Types\GraphQLSubscription;
use Nuwave\Lighthouse\Support\Contracts\GraphQLContext;
class AircraftAdded extends GraphQLSubscription
{
/**
* Check if subscriber is allowed to listen to the subscription.
*
* @param \Nuwave\Lighthouse\Subscriptions\Subscriber $subscriber
* @param \Illuminate\Http\Request $request
* @return bool
*/
public function authorize(Subscriber $subscriber, Request $request): bool
{
return true;
}
/**
* Filter which subscribers should receive the subscription.
*
* @param \Nuwave\Lighthouse\Subscriptions\Subscriber $subscriber
* @param mixed $root
* @return bool
*/
public function filter(Subscriber $subscriber, $root): bool
{
return true;
}
/**
* Encode topic name.
*
* @param \Nuwave\Lighthouse\Subscriptions\Subscriber $subscriber
* @param string $fieldName
* @return string
*/
public function encodeTopic(Subscriber $subscriber, string $fieldName): string
{
// Create a unique topic name based on the `author` argument
return Str::snake($fieldName);
}
/**
* Decode topic name.
*
* @param string $fieldName
* @param \App\Post $root
* @return string
*/
public function decodeTopic(string $fieldName, $root): string
{
return Str::snake($fieldName);
}
/**
* Resolve the subscription.
*
* @param \App\Post $root
* @param array<string, mixed> $args
* @param \Nuwave\Lighthouse\Support\Contracts\GraphQLContext $context
* @param \GraphQL\Type\Definition\ResolveInfo $resolveInfo
* @return mixed
*/
public function resolve($root, array $args, GraphQLContext $context, ResolveInfo $resolveInfo): Aircraft
{
return $root;
}
}
+9
View File
@@ -0,0 +1,9 @@
{
"name": "germanairlinesva/fleet",
"type": "october-plugin",
"description": "None",
"require": {
"composer/installers": "~1.0"
}
}
+2 -1
View File
@@ -1,7 +1,6 @@
<?php namespace GermanAirlinesVa\Fleet\Controllers;
use Backend\Classes\Controller;
use BackendMenu;
class Aircraft extends Controller
{
@@ -10,6 +9,8 @@ class Aircraft extends Controller
public $listConfig = 'config_list.yaml';
public $formConfig = 'config_form.yaml';
public $requiredPermissions = ['germanairlinesva.fleet.master'];
public function __construct()
{
parent::__construct();
+2 -1
View File
@@ -1,7 +1,6 @@
<?php namespace GermanAirlinesVa\Fleet\Controllers;
use Backend\Classes\Controller;
use BackendMenu;
class AircraftManufacturer extends Controller
{
@@ -10,6 +9,8 @@ class AircraftManufacturer extends Controller
public $listConfig = 'config_list.yaml';
public $formConfig = 'config_form.yaml';
public $requiredPermissions = ['germanairlinesva.fleet.master'];
public function __construct()
{
parent::__construct();
+2 -1
View File
@@ -1,7 +1,6 @@
<?php namespace GermanAirlinesVa\Fleet\Controllers;
use Backend\Classes\Controller;
use BackendMenu;
class AircraftType extends Controller
{
@@ -10,6 +9,8 @@ class AircraftType extends Controller
public $listConfig = 'config_list.yaml';
public $formConfig = 'config_form.yaml';
public $requiredPermissions = ['germanairlinesva.fleet.master'];
public function __construct()
{
parent::__construct();
+2 -1
View File
@@ -1,7 +1,6 @@
<?php namespace GermanAirlinesVa\Fleet\Controllers;
use Backend\Classes\Controller;
use BackendMenu;
class AircraftTypeGroup extends Controller
{
@@ -10,6 +9,8 @@ class AircraftTypeGroup extends Controller
public $listConfig = 'config_list.yaml';
public $formConfig = 'config_form.yaml';
public $requiredPermissions = ['germanairlinesva.fleet.master'];
public function __construct()
{
parent::__construct();
+1 -1
View File
@@ -1,6 +1,6 @@
<?php return [
'plugin' => [
'name' => 'Fleet',
'name' => 'GA Fleet',
'description' => '',
],
'aircraft_manufacturers' => [
+2
View File
@@ -33,5 +33,7 @@ class Aircraft extends Model
public $belongsTo = [
'aircraft_type' => 'GermanAirlinesVa\Fleet\Models\AircraftType',
'home_airport' => 'GermanAirlinesVa\Routes\Models\Airport',
'airport' => 'GermanAirlinesVa\Routes\Models\Airport',
];
}
+2 -1
View File
@@ -25,7 +25,7 @@ class AircraftType extends Model
* @var array Validation rules
*/
public $rules = [
'aircraft_manufacturer' => 'required',
'aircraft_manufacturer_id' => 'required',
'typerating_id' => 'required',
'only_charter' => 'required',
'type' => 'required',
@@ -52,6 +52,7 @@ class AircraftType extends Model
public $belongsTo = [
'aircraft_manufacturer' => 'GermanAirlinesVa\Fleet\Models\AircraftManufacturer',
'typerating' => 'GermanAirlinesVa\Schooling\Models\Typerating',
];
public $belongsToMany = [
+13 -7
View File
@@ -2,15 +2,21 @@ columns:
id:
label: id
type: text
aircraft_type_id:
label: aircraft_type_id
aircraft_type:
label: aircraft_type
type: text
home_airport_id:
label: home_airport_id
relation: aircraft_type
valueFrom: type
home_airport:
label: home_airport
type: text
airport_id:
label: airport_id
relation: home_airport
valueFrom: icao
airport:
label: airport
type: text
relation: airport
valueFrom: icao
name:
label: name
type: text
@@ -19,7 +25,7 @@ columns:
type: text
in_use:
label: in_use
type: text
type: switch
total_miles:
label: total_miles
type: text
+4 -2
View File
@@ -16,8 +16,10 @@ fields:
span: auto
required: 1
type: text
home_airport_id:
home_airport:
label: 'germanairlinesva.fleet::lang.aircrafts.home_base'
nameFrom: icao
descriptionFrom: description
span: auto
required: 1
type: number
type: relation
+11 -7
View File
@@ -2,15 +2,19 @@ columns:
id:
label: id
type: text
aircraft_manufacturers_id:
label: aircraft_manufacturers_id
type: number
typerating_id:
label: typerating_id
type: number
aircraft_manufacturer:
label: aircraft_manufacturer
relation: aircraft_manufacturer
type: text
valueFrom: name
typerating:
label: typerating
relation: typerating
type: text
valueFrom: name
only_charter:
label: only_charter
type: text
type: switch
type:
label: type
type: text
+4 -2
View File
@@ -8,11 +8,13 @@ tabs:
required: 1
type: relation
tab: 'germanairlinesva.fleet::lang.aircraft_types.tabs.operational'
typerating_id:
typerating:
label: 'germanairlinesva.fleet::lang.aircraft_types.typerating_id'
nameFrom: name
descriptionFrom: description
span: auto
required: 1
type: number
type: relation
tab: 'germanairlinesva.fleet::lang.aircraft_types.tabs.operational'
only_charter:
label: 'germanairlinesva.fleet::lang.aircraft_types.only_charter'
+5 -4
View File
@@ -1,15 +1,16 @@
{
"name": "graphql",
"name": "fleet",
"version": "1.0.0",
"main": "Plugin.php",
"repository": "https://git.hofmannnet.myhome-server.de/GermanAirlines/GermanAirlinesVA-GraphQL.git",
"repository": "https://git.hofmannnet.myhome-server.de/GermanAirlines/GermanAirlinesVA-Fleet.git",
"author": "German Airlines VA",
"license": "MIT",
"devDependencies": {
"@prettier/plugin-php": "^0.16.3",
"@prettier/plugin-php": "^0.17.3",
"prettier": "^2.3.0"
},
"scripts": {
"format": "prettier --write './**/*.{php,html,htm,yaml}'"
"preinstall": "git config core.hooksPath .hooks",
"format": "prettier --write './**/*.{php,html,yaml}'"
}
}
+2 -2
View File
@@ -10,7 +10,7 @@ navigation:
url: /
icon: icon-plane
permissions:
- fleet
- germanairlinesva.fleet.master
sideMenu:
side-menu-item:
label: 'germanairlinesva.fleet::lang.menu.groups'
@@ -29,6 +29,6 @@ navigation:
url: germanairlinesva/fleet/aircraft
icon: icon-plane
permissions:
fleet:
germanairlinesva.fleet.master:
tab: 'germanairlinesva.fleet::lang.permissions.tab.fleet'
label: 'germanairlinesva.fleet::lang.permissions.label.fleet'
@@ -1,6 +1,5 @@
<?php namespace GermanAirlinesVa\Fleet\Updates;
use Config;
use Schema;
use October\Rain\Database\Updates\Migration;
@@ -19,6 +18,8 @@ class BuilderTableCreateGermanAirlinesVaAircraftManufacturers extends Migration
public function down()
{
Schema::connection('germanairlinesva_fleet')->disableForeignKeyConstraints();
Schema::connection('germanairlinesva_fleet')->dropIfExists('aircraft_manufacturers');
Schema::connection('germanairlinesva_fleet')->enableForeignKeyConstraints();
}
}
@@ -1,6 +1,5 @@
<?php namespace GermanAirlinesVa\Fleet\Updates;
use Config;
use Schema;
use October\Rain\Database\Updates\Migration;
@@ -17,10 +16,6 @@ class BuilderTableCreateGermanAirlinesVaAircraftTypes extends Migration
->references('id')
->on('aircraft_manufacturers');
$table->bigInteger('typerating_id')->unsigned();
//$table
// ->foreign('typerating_id')
// ->references('id')
// ->on('typeratings');
$table->boolean('only_charter');
$table->string('type');
$table->text('description');
+1 -8
View File
@@ -1,4 +1,5 @@
<?php namespace GermanAirlinesVa\Fleet\Updates;
use DB;
use Schema;
use October\Rain\Database\Updates\Migration;
@@ -16,18 +17,10 @@ class BuilderTableCreateGermanAirlinesVaFleetAircrafts extends Migration
->references('id')
->on('aircraft_types');
$table->bigInteger('home_airport_id')->unsigned();
//$table
// ->foreign('home_airport_id')
// ->references('id')
// ->on('airports');
$table
->bigInteger('airport_id')
->unsigned()
->nullable();
//$table
// ->foreign('airport_id')
// ->references('id')
// ->on('airports');
$table->string('name');
$table->string('registration');
$table->boolean('in_use')->default(true);
@@ -0,0 +1,30 @@
<?php namespace GermanAirlinesVa\Fleet\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableCreateGermanAirlinesVaFleetDeferredBindings extends Migration
{
public function up()
{
Schema::connection('germanairlinesva_fleet')->create('deferred_bindings', function ($table) {
$table->engine = 'InnoDB';
$table->increments('id')->unsigned();
$table->string('master_type');
$table->string('master_field');
$table->string('slave_type');
$table->integer('slave_id');
$table->mediumText('pivot_data')->nullable();
$table->string('session_key');
$table->boolean('is_bind')->default(true);
$table->timestamps();
});
}
public function down()
{
Schema::connection('germanairlinesva_fleet')->disableForeignKeyConstraints();
Schema::connection('germanairlinesva_fleet')->dropIfExists('deferred_bindings');
Schema::connection('germanairlinesva_fleet')->enableForeignKeyConstraints();
}
}
+2
View File
@@ -1,5 +1,7 @@
1.0.1:
- 'Initialize plugin.'
- 'Create table deferred_bindings'
- builder_table_create_deferred_bindings.php
1.0.2:
- 'Created table aircraft_manufacturers'
- builder_table_create_aircraft_manufacturers.php
+10 -11
View File
@@ -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@https://github.com/glayzzle/php-parser#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 "https://github.com/glayzzle/php-parser#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==
version "2.3.2"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.3.2.tgz#ef280a05ec253712e486233db5c6f23441e7342d"
integrity sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ==