Skip to content

Commit

Permalink
#985 Fetch Aurora Webpages, small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
inikoo committed Oct 23, 2024
1 parent 7ea3875 commit 17a08c9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
12 changes: 5 additions & 7 deletions app/Actions/Transfers/Aurora/FetchAuroraWebpages.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ public function handle(SourceOrganisationService $organisationSource, int $organ
);
}
}
$this->recordChange($organisationSource, $webpage->wasChanged());
} catch (Exception $e) {

$this->recordError($organisationSource, $e, $webpageData['webpage'], 'Webpage', 'update');

return null;
Expand Down Expand Up @@ -124,19 +124,17 @@ public function handle(SourceOrganisationService $organisationSource, int $organ
Arr::except($webpageData['webpage'], ['migration_data', 'parent_id', 'fetched_at', 'last_fetched_at'])
);
$this->recordNew($organisationSource);
$sourceData = explode(':', $webpage->source_id);
DB::connection('aurora')->table('Page Store Dimension')
->where('Page Key', $sourceData[1])
->update(['aiku_id' => $webpage->id]);
} catch (Exception|Throwable $e) {
$this->recordError($organisationSource, $e, $webpageData['webpage'], 'Webpage', 'store');

return null;
}
}


$sourceData = explode(':', $webpage->source_id);
DB::connection('aurora')->table('Page Store Dimension')
->where('Page Key', $sourceData[1])
->update(['aiku_id' => $webpage->id]);

return $webpage;
}

Expand Down
6 changes: 3 additions & 3 deletions app/Actions/Web/Webpage/StoreWebpage.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use App\Actions\OrgAction;
use App\Actions\SysAdmin\Group\Hydrators\GroupHydrateWebpages;
use App\Actions\SysAdmin\Organisation\Hydrators\OrganisationHydrateWebpages;
use App\Actions\Traits\Rules\WithNoStrictRules;
use App\Actions\Web\Webpage\Hydrators\WebpageHydrateUniversalSearch;
use App\Actions\Web\Webpage\Hydrators\WebpageHydrateWebpages;
use App\Actions\Web\Website\Hydrators\WebsiteHydrateWebpages;
Expand All @@ -29,7 +30,7 @@
class StoreWebpage extends OrgAction
{
use AsAction;

use WithNoStrictRules;

private Website $website;

Expand Down Expand Up @@ -166,8 +167,7 @@ public function rules(): array
}

if (!$this->strict) {
$rules['source_id'] = ['sometimes', 'string'];
$rules['fetched_at'] = ['sometimes', 'date'];
$rules = $this->noStrictStoreRules($rules);
$rules['migration_data'] = ['sometimes', 'array'];
}

Expand Down
4 changes: 3 additions & 1 deletion app/Actions/Web/Webpage/UpdateWebpage.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use App\Actions\OrgAction;
use App\Actions\SysAdmin\Group\Hydrators\GroupHydrateWebpages;
use App\Actions\SysAdmin\Organisation\Hydrators\OrganisationHydrateWebpages;
use App\Actions\Traits\Rules\WithNoStrictRules;
use App\Actions\Traits\WithActionUpdate;
use App\Actions\Web\Webpage\Hydrators\WebpageHydrateUniversalSearch;
use App\Actions\Web\Webpage\Hydrators\WebpageHydrateWebpages;
Expand All @@ -28,6 +29,7 @@
class UpdateWebpage extends OrgAction
{
use WithActionUpdate;
use WithNoStrictRules;

private Webpage $webpage;

Expand Down Expand Up @@ -123,7 +125,7 @@ public function rules(): array
];

if (!$this->strict) {
$rules['last_fetched_at'] = ['sometimes', 'date'];
$rules = $this->noStrictUpdateRules($rules);
$rules['migration_data'] = ['sometimes', 'array'];

}
Expand Down

0 comments on commit 17a08c9

Please sign in to comment.