Skip to content

fix(deals): end hot deals when the venue closes - #72

Merged
savikthk merged 1 commit into
mainfrom
fix/deal-over-after-closing
Sep 27, 2026
Merged

savikthk merged 1 commit into
mainfrom
fix/deal-over-after-closing

Conversation

@savikthk

Copy link
Copy Markdown
Collaborator

Closes #69

Summary

A hot deal is now over at its end time or at the first closing of the venue after its start, whichever comes first; a deal that started while the venue was closed is over at once; round the clock venues keep the end time. The rule is dealOverAt in TS and the same condition in the deals repository SQL, so the guest link ("Это предложение уже закончилось"), the /eat pick, venue cards and their counter, the cabinet list, status and counter, the one live deal per item rule and booking all agree. Deals already stored with an end after closing are covered by the condition, no data migration. Booking such a deal answers deal_not_active ("Предложение уже закончилось") instead of venue_closed.

Changes

  • backend/src/domain/deals.ts: dealOverAt.
  • backend/src/repositories/deals.ts: visibility, live, finished, live for item and cancel queries use the effective end.
  • backend/src/services/deals.ts: dealStatus takes the venue hours, dealViews loads venues, update treats a deal over by closing as finished.
  • backend/src/services/bookings.ts: the deal is checked before the venue hours, dealRunning uses dealOverAt.
  • backend/src/services/recommendations.ts, backend/test/venue-bot.ts: new dealStatus signature.
  • backend/src/http/schemas/deals.ts, backend/src/http/routes/bookings.ts, openapi.yaml, docs/scenario.md (E9): descriptions.

Testing

@savikthk savikthk added bug Something isn't working backend Сервер: API, сервисы, база данных bot Чат-бот MAX labels Sep 27, 2026
@savikthk savikthk self-assigned this Sep 27, 2026
A deal whose end time was later than the venue closing stayed visible
after closing: the guest link showed the card with "До 22:50", the old
"Забронировать" button answered that the venue is closed, and the
cabinet kept counting the deal as live.

A deal is now over at its end time or at the first closing after its
start, whichever comes first, and a deal that started while the venue
was closed is over right away. Round the clock venues keep the end
time. The rule lives in dealOverAt and in the same SQL condition of the
deals repository, so guest cards, the /eat pick, the venue list counter,
the cabinet list and status, the one live deal per item rule and
booking all agree. Deals already stored with an end after closing are
handled by this condition, no data migration.

Booking such a deal now answers deal_not_active ("Предложение уже
закончилось") instead of venue_closed.
@savikthk
savikthk force-pushed the fix/deal-over-after-closing branch from dc865fc to cd15bef Compare September 27, 2026 21:03
@savikthk
savikthk enabled auto-merge (squash) September 27, 2026 21:03
@savikthk
savikthk merged commit 0d95e31 into main Sep 27, 2026
5 checks passed
@savikthk
savikthk deleted the fix/deal-over-after-closing branch September 27, 2026 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Сервер: API, сервисы, база данных bot Чат-бот MAX bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[B17] После закрытия заведения горящее предложение показывается как активное

1 participant