feat(food): add endpoint to update historical stock and separate current and historical food variants

This commit is contained in:
2026-09-15 15:03:41 -03:00
parent 9fa4da7de2
commit ff43ba32f3
9 changed files with 426 additions and 27 deletions

View File

@@ -122,7 +122,11 @@ class EventDate extends Model
public function endsAt(): CarbonInterface
{
return Carbon::parse($this->date->format('Y-m-d').' '.$this->time_end);
$endsAt = Carbon::parse($this->date->format('Y-m-d').' '.$this->time_end);
return $endsAt->lessThanOrEqualTo($this->startsAt())
? $endsAt->addDay()
: $endsAt;
}
public function getStatusAttribute(): EventDateStatus
@@ -169,10 +173,6 @@ class EventDate extends Model
$startsAt = $this->startsAt();
$expiresAt = $this->endsAt();
if ($expiresAt->lessThanOrEqualTo($startsAt)) {
$expiresAt = $expiresAt->addDay();
}
$attributes = [
'type' => ValidityTimeType::FixedWindow,
'start_time' => null,