Skip to content

feat(minigames): duplicate a minigame without its prizes - #1723

Open
sung17 wants to merge 2 commits into
mainfrom
feat/minigame-duplicate
Open

sung17 wants to merge 2 commits into
mainfrom
feat/minigame-duplicate

Conversation

@sung17

@sung17 sung17 commented Nov 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a Duplicate action for minigames, matching the one Mini Apps already have.

  • The copy keeps the minigame's settings: type, general settings, appearance, player settings, win/lose messages, the no-prize outcome's label and image, the prize-name custom field, and the enabled state.
  • Prizes are not copied. The copy starts with no prizes and nonWinning.loseRate: 100, so the 100% probability total stays valid. Until prizes are added, every play is a loss.
  • Plays, players and counters (playsCount, participantsCount, winnersCount, sharesCount) start from zero.
  • The copy is named <name> - Copy, or - Copy 2, - Copy 3, … when the name is taken. Long names are cut to fit the 150-character limit. Naming reuses insertWithFreeCopyName, the helper Mini Apps use, so a concurrent copy that takes a name moves on to the next free one.

Changes

  • minigameService.duplicate (packages/business/src/minigame/service.ts)
  • New public procedure POST /v1/minigames/{id}/duplicate (minigames.duplicate). The CLI command is chatbotx minigames duplicate <id>, added to apps/cli/README.md. It is not in the MCP default set, so apps/mcp-server/README.md is unchanged.
  • Builder: new Duplicate row action in the minigames table. It opens a confirm dialog that says prizes are not copied, then opens the copy's edit page.
  • i18n: minigames.duplicateDialog.* added to all 21 locale files.
  • Public-spec operations snapshot updated for the new operation.

Testing

  • packages/business/__tests__/minigame-duplicate.test.ts (6 cases: copied fields with prizes stripped, free-name pick, retry after a concurrent copy, name conflict, long-name cut, not found)
  • minigame-service-update.test.ts still passes
  • public-spec-operations / public-spec-mcp tests
  • CLI tests (command-name collision check)
  • pnpm lint, check-types for business and builder
  • Manual UI check: duplicate a jackpot minigame from the list, confirm the copy has no prizes and lose rate is 100%

🤖 Generated with Claude Code

Copies a minigame's settings into "<name> - Copy" (- Copy 2, … when
taken). Prizes are not copied: the copy starts with no prizes and
nonWinning.loseRate 100 so the 100% total stays valid. Plays, players
and counters start from zero.

Adds minigameService.duplicate, the public POST /v1/minigames/{id}/duplicate
procedure (CLI: `chatbotx minigames duplicate <id>`), and a Duplicate row
action with a confirm dialog in the minigames table.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the feature New feature or request label Nov 15, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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