Enforce task limits and update event form
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled

This commit is contained in:
Codex Agent
2026-01-21 09:49:30 +01:00
parent 0b1430e64d
commit 1c5412e82c
15 changed files with 491 additions and 52 deletions

View File

@@ -97,13 +97,26 @@ class EventResource extends JsonResource
'watermark_allowed' => (bool) optional($eventPackage->package)->watermark_allowed,
] : null,
'limits' => $eventPackage && $limitEvaluator
? $limitEvaluator->summarizeEventPackage($eventPackage)
? $limitEvaluator->summarizeEventPackage($eventPackage, $this->resolveTasksUsed())
: null,
'addons' => $eventPackage ? $this->formatAddons($eventPackage) : [],
'member_permissions' => $memberPermissions,
];
}
protected function resolveTasksUsed(): ?int
{
if (isset($this->tasks_count)) {
return (int) $this->tasks_count;
}
if ($this->relationLoaded('tasks')) {
return $this->tasks->count();
}
return null;
}
/**
* @param array<string, mixed> $settings
* @return array<string, mixed>