Feature: Adding Product Reviews Importer and views

This commit is contained in:
2026-07-10 15:19:48 +03:00
parent 1d25e0d746
commit ed496716eb
10 changed files with 424 additions and 18 deletions
+18 -17
View File
@@ -8,43 +8,44 @@ use Modules\Core\MigrateImport\RunMigrateImportJob;
class MigrateImportCommand extends Command
{
protected $signature = "boboko:migrate:import
protected $signature = 'boboko:migrate:import
{--source= : The source platform to import from}
{--type= : The import mechanism for the chosen source}
{--file= : Path to the export file (when type is export)}";
{--file= : Path to the export file (when type is export)}';
protected $description = "Migrate data (products, customers, etc.) from an external source";
protected $description = 'Migrate data (products, customers, etc.) from an external source';
// Supported sources. Only "shopify" is wired up for now.
// Supported sources. Only "shopify" and "judgeme" are wired up for now.
private const SOURCES = [
"shopify",
'shopify',
'judgeme',
// "woocommerce",
];
// Supported import types per source. Only "export" is wired up for now.
private const TYPES = [
"export",
'export',
// "api",
];
public function handle(): void
{
$source = $this->option("source")
?? $this->choice("Select a source:", self::SOURCES, 0);
$source = $this->option('source')
?? $this->choice('Select a source:', self::SOURCES, 0);
$type = $this->option("type")
?? $this->choice("Select an import type:", self::TYPES, 0);
$type = $this->option('type')
?? $this->choice('Select an import type:', self::TYPES, 0);
if ($type === "api") {
if ($type === 'api') {
$credentials = [
"api_key" => $this->secret("API key:"),
"api_secret" => $this->secret("API secret:"),
'api_key' => $this->secret('API key:'),
'api_secret' => $this->secret('API secret:'),
];
$filePath = null;
} else {
$importsPath = storage_path("app/private/imports");
$importsPath = storage_path('app/private/imports');
$filePath = $this->option("file")
$filePath = $this->option('file')
?? $this->resolveImportPath($importsPath, $this->ask("Path to the export file, relative to {$importsPath}:"));
while (blank($filePath) || ! is_file($filePath)) {
@@ -70,7 +71,7 @@ class MigrateImportCommand extends Command
RunMigrateImportJob::dispatch($spec);
$this->info("Import queued.");
$this->info('Import queued.');
}
// Answers are relative to storage/app/private/imports (e.g. "shopify" or
@@ -82,7 +83,7 @@ class MigrateImportCommand extends Command
return $answer;
}
$path = str_starts_with($answer, "/") ? $answer : "{$importsPath}/{$answer}";
$path = str_starts_with($answer, '/') ? $answer : "{$importsPath}/{$answer}";
if (is_dir($path)) {
$csv = collect(glob("{$path}/*.csv"))->first();