Skip to content

Commit

Permalink
Merge pull request apolloconfig#377 from lepdou/open
Browse files Browse the repository at this point in the history
delete item api move operator field to request body
  • Loading branch information
nobodyiam authored Aug 11, 2016
2 parents 261b382 + 5af5ece commit 4f37245
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,17 @@ public void updateItem(@PathVariable String appId, @PathVariable String env,

RequestPrecondition.checkArguments(
!StringUtils.isContainEmpty(item.getKey(), item.getValue(), item.getDataChangeLastModifiedBy()),
"key,value,dataChangeLastModifiedBy 字段不能为空");
"key,value,dataChangeLastModifiedBy can not be empty");

RequestPrecondition.checkArguments(item.getKey().equals(key), "path中的key和payload中的key不一致");
RequestPrecondition.checkArguments(item.getKey().equals(key), "Key in path and payload is not consistent");

if (userService.findByUserId(item.getDataChangeLastModifiedBy()) == null) {
throw new BadRequestException("用户不存在");
throw new BadRequestException("user(dataChangeLastModifiedBy) not exists");
}

ItemDTO toUpdateItem = itemService.loadItem(Env.fromString(env), appId, clusterName, namespaceName, item.getKey());
if (toUpdateItem == null) {
throw new BadRequestException("item不存在");
throw new BadRequestException("item not exists");
}
//protect. only value,comment,lastModifiedBy can be modified
toUpdateItem.setComment(item.getComment());
Expand All @@ -97,12 +97,12 @@ public void deleteItem(@PathVariable String appId, @PathVariable String env,
HttpServletRequest request) {

if (userService.findByUserId(operator) == null) {
throw new BadRequestException("用户不存在");
throw new BadRequestException("user(operator) not exists");
}

ItemDTO toDeleteItem = itemService.loadItem(Env.valueOf(env), appId, clusterName, namespaceName, key);
if (toDeleteItem == null){
throw new BadRequestException("item不存在");
throw new BadRequestException("item not exists");
}

itemService.deleteItem(Env.fromString(env), toDeleteItem.getId(), operator);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public OpenReleaseDTO createRelease(@PathVariable String appId, @PathVariable St
"releaseTitle and releaseBy can not be empty");

if (userService.findByUserId(model.getReleasedBy()) == null) {
throw new BadRequestException("用户不存在.");
throw new BadRequestException("user(releaseBy) not exists");
}

model.setAppId(appId);
Expand Down

0 comments on commit 4f37245

Please sign in to comment.