fix(deals): end hot deals when the venue closes - #72
Merged
Merged
Conversation
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
force-pushed
the
fix/deal-over-after-closing
branch
from
September 27, 2026 21:03
dc865fc to
cd15bef
Compare
savikthk
enabled auto-merge (squash)
September 27, 2026 21:03
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
dealOverAtin 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 answersdeal_not_active("Предложение уже закончилось") instead ofvenue_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:dealStatustakes the venue hours,dealViewsloads venues,updatetreats a deal over by closing as finished.backend/src/services/bookings.ts: the deal is checked before the venue hours,dealRunningusesdealOverAt.backend/src/services/recommendations.ts,backend/test/venue-bot.ts: newdealStatussignature.backend/src/http/schemas/deals.ts,backend/src/http/routes/bookings.ts,openapi.yaml,docs/scenario.md(E9): descriptions.Testing
npm run lint,npm run typecheckandnpm testpass locally (backend and frontend),npm run buildpasses.endedin the finished list, booking it answered409 deal_not_active; the round the clock «Пенка» still showed its deal.needs an available item on the menu of an open venuethevenue_closedcheck now uses a regular booking without a deal;dealStatusunit tests pass the venue hours.mainafter [B16] Горящее предложение можно выставить за пределами часов работы заведения #68 is merged.