From 957638d4ac03f86a1c52a0a989c7336833e231ab Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Fri, 31 May 2024 15:14:22 -0400 Subject: [PATCH 1/2] Fill previously existing egg --- app/Services/Eggs/Sharing/EggImporterService.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/Services/Eggs/Sharing/EggImporterService.php b/app/Services/Eggs/Sharing/EggImporterService.php index 0a949474f..7ed7f010a 100644 --- a/app/Services/Eggs/Sharing/EggImporterService.php +++ b/app/Services/Eggs/Sharing/EggImporterService.php @@ -26,8 +26,11 @@ class EggImporterService $parsed = $this->parser->handle($file); return $this->connection->transaction(function () use ($parsed) { - $egg = (new Egg())->forceFill([ - 'uuid' => Uuid::uuid4()->toString(), + $uuid = $parsed['uuid'] ?? Uuid::uuid4()->toString(); + $egg = Egg::where('uuid', $uuid)->first() ?? new Egg(); + + $egg = $egg->forceFill([ + 'uuid' => $uuid, 'author' => Arr::get($parsed, 'author'), 'copy_script_from' => null, ]); From cfe385f53a0442a8fd2ef4105e9fd6519315b4bd Mon Sep 17 00:00:00 2001 From: notCharles Date: Fri, 31 May 2024 16:01:15 -0400 Subject: [PATCH 2/2] Add uuid to egg exproter Add UUID to egg exporter. --- app/Services/Eggs/Sharing/EggExporterService.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Services/Eggs/Sharing/EggExporterService.php b/app/Services/Eggs/Sharing/EggExporterService.php index e3a561db2..19c9a5e12 100644 --- a/app/Services/Eggs/Sharing/EggExporterService.php +++ b/app/Services/Eggs/Sharing/EggExporterService.php @@ -25,6 +25,7 @@ class EggExporterService 'exported_at' => Carbon::now()->toAtomString(), 'name' => $egg->name, 'author' => $egg->author, + 'uuid' => $egg->uuid, 'description' => $egg->description, 'features' => $egg->features, 'docker_images' => $egg->docker_images,