add PIREP pre-file and ACARS updates; removing caching from ACARS/Pirep/User repositories; adjust PirepState enum values; add additional columns

This commit is contained in:
Nabeel Shahzad
2017-12-25 15:19:34 -06:00
parent 70b1476e93
commit 3bd97b4d37
41 changed files with 688 additions and 192 deletions

View File

@@ -1,23 +1,19 @@
<?php
use App\Models\Enums\PirepSource;
use App\Models\Enums\PirepState;
use Faker\Generator as Faker;
# Match the list available in tests/data/*.yml
$airlinesAvailable = [1];
/**
* Create a new PIREP
*/
$factory->define(App\Models\Pirep::class, function (Faker $faker) use ($airlinesAvailable) {
$factory->define(App\Models\Pirep::class, function (Faker $faker) {
static $raw_data;
return [
'id' => substr($faker->unique()->sha1, 0, 12),
'airline_id' => 1, #$faker->randomElement($airlinesAvailable),
'airline_id' => function () { # OVERRIDE THIS IF NEEDED
return factory(App\Models\Airline::class)->create()->id;
},
'user_id' => function () { # OVERRIDE THIS IF NEEDED
return factory(App\Models\User::class)->create()->id;
},
@@ -39,11 +35,15 @@ $factory->define(App\Models\Pirep::class, function (Faker $faker) use ($airlines
'arr_airport_id' => function () {
return factory(App\Models\Airport::class)->create()->id;
},
'altitude' => $faker->numberBetween(20, 400),
'flight_time' => $faker->randomFloat(2),
'planned_flight_time' => $faker->randomFloat(2),
'gross_weight' => $faker->randomFloat(2),
'route' => $faker->text(200),
'notes' => $faker->text(200),
'source' => $faker->randomElement([PirepSource::MANUAL, PirepSource::ACARS]),
'state' => PirepState::PENDING, //$faker->randomElement([-1, 0, 1]), # REJECTED/PENDING/ACCEPTED
'state' => PirepState::PENDING,
'status' => PirepStatus::SCHEDULED,
'raw_data' => $raw_data ?: $raw_data = json_encode(['key' => 'value']),
'created_at' => $faker->dateTimeBetween('-1 week', 'now'),
'updated_at' => function(array $pirep) {