Skip to content

refactor: extract LoadsJsonRows trait and improve import commands#383

Merged
zigzagdev merged 1 commit intochore/clean-up-commmandsfrom
chore/command-refactor
Mar 28, 2026
Merged

refactor: extract LoadsJsonRows trait and improve import commands#383
zigzagdev merged 1 commit intochore/clean-up-commmandsfrom
chore/command-refactor

Conversation

@zigzagdev
Copy link
Copy Markdown
Owner

No description provided.

@zigzagdev zigzagdev requested a review from Copilot March 28, 2026 07:41
@zigzagdev zigzagdev self-assigned this Mar 28, 2026
@zigzagdev zigzagdev linked an issue Mar 28, 2026 that may be closed by this pull request
Copy link
Copy Markdown
Owner Author

@zigzagdev zigzagdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

@zigzagdev zigzagdev merged commit bf4635e into chore/clean-up-commmands Mar 28, 2026
27 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors repeated JSON-loading / path-resolution logic into a shared LoadsJsonRows console concern and cleans up several import commands (including batching DB updates for Japanese names).

Changes:

  • Extracted shared loadRows() and resolvePath() logic into App\Console\Concerns\LoadsJsonRows and adopted it across multiple import commands.
  • Simplified/normalized mapping + batching logic in import commands (including removing inline debug code).
  • Optimized Japanese name imports by performing chunk updates with a single UPDATE ... CASE ... statement per chunk instead of per-row updates.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/app/Console/Concerns/LoadsJsonRows.php Centralizes JSON row loading and local-disk path normalization for console imports.
src/app/Console/Commands/ImportWorldHeritageSiteImagesFromJson.php Switches to shared JSON/path helpers; minor mapping cleanup.
src/app/Console/Commands/ImportWorldHeritageSiteFromSplitFile.php Switches to shared JSON/path helpers; minor batching/typing cleanup.
src/app/Console/Commands/ImportWorldHeritageSiteCountryExceptionsFromSplitFile.php Switches to shared JSON/path helpers; streamlines strict FK check.
src/app/Console/Commands/ImportWorldHeritageJapaneseNameFromJson.php Reworks updates into chunked single-statement updates to reduce query count.
src/app/Console/Commands/ImportCountriesFromSplitFile.php Switches to shared JSON/path helpers; simplifies defaults + upsert call.
src/app/Console/Commands/DumpUnescoWorldHeritageJson.php Removes an unused criteria-parsing helper method.
src/app/Console/Commands/AlgoliaImportWorldHeritages.php Removes leftover debugging dd() block.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@zigzagdev zigzagdev deleted the chore/command-refactor branch March 28, 2026 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Command Refactor

2 participants