Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
coverage: xdebug #optional
- uses: getong/mariadb-action@v1.1
with:
host port: 3308 # Optional, default value is 3306. The port of host
host port: 3306 # Optional, default value is 3306. The port of host
#container port: 3307 # Optional, default value is 3306. The port of container
#character set server: 'utf8' # Optional, default value is 'utf8mb4'. The '--character-set-server' option for mysqld
#collation server: 'utf8_general_ci' # Optional, default value is 'utf8mb4_general_ci'. The '--collation-server' option for mysqld
Expand Down
4 changes: 2 additions & 2 deletions database/factories/AssetFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ class AssetFactory extends Factory
public function definition()
{
return [
'assetable_id' => $this->faker->numberBetween(), //factory(CharacterInfo::class),
'assetable_type' => CharacterInfo::class, //$this->faker->randomElement([CharacterInfo::class, CorporationInfo::class]),
'assetable_id' => $this->faker->numberBetween(), // factory(CharacterInfo::class),
'assetable_type' => CharacterInfo::class, // $this->faker->randomElement([CharacterInfo::class, CorporationInfo::class]),
'item_id' => $this->faker->unique()->randomNumber(),
'is_blueprint_copy' => false,
'is_singleton' => $this->faker->boolean,
Expand Down
2 changes: 1 addition & 1 deletion database/factories/CharacterInfoFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function definition()
return [
'character_id' => $this->faker->unique()->numberBetween(9000000, 98000000),
'name' => $this->faker->name,
//'corporation_id' => $this->faker->numberBetween(98000000, 99000000),
// 'corporation_id' => $this->faker->numberBetween(98000000, 99000000),
'birthday' => $this->faker->iso8601('now'),
'gender' => $this->faker->randomElement(['male', 'female']),
'race_id' => $this->faker->randomDigitNotNull,
Expand Down
2 changes: 1 addition & 1 deletion database/factories/ContractFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function definition()
'status' => $this->faker->randomElement(['outstanding', 'in_progress', 'finished_issuer', 'finished_contractor', 'finished', 'cancelled', 'rejected', 'failed', 'deleted', 'reversed']),
'type' => $this->faker->randomElement(['unknown', 'item_exchange', 'auction', 'courier', 'loan']),

//optionals
// optionals
'buyout' => $this->faker->randomFloat(),
'collateral' => $this->faker->randomFloat(),
'date_accepted' => carbon()->addHour(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@
public function up()
{
Schema::create('corporation_infos', function (Blueprint $table) {
$table->bigIncrements('corporation_id'); //req
$table->string('ticker'); //req
$table->string('name'); //req
$table->bigInteger('member_count'); //req
$table->bigInteger('ceo_id'); //req
$table->bigInteger('creator_id'); //req
$table->float('tax_rate', 10, 2); //req
$table->bigIncrements('corporation_id'); // req
$table->string('ticker'); // req
$table->string('name'); // req
$table->bigInteger('member_count'); // req
$table->bigInteger('ceo_id'); // req
$table->bigInteger('creator_id'); // req
$table->float('tax_rate', 10, 2); // req

$table->bigInteger('alliance_id')->nullable();
$table->dateTime('date_founded')->nullable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<env name="REDIS_PASSWORD" value="null"/>
<env name="REDIS_PORT" value="6379"/>
<env name="DB_HOST" value="127.0.0.1"/>
<env name="DB_PORT" value="3308"/>
<env name="DB_PORT" value="3306"/>
<env name="DB_DATABASE" value="testbench"/>
<env name="DB_USERNAME" value="default"/>
<env name="DB_PASSWORD" value="secret"/>
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/CheckJobsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function handle(): int
->each(function (array $job) {
// check if any assertion failed
if ($job['status'] === 'error') {
//$this->writeAssertionOutput(get_class($job), 'px-2', '<span class="px-2 bg-red text-gray-400 uppercase">error</span>');
// $this->writeAssertionOutput(get_class($job), 'px-2', '<span class="px-2 bg-red text-gray-400 uppercase">error</span>');
$this->writeAssertionHeader($job['class'], 'px-2 bg-red text-gray-400 uppercase', 'error');
} elseif ($job['status'] === 'warning') {
$this->writeAssertionHeader($job['class'], 'px-2 bg-yellow text-gray-400 uppercase', 'warning');
Expand Down
10 changes: 5 additions & 5 deletions src/EveapiServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class EveapiServiceProvider extends ServiceProvider

public function boot(): void
{
//Add Migrations
// Add Migrations
$this->loadMigrationsFrom(__DIR__.'/../database/migrations/');

// Configure the queue dashboard
Expand Down Expand Up @@ -149,7 +149,7 @@ public function configureHorizon(): void
'processes' => (int) env(self::QUEUE_BALANCING_WORKERS, 4),
'block_for' => 5,
'timeout' => 120, // 2 minutes
'nice' => 10, //Allowed values are between 0 and 19
'nice' => 10, // Allowed values are between 0 and 19
'maxTime' => 3600,
'maxJobs' => 1000,
],
Expand All @@ -162,7 +162,7 @@ public function configureHorizon(): void
'minProcesses' => 1,
'maxProcesses' => (int) env(self::QUEUE_BALANCING_WORKERS, 4),
'tries' => 1,
'nice' => 10, //Allowed values are between 0 and 19
'nice' => 10, // Allowed values are between 0 and 19
'timeout' => 900, // 15 minutes
'maxTime' => 3600,
'maxJobs' => 1000,
Expand Down Expand Up @@ -204,7 +204,7 @@ private function addEventListeners(): void
Type::observe(TypeObserver::class);
Group::observe(GroupObserver::class);

//Character Observers
// Character Observers
CharacterInfo::observe(CharacterInfoObserver::class);
}

Expand Down Expand Up @@ -237,7 +237,7 @@ private function addSchedules(): void
});

// Run Character Affiliation Job every five minutes to updated outdated affiliations.
//$schedule->job(new CharacterAffiliationJob)->everyFiveMinutes();
// $schedule->job(new CharacterAffiliationJob)->everyFiveMinutes();
$schedule->call(new RefreshCharacterAffiliationsService)->everyFiveMinutes();

// Cleanup Batches Table
Expand Down
2 changes: 1 addition & 1 deletion src/Jobs/Contracts/CharacterContractsJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function executeJob(): void
'status' => $contract->status,
'type' => $contract->type,

//optionals
// optionals
'buyout' => optional($contract)->buyout,
'collateral' => optional($contract)->collateral,
'date_accepted' => optional($contract)->date_accepted ? carbon(optional($contract)->date_accepted) : null,
Expand Down
2 changes: 1 addition & 1 deletion src/Jobs/Contracts/ContractItemsJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function executeJob(): void
$contract_items = collect($response)->map(fn (object $item) => [
// primary
'record_id' => $item->record_id,
//others
// others
'contract_id' => $this->contract_id,
'is_included' => $item->is_included,
'is_singleton' => $item->is_singleton,
Expand Down
29 changes: 29 additions & 0 deletions src/Jobs/Hydrate/Maintenance/GetMissingCharacterInfos.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace Seatplus\Eveapi\Jobs\Hydrate\Maintenance;

use Seatplus\Eveapi\Jobs\Character\CharacterInfoJob;
use Seatplus\Eveapi\Models\RefreshToken;

class GetMissingCharacterInfos extends HydrateMaintenanceBase
{
public function handle(): void
{
if ($this->batch()->cancelled()) {
// Determine if the batch has been cancelled...

return;
}

$jobs = RefreshToken::query()
->whereDoesntHave('character')
->pluck('character_id')
->unique()
->values()
->map(fn (int $character_id) => new CharacterInfoJob($character_id));

$this->batch()->add(
$jobs->toArray()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function handle(): void

$type_ids = Asset::doesntHave('type')->pluck('type_id')->unique()->values();

//$type_ids->each(fn ($id) => ResolveUniverseTypeByIdJob::dispatch($id)->onQueue('low'));
// $type_ids->each(fn ($id) => ResolveUniverseTypeByIdJob::dispatch($id)->onQueue('low'));
$jobs = $type_ids->map(fn (int $id) => new ResolveUniverseTypeByIdJob($id));

$this->batch()->add(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ function (Builder $query) {
$query->whereDoesntHave('type')->addSelect('type_id');
}
)->with('locatable')->get()->map(function (Location $location) {
return $location->locatable->type_id;

/** @var Structure|Station $locatable */
$locatable = $location->locatable;

return $locatable->type_id;
})->unique()->values();

$jobs = $type_ids->map(fn (int $id) => new ResolveUniverseTypeByIdJob($id));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function handle(): void

$type_ids = SkillQueue::doesntHave('type')->pluck('skill_id')->unique()->values();

//$type_ids->each(fn ($id) => ResolveUniverseTypeByIdJob::dispatch($id)->onQueue('low'));
// $type_ids->each(fn ($id) => ResolveUniverseTypeByIdJob::dispatch($id)->onQueue('low'));
$jobs = $type_ids->map(fn (int $id) => new ResolveUniverseTypeByIdJob($id));

$this->batch()->add(
Expand Down
2 changes: 2 additions & 0 deletions src/Jobs/Seatplus/MaintenanceJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
use Seatplus\Eveapi\Jobs\Assets\EnrichAssetTypeGroupCategoryJob;
use Seatplus\Eveapi\Jobs\Hydrate\Maintenance\GetMissingBodysFromMails;
use Seatplus\Eveapi\Jobs\Hydrate\Maintenance\GetMissingCategorys;
use Seatplus\Eveapi\Jobs\Hydrate\Maintenance\GetMissingCharacterInfos;
use Seatplus\Eveapi\Jobs\Hydrate\Maintenance\GetMissingCharacterInfosFromCorporationMemberTracking;
use Seatplus\Eveapi\Jobs\Hydrate\Maintenance\GetMissingConstellations;
use Seatplus\Eveapi\Jobs\Hydrate\Maintenance\GetMissingGroups;
Expand Down Expand Up @@ -84,6 +85,7 @@ private function dispatchBatch(): Batch
{
return Bus::batch([

new GetMissingCharacterInfos,
new GetMissingGroups,
new GetMissingCategorys,
new EnrichAssetTypeGroupCategoryJob,
Expand Down
2 changes: 1 addition & 1 deletion src/Jobs/Seatplus/UpdateCorporation.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class UpdateCorporation implements ShouldQueue
public function __construct(
public ?int $corporation_id = null,
) {
$this->findCorporationRefreshToken = new FindCorporationRefreshToken();
$this->findCorporationRefreshToken = new FindCorporationRefreshToken;
}

public function middleware(): array
Expand Down
2 changes: 1 addition & 1 deletion src/Models/Assets/Asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function content(): HasMany

public function location(): HasOne
{
//Todo create morphTo relation
// Todo create morphTo relation
return $this->hasOne(Location::class, 'location_id', 'location_id');
}

Expand Down
11 changes: 8 additions & 3 deletions src/Models/Contacts/ContactLabel.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Seatplus\Eveapi\Models\Alliance\AllianceInfo;
use Seatplus\Eveapi\Models\Character\CharacterInfo;
use Seatplus\Eveapi\Models\Corporation\CorporationInfo;

class ContactLabel extends Model
{
Expand All @@ -44,9 +47,11 @@ public function contact(): BelongsTo

public function getLabelNameAttribute(): ?string
{
return $this->contact
->contactable
->labels

/** @var CharacterInfo|CorporationInfo|AllianceInfo $contactable */
$contactable = $this->contact->contactable;

return $contactable->labels
->firstWhere('label_id', $this->label_id)
?->label_name;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Services/Esi/UpdateRefreshTokenService.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class UpdateRefreshTokenService

public static function make(): self
{
return new self();
return new self;
}

public function update(RefreshToken $refreshToken): RefreshToken
Expand Down
2 changes: 1 addition & 1 deletion src/Services/Jobs/CacheCharacterAffiliationIdsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class CacheCharacterAffiliationIdsService
{
public static function make(): self
{
return new self();
return new self;
}

final public function queue(int|array $character_ids): void
Expand Down
4 changes: 2 additions & 2 deletions src/Services/Jobs/GetLocationFlagNameService.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __construct() {}

public static function make(): self
{
return new self();
return new self;
}

public function get(int $flag_id): string
Expand All @@ -47,7 +47,7 @@ public function get(int $flag_id): string
'ship_hangar' => range(90, 90),
'fighter_tubes' => range(159, 163),
'dronebay' => [
...range(158, 158), //FighterBay
...range(158, 158), // FighterBay
...range(87, 87), // DroneBay
],
'specialized' => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function handle(int $location_id, Collection $tracings): ?RefreshToken
->where('assetable_type', CharacterInfo::class)
->inRandomOrder()
->get()
->map(fn (Asset $asset) => $asset->assetable->refresh_token)
->map(fn (Asset $asset) => data_get($asset, 'assetable.refresh_token'))
->unique()
// filter refresh token that has scope esi-universe.read_structures.v1
->filter(fn (RefreshToken $refresh_token) => $refresh_token->hasScope('esi-universe.read_structures.v1'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function handle(int $location_id, Collection $tracings): ?RefreshToken
->where('wallet_transactionable_type', CharacterInfo::class)
->inRandomOrder()
->get()
->map(fn (WalletTransaction $wallet_transaction) => $wallet_transaction->wallet_transactionable->refresh_token)
->map(fn (WalletTransaction $wallet_transaction) => data_get($wallet_transaction, 'wallet_transactionable.refresh_token'))
->unique()
// filter refresh token that has scope esi-universe.read_structures.v1
->filter(fn (RefreshToken $refresh_token) => $refresh_token->hasScope('esi-universe.read_structures.v1'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function __construct(StructureRefreshTokenFinder|RefreshToken|null $args

// if args is RefreshToken or null, set it as refreshToken
if ($args instanceof RefreshToken) {
//set it as refreshToken
// set it as refreshToken
$this->refreshToken = $args;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Traits/HasRequiredScopes.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function getRefreshToken(): RefreshToken

$refresh_token = $refresh_tokens->first();

//check if the refresh token has the required scope
// check if the refresh token has the required scope
throw_unless($refresh_token->hasScope($this->getRequiredScope()), new Exception('refresh token does not have the required scope'));

return $refresh_token;
Expand Down
4 changes: 2 additions & 2 deletions tests/Integration/CharacterWalletJournalLifecycleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

$job->handle();

//assertWalletJournal($mock_data, $this->test_character->character_id);
// assertWalletJournal($mock_data, $this->test_character->character_id);
foreach ($mock_data as $data) {
//Assert that character asset created
// Assert that character asset created
$this->assertDatabaseHas('wallet_journals', [
'wallet_journable_id' => $this->test_character->character_id,
'id' => $data->id,
Expand Down
12 changes: 6 additions & 6 deletions tests/Integration/ContactLabelJobTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@

dispatch_sync($job);

//assertContactLabel($mock_data, $this->test_character->character_id);
// assertContactLabel($mock_data, $this->test_character->character_id);
foreach ($mock_data as $data) {
//Assert that character asset created
// Assert that character asset created
$this->assertDatabaseHas('labels', [
'labelable_id' => (string) $this->test_character->character_id,
'label_id' => $data->label_id,
Expand All @@ -40,9 +40,9 @@

(new CorporationContactLabelJob(testCharacter()->corporation->corporation_id, testCharacter()->character_id))->handle();

//assertContactLabel($mock_data, $this->test_character->corporation->corporation_id);
// assertContactLabel($mock_data, $this->test_character->corporation->corporation_id);
foreach ($mock_data as $data) {
//Assert that character asset created
// Assert that character asset created
$this->assertDatabaseHas('labels', [
'labelable_id' => (string) $this->test_character->corporation->corporation_id,
'label_id' => $data->label_id,
Expand All @@ -57,9 +57,9 @@

(new AllianceContactLabelJob(testCharacter()->corporation->alliance_id, testCharacter()->character_id))->handle();

//assertContactLabel($mock_data, $this->test_character->corporation->alliance_id);
// assertContactLabel($mock_data, $this->test_character->corporation->alliance_id);
foreach ($mock_data as $data) {
//Assert that character asset created
// Assert that character asset created
$this->assertDatabaseHas('labels', [
'labelable_id' => (string) $this->test_character->corporation->alliance_id,
'label_id' => $data->label_id,
Expand Down
Loading