Handle duplicate key and language pairs when updating translations
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 半日
- 初心者へのやさしさ
- 62/100
調査の方向性
Start with updateByi18nId in template/springboot/src/main/java/com/TinyPro/service/imp/II18ServiceImpl.java and compare it with the create flow, which already throws exception.i18.exists. Check I18Repository.java for a lookup by key and language, then confirm the uk_i18_lang_key constraint in I18.java. Done means a conflicting update returns HTTP 400 with exception.i18.exists, a self-update or unused key still saves, and regression tests cover both.
索引モデルが issue の本文から書いたものです。
説明
Summary
Follow up on the review finding in PR #265: updating a translation to a key and language pair used by another translation should return a controlled validation error rather than an internal server error.
Requested by @msslulu. The requester chose to leave the existing logic unchanged in PR #265 and agreed to track this work in a separate issue.
Required changes
- Verify the current
updateByi18nIdbehavior intemplate/springboot/src/main/java/com/TinyPro/service/imp/II18ServiceImpl.java. - Before saving an update, check whether another translation has the requested key and language. Exclude the translation being updated.
- If a conflict exists, throw
exception.i18.existswithHttpStatus.BAD_REQUEST, matching the create flow. - Keep the
uk_i18_lang_keyunique constraint and preserve the save flow for non-conflicting updates. - Add regression coverage for conflicting and non-conflicting updates.
Rationale
The review reported that duplicate updates fail at transaction commit with HTTP 500, while the create flow returns HTTP 400 with exception.i18.exists. Consistent conflict handling gives API clients an actionable error.
Affected areas
template/springboot/src/main/java/com/TinyPro/service/imp/II18ServiceImpl.javatemplate/springboot/src/main/java/com/TinyPro/jpa/I18Repository.javatemplate/springboot/src/main/java/com/TinyPro/entity/po/I18.java- Translation service/controller tests as appropriate.
Acceptance criteria
- Updating a translation to another translation's key and language returns HTTP 400 with
exception.i18.exists. - Updating a translation without changing its own key and language does not produce a false conflict.
- Updating to an unused key and language succeeds.
- A rejected update does not change the stored translation.
- The database unique constraint remains in place.
- Regression tests cover these cases.
References
- 主要言語
- TypeScript
- スター
- 88
- フォーク
- 29
- 平均マージ
- 1日 2時間
- マージ済み PR(30日)
- 42
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
opentiny/tiny-pro のほかの issue
-
🐛 [Bug]: 退出时,后台错误导致页面卡住対応中かも @Huauauaa が 61 日前に担当しました。 オープンbug
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
opentiny/tiny-pro#236 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
🐛 [Bug]: 跑不起来,报错,代码质量太差了対応中かも @Huauauaa が 61 日前に担当しました。 オープンbug
難易度 3/5 1〜2日 初心者へのやさしさ 38/100
opentiny/tiny-pro#206 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
🐛 [Bug]: 安装报错オープンbug
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
opentiny/tiny-pro#205 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
演示地址打不开オープン
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
-
整体风格可以改进一下オープン
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
opentiny/tiny-pro#199 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
opentiny/tiny-pro の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
pingdotgg/t3code#42253 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
vercel-labs/ui#1108 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 半日 初心者へのやさしさ 62/100
garethgeorge/backrest#1451 ·
メンテナーはふだん 1 日以内に返信
-
fix(core): \.pluck() returns values in key insertion order instead of requested argument order対応中かも @ManyaS-Git が 1 日前に担当しました。 オープンstatus:in-linear
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
Activity indicator ignores prefers-reduced-motion対応中かも @CapThunder19 が今日担当しました。 オープンbug
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
joinmarket-webui/jam#1675 ·
メンテナーはふだん 3 日以内に返信