Adjust columns in migrations and give lens to strings and custom flight fields #48

This commit is contained in:
Nabeel Shahzad 2017-07-10 18:54:51 -05:00
parent 6f745091de
commit b5dd700044
14 changed files with 73 additions and 32 deletions

2
.gitignore vendored
View File

@ -44,3 +44,5 @@ phpvms_next.iml
.idea/**/gradle.xml
.idea/**/libraries
public/info.php
local.conf.php

View File

@ -30,6 +30,7 @@ class Pirep extends Model
'route_leg',
'dpt_airport_id',
'arr_airport_id',
'fuel_used',
'source',
'level',
'route',
@ -47,6 +48,7 @@ class Pirep extends Model
= [
'flight_time' => 'integer',
'level' => 'integer',
'fuel_used' => 'integer',
'source' => 'integer',
'status' => 'integer',
];

View File

@ -152,4 +152,13 @@ class PIREPService extends BaseService
return $pirep;
}
/**
* Calculate all of the finances for a PIREP
* @param Pirep $pirep
*/
public function calculateFinances(Pirep &$pirep)
{
}
}

View File

@ -11,9 +11,18 @@
return [
/**
* Start date. Set the date of when your VA has started
* Used as an anchor point for some financials and things
*
* YYYY-MM-DD format
*/
'start_date' => '2017-07-07',
/**
* Pick one of:
* dollar, euro, gbp, yen, jpy, rupee, ruble
* dollar, euro, gbp, yen, jpy, rupee, ruble
*/
'currency' => 'dollar',
];

View File

@ -15,9 +15,9 @@ class CreateAirlinesTable extends Migration
{
Schema::create('airlines', function (Blueprint $table) {
$table->increments('id');
$table->string('code');
$table->string('name');
$table->char('country', 2)->nullable();
$table->string('code', 5);
$table->string('name', 50);
$table->string('country', 2)->nullable();
$table->boolean('active');
$table->timestamps();

View File

@ -11,10 +11,10 @@ class CreateAircraftsTable extends Migration
$table->increments('id');
$table->integer('subfleet_id')->unsigned();
$table->integer('airport_id')->unsigned()->nullable();
$table->string('hex_code')->nullable();
$table->string('name');
$table->string('registration')->nullable();
$table->string('tail_number')->nullable();
$table->string('hex_code', 10)->nullable();
$table->string('name', 50);
$table->string('registration', 10)->nullable();
$table->string('tail_number', 10)->nullable();
$table->boolean('active')->default(true);
$table->timestamps();

View File

@ -15,14 +15,16 @@ class CreateFaresTable extends Migration
{
Schema::create('fares', function (Blueprint $table) {
$table->increments('id');
$table->string('code');
$table->string('name');
$table->string('code', 50);
$table->string('name', 50);
$table->decimal('price', 19, 2)->default(0.0);
$table->decimal('cost', 19, 2)->default(0.0);
$table->integer('capacity')->default(0)->unsigned();
$table->string('notes')->nullable();
$table->boolean('active')->default(true);
$table->timestamps();
$table->primary('id');
});
}

View File

@ -16,9 +16,9 @@ class CreateAirportsTable extends Migration
Schema::create('airports', function (Blueprint $table) {
$table->increments('id');
$table->string('icao', 5)->unique();
$table->string('name');
$table->string('location')->nullable();
$table->string('country')->nullable();
$table->string('name', 50);
$table->string('location', 50)->nullable();
$table->string('country', 50)->nullable();
$table->double('fuel_100ll_cost', 19, 2)->default(0);
$table->double('fuel_jeta_cost', 19, 2)->default(0);
$table->double('fuel_mogas_cost', 19, 2)->default(0);

View File

@ -16,15 +16,16 @@ class CreateFlightsTable extends Migration
Schema::create('flights', function (Blueprint $table) {
$table->uuid('id');
$table->integer('airline_id')->unsigned();
$table->text('flight_number');
$table->text('route_code')->nullable();
$table->text('route_leg')->nullable();
$table->string('flight_number', 10);
$table->string('route_code', 5)->nullable();
$table->string('route_leg', 5)->nullable();
$table->integer('dpt_airport_id')->unsigned();
$table->integer('arr_airport_id')->unsigned();
$table->integer('alt_airport_id')->unsigned()->nullable();
$table->text('route')->nullable();
$table->text('dpt_time')->nullable();
$table->text('arr_time')->nullable();
$table->text('dpt_time', 10)->nullable();
$table->text('arr_time', 10)->nullable();
$table->double('flight_time', 19, 2)->unsigned();
$table->text('notes')->nullable();
$table->boolean('active')->default(true);
$table->timestamps();
@ -37,6 +38,13 @@ class CreateFlightsTable extends Migration
$table->index('dpt_airport_id');
$table->index('arr_airport_id');
});
Schema::create('flight_fields', function (Blueprint $table) {
$table->increments('id');
$table->uuid('flight_id');
$table->string('name', 50);
$table->text('value');
});
}
/**

View File

@ -15,7 +15,7 @@ class CreateRanksTable extends Migration
{
Schema::create('ranks', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('name', 50);
$table->integer('hours')->default(0);
$table->boolean('auto_approve_acars')->default(false);
$table->boolean('auto_approve_manual')->default(false);

View File

@ -16,19 +16,18 @@ class CreateSubfleetsTable extends Migration
Schema::create('subfleets', function (Blueprint $table) {
$table->increments('id');
$table->integer('airline_id')->unsigned()->nullable();
$table->string('name');
$table->text('type');
$table->string('name', 50);
$table->string('type', 7);
$table->tinyInteger('fuel_type')->unsigned()->nullable();
$table->double('cargo_capacity', 19, 2)->nullable();
$table->double('fuel_capacity', 19, 2)->nullable();
$table->double('gross_weight', 19, 2)->nullable();
$table->timestamps();
$table->softDeletes();
});
Schema::create('subfleet_expenses', function(Blueprint $table) {
$table->integer('subfleet_id')->unsigned();
$table->string('name');
$table->string('name', 50);
$table->decimal('cost', 19, 2)->unsigned();
$table->primary(['subfleet_id', 'name']);

View File

@ -16,16 +16,15 @@ class CreatePirepsTable extends Migration
Schema::create('pireps', function (Blueprint $table) {
$table->uuid('id');
$table->integer('user_id');
$table->string('flight_id');
$table->uuid('flight_id')->nullable();
$table->integer('aircraft_id');
$table->text('route_code')->nullable();
$table->text('route_leg')->nullable();
$table->string('route_code', 5)->nullable();
$table->string('route_leg', 5)->nullable();
$table->integer('dpt_airport_id')->unsigned();
$table->integer('arr_airport_id')->unsigned();
$table->integer('flight_time')->unsigned();
$table->double('flight_time', 19, 2)->unsigned();
$table->double('gross_weight', 19, 2)->nullable();
$table->double('starting_fuel', 19, 2)->nullable();
$table->double('landing_fuel', 19, 2)->nullable();
$table->double('fuel_used', 19, 2)->nullable();
$table->integer('level')->unsigned();
$table->string('route')->nullable();
$table->string('notes')->nullable();
@ -68,7 +67,7 @@ class CreatePirepsTable extends Migration
*/
Schema::create('pirep_fields', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('name', 50);
$table->integer('required');
$table->timestamps();
});
@ -76,8 +75,8 @@ class CreatePirepsTable extends Migration
Schema::create('pirep_field_values', function (Blueprint $table) {
$table->increments('id');
$table->uuid('pirep_id');
$table->string('name');
$table->string('value');
$table->string('name', 50);
$table->text('value');
$table->tinyInteger('source')->default(0);
$table->timestamps();

View File

@ -22,6 +22,7 @@ class PIREPTest extends TestCase
'flight_time' => 21600, # 6 hours
'level' => 320,
'source' => 0, # manual
'fuel_used' => 100,
'notes' => 'just a pilot report',
];
@ -52,6 +53,9 @@ class PIREPTest extends TestCase
parent::setUp(); // TODO: Change the autogenerated stub
$this->addData('base');
$this->pirepSvc = app('App\Services\PIREPService');
$conf = config('phpvms');
print_r($conf);
}
/**
@ -121,4 +125,9 @@ class PIREPTest extends TestCase
$latest_pirep->status
);
}
public function testPirepFinances()
{
}
}

View File

@ -99,11 +99,13 @@ subfleets:
name: 747-400 Winglets
type: 744W
fuel_type: 1
fuel_capacity: 2000
- id: 2
airline_id: 1
name: 777-200 LR
type: 772-LR
fuel_type: 1
fuel_capacity: 1000
# add a few mods to aircraft and fares
subfleet_fare: