Skip to content

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

Merged
sung17 merged 5 commits into
mainfrom
feat/minigame-duplicate
Nov 18, 2026
Merged

sung17 merged 5 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

@github-actions github-actions Bot added the feature New feature or request label Nov 15, 2026
Deathgiver and others added 4 commits November 17, 2026 11:50
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 <[email protected]>
…rize image

- the copy starts disabled so its play link is not live before it has prizes
- the prize description image is not copied, since prizes are not
- the duplicate dialog cannot be closed while the copy is being created
- a name conflict shows a translated message in the builder

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The duplicate flow's name lookup moves from the service into
minigameRepository.listNamesWithPrefix, matching mini-app, questionnaire
and appointment-calendar.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sung17
sung17 force-pushed the feat/minigame-duplicate branch from 90d7f47 to 4fab95f Compare November 17, 2026 09:08
The service now imports minigameRepository; loading the real repositories
barrel hit schema exports the test's partial schema mock does not define.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sung17
sung17 merged commit f646819 into main Nov 18, 2026
14 checks passed
hello-jackytruong referenced this pull request in hello-jackytruong/ChatWorkAI Nov 22, 2026
* feat(minigames): duplicate a minigame without its prizes

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 <[email protected]>

* test(minigames): classify duplicate action in api parity manifest

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(minigames): start duplicated minigames disabled and without the prize image

- the copy starts disabled so its play link is not live before it has prizes
- the prize description image is not copied, since prizes are not
- the duplicate dialog cannot be closed while the copy is being created
- a name conflict shows a translated message in the builder

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* refactor(minigames): read copy names through a minigame repository

The duplicate flow's name lookup moves from the service into
minigameRepository.listNamesWithPrefix, matching mini-app, questionnaire
and appointment-calendar.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(minigames): mock the repositories module in the service update test

The service now imports minigameRepository; loading the real repositories
barrel hit schema exports the test's partial schema mock does not define.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Deathgiver <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
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