Handle duplicate key and language pairs when updating translations
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- Nửa ngày
- Mức phù hợp với người mới
- 62/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- TypeScript
- Star
- 88
- Fork
- 29
- Merge trung bình
- 1 ngày 2 giờ
- Pull request đã merge (30 ngày)
- 42
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của opentiny/tiny-pro
-
🐛 [Bug]: 退出时,后台错误导致页面卡住Có thể đã có người làm @Huauauaa đã nhận 61 ngày trước. Đang mởbug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
opentiny/tiny-pro#236 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
🐛 [Bug]: 跑不起来,报错,代码质量太差了Có thể đã có người làm @Huauauaa đã nhận 61 ngày trước. Đang mởbug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 38/100
opentiny/tiny-pro#206 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
🐛 [Bug]: 安装报错Đang mởbug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
opentiny/tiny-pro#205 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
演示地址打不开Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
-
整体风格可以改进一下Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
opentiny/tiny-pro#199 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của opentiny/tiny-pro
Issue tương tự
-
MCP tool results drop structuredContent when text is only a summaryCó thể đã có người làm @Pankaj-bit361 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
n8n-io/nod#1474 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Clean-up indicator: two polish points from the dev look (kit clock spacing, row description)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
inblockio/siwx-oidc-matrix-server#101 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
status:needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
pingdotgg/t3code#42253 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày