Skip to content

feat(minigames): add draw lots and scratch-off minigame types - #1085

Merged
sung17 merged 1 commit into
mainfrom
feat/draw-lots-scratch-off-minigames
Sep 3, 2026
Merged

feat(minigames): add draw lots and scratch-off minigame types#1085
sung17 merged 1 commit into
mainfrom
feat/draw-lots-scratch-off-minigames

Conversation

@sung17

@sung17 sung17 commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Draw Lots and Scratch Off join Jackpot/Lucky Wheel/Gashapon as playable minigame types, with their own preview art, play screens, and default assets.
  • Minigame plays/participants/winners are now tracked (Minigame.playsCount/participantsCount/winnersCount) and shown as sortable columns in the minigames list.
  • The minigame history table can jump to a player's originating conversation, resolved via the new MinigameContact.contactInboxId column instead of guessing by channel.
  • contactInboxService.listByContactId/findRecentByContactId are now scoped by workspaceId (cache key + query) to remove cross-workspace ambiguity now that more call sites depend on the result.

Changes

  • apps/builder/src/features/minigames/**: new Draw Lots / Scratch Off config, preview, and play-screen components; registries updated; minigames list adds plays/participants/winners columns; history table adds "jump to conversation" action.
  • packages/minigame-ui: new draw-lots-art and scratch-off-art components.
  • packages/database: Minigame gains counter columns; MinigameContact gains contactInboxId (FK to ContactInbox); new migrations 20260903155650_add-contact-inbox-id-to-minigame-contact and a regenerated 20260903024507_error_log_indexes.
  • packages/business: minigameContactService.recordPlay/resolvePlayState track contactInboxId and update counters; new resolveOpenerPlayState wraps opener tracking in a transaction; contactInboxService and conversationService.findDMByContactInbox support workspace-scoped, inbox-aware conversation lookup.
  • apps/worker, packages/variables, apps/builder/src/features/messages: updated call sites for the new workspaceId-scoped contactInboxService methods.
  • All 20 apps/builder/messages/*.json locale files updated with new translation keys.

Test plan

  • pnpm lint
  • pnpm --filter builder check-types
  • Manually create a Draw Lots and a Scratch Off minigame, verify preview + play flow end to end
  • Verify minigames list shows plays/participants/winners counts
  • From minigame history, click a player and confirm it opens/jumps to their conversation

Draw Lots and Scratch Off join Jackpot/Lucky Wheel/Gashapon as playable
minigame types (config, preview art, play screens, default assets).

Supporting changes:
- Track playsCount/participantsCount/winnersCount on Minigame and surface
  them as sortable columns in the minigames list.
- Record the ContactInbox a play came from (MinigameContact.contactInboxId)
  so the history table can jump straight to the originating conversation
  instead of guessing by channel; resolveOpenerPlayState wraps the
  opener-tracking insert and participantsCount increment in one transaction.
- Scope contactInboxService.listByContactId/findRecentByContactId by
  workspaceId (cache key and query) to avoid cross-workspace ambiguity now
  that more call sites depend on the result being workspace-correct.
@github-actions github-actions Bot added the feature New feature or request label Sep 3, 2026
@sung17
sung17 merged commit c68beeb into main Sep 3, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant