feat(update-service): add PATCH /app/{id}/changelog with audit log

Allows editors to update release notes at any time. Every change is
recorded in update_operation_log with action CHANGELOG_UPDATE and
before/after values in detailJson, satisfying the audit requirement.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
这个提交包含在:
XuqmGroup 2026-05-18 16:47:36 +08:00
父节点 1ec7f2e35d
当前提交 ab7f029960

查看文件

@ -384,6 +384,31 @@ public class AppVersionController {
} }
} }
@PatchMapping("/app/{id}/changelog")
public ResponseEntity<ApiResponse<AppVersionEntity>> updateChangeLog(
@PathVariable String id,
@RequestBody Map<String, Object> body) {
AppVersionEntity entity = versionRepository.findById(id).orElseThrow();
String oldChangeLog = entity.getChangeLog();
Object raw = body.get("changeLog");
String newChangeLog = raw != null && !raw.toString().isBlank() ? raw.toString().trim() : null;
entity.setChangeLog(newChangeLog);
AppVersionEntity saved = versionRepository.save(entity);
operationLogService.record(
saved.getAppKey(),
"APP_VERSION",
saved.getId(),
"CHANGELOG_UPDATE",
null,
Map.of(
"versionName", saved.getVersionName(),
"versionCode", saved.getVersionCode(),
"before", oldChangeLog != null ? oldChangeLog : "",
"after", newChangeLog != null ? newChangeLog : ""
));
return ResponseEntity.ok(ApiResponse.success(saved));
}
@GetMapping("/app/list") @GetMapping("/app/list")
public ResponseEntity<ApiResponse<List<AppVersionEntity>>> list( public ResponseEntity<ApiResponse<List<AppVersionEntity>>> list(
@RequestParam String appKey, @RequestParam AppVersionEntity.Platform platform) { @RequestParam String appKey, @RequestParam AppVersionEntity.Platform platform) {