SimBrief integration #405 (#635)

* SimBrief integration #405

* Add briefing as API response; add acars_xml field #405
This commit is contained in:
Nabeel S
2020-03-23 09:31:35 -04:00
committed by GitHub
parent 04b9e37e1d
commit 9e5386264f
70 changed files with 6816 additions and 192 deletions

View File

@@ -0,0 +1,21 @@
<?php
/** @var \Illuminate\Database\Eloquent\Factory $factory */
use Carbon\Carbon;
use Faker\Generator as Faker;
$factory->define(App\Models\SimBrief::class, function (Faker $faker) {
return [
'id' => $faker->unique()->numberBetween(10, 10000000),
'user_id' => null,
'flight_id' => null,
'pirep_id' => null,
'acars_xml' => '',
'ofp_xml' => '',
'created_at' => Carbon::now('UTC')->toDateTimeString(),
'updated_at' => function (array $sb) {
return $sb['created_at'];
},
];
});

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Add a table to store the Simbrief data
*/
class AddSimbriefTable extends Migration
{
public function up()
{
Schema::create('simbrief', function (Blueprint $table) {
$table->string('id', 36); // The OFP ID
$table->unsignedInteger('user_id');
$table->string('flight_id', 36)->nullable();
$table->string('pirep_id', 36)->nullable();
$table->mediumText('acars_xml');
$table->mediumText('ofp_xml');
$table->timestamps();
$table->primary('id');
$table->index(['user_id', 'flight_id']);
$table->index('pirep_id');
$table->unique('pirep_id'); // Can only belong to a single PIREP
});
}
public function down()
{
Schema::drop('simbrief');
}
}

1
app/Database/seeds/dev/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
local.yml

View File

@@ -152,6 +152,20 @@
options: ''
type: number
description: 'How much the load factor can vary per-flight'
- key: simbrief.api_key
name: 'SimBrief API Key'
group: simbrief
value: ''
options: ''
type: string
description: 'Your SimBrief API key'
- key: simbrief.expire_days
name: 'SimBrief Expire Time'
group: simbrief
value: 5
options: ''
type: number
description: 'Days after how long to remove unused briefs'
- key: pireps.duplicate_check_time
name: 'PIREP duplicate time check'
group: pireps