Skip to content

Commit

Permalink
feat: 脚本开放管理类API TencentBlueKing#2318
Browse files Browse the repository at this point in the history
修复部分脚本管理 API 没有正确设置业务信息的问题
  • Loading branch information
wangyu096 committed Oct 12, 2023
1 parent e65e940 commit 9dfc38f
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ public EsbResp<EsbScriptVersionDetailV3DTO> createScriptVersion(
@EsbApiTimed(value = CommonMetricNames.ESB_API, extraTags = {"api_name", "v3_delete_script"})
@AuditEntry(actionId = ActionId.MANAGE_SCRIPT)
public EsbResp deleteScript(@AuditRequestBody EsbDeleteScriptV3Req request) {
request.fillAppResourceScope(appScopeMappingService);
scriptService.deleteScript(request.getUserName(), request.getAppId(), request.getScriptId());
return EsbResp.buildSuccessResp(null);
}
Expand All @@ -361,6 +362,7 @@ public EsbResp deleteScript(@AuditRequestBody EsbDeleteScriptV3Req request) {
@EsbApiTimed(value = CommonMetricNames.ESB_API, extraTags = {"api_name", "v3_delete_script_version"})
@AuditEntry(actionId = ActionId.MANAGE_SCRIPT)
public EsbResp deleteScriptVersion(@AuditRequestBody EsbDeleteScriptVersionV3Req request) {
request.fillAppResourceScope(appScopeMappingService);
scriptService.deleteScriptVersion(request.getUserName(), request.getAppResourceScope().getAppId(),
request.getScriptVersionId());
return EsbResp.buildSuccessResp(null);
Expand All @@ -371,6 +373,8 @@ public EsbResp deleteScriptVersion(@AuditRequestBody EsbDeleteScriptVersionV3Req
@AuditEntry(actionId = ActionId.MANAGE_SCRIPT)
public EsbResp<EsbScriptVersionDetailV3DTO> disableScriptVersion(
@AuditRequestBody EsbManageScriptVersionV3Req request) {

request.fillAppResourceScope(appScopeMappingService);
scriptService.disableScript(request.getAppResourceScope().getAppId(), request.getUserName(),
request.getScriptId(), request.getScriptVersionId());
ScriptDTO scriptVersion = scriptService.getScriptVersion(request.getScriptVersionId());
Expand All @@ -382,6 +386,8 @@ public EsbResp<EsbScriptVersionDetailV3DTO> disableScriptVersion(
@AuditEntry(actionId = ActionId.MANAGE_SCRIPT)
public EsbResp<EsbScriptVersionDetailV3DTO> publishScriptVersion(
@AuditRequestBody EsbManageScriptVersionV3Req request) {

request.fillAppResourceScope(appScopeMappingService);
scriptService.publishScript(request.getAppResourceScope().getAppId(), request.getUserName(),
request.getScriptId(), request.getScriptVersionId());
ScriptDTO scriptVersion = scriptService.getScriptVersion(request.getScriptVersionId());
Expand All @@ -393,6 +399,8 @@ public EsbResp<EsbScriptVersionDetailV3DTO> publishScriptVersion(
@AuditEntry(actionId = ActionId.MANAGE_SCRIPT)
public EsbResp<EsbScriptVersionDetailV3DTO> updateScriptBasic(
@AuditRequestBody EsbUpdateScriptBasicV3Req request) {

request.fillAppResourceScope(appScopeMappingService);
String userName = request.getUserName();
String scriptId = request.getScriptId();
AppResourceScope appResourceScope = request.getAppResourceScope();
Expand All @@ -411,6 +419,8 @@ public EsbResp<EsbScriptVersionDetailV3DTO> updateScriptBasic(
@AuditEntry(actionId = ActionId.MANAGE_SCRIPT)
public EsbResp<EsbScriptVersionDetailV3DTO> updateScriptVersion(
@AuditRequestBody EsbUpdateScriptVersionV3Req request) {

request.fillAppResourceScope(appScopeMappingService);
ScriptDTO scriptVersionDTO = scriptDTOBuilder.buildFromCreateUpdateReq(request);
scriptVersionDTO.setAppId(request.getAppResourceScope().getAppId());
scriptVersionDTO.setPublicScript(false);
Expand Down

0 comments on commit 9dfc38f

Please sign in to comment.