feat(entry): refine variant selection logic to exclude replaced variants and add unit tests for replacement behavior

This commit is contained in:
2026-09-16 09:34:02 -03:00
parent 8ad9b3a4e3
commit 3d6548ce4a
4 changed files with 108 additions and 1 deletions

View File

@@ -12,7 +12,7 @@ class EntryResource extends JsonResource
/** @return array<string, mixed> */
public function toArray(Request $request): array
{
$variant = $this->variants->sole();
$variant = $this->variants->whereNull('replaced_by_variant_id')->sole();
return [
'id' => $this->id,