Skip to content

Commit

Permalink
feat:esb apply permission response return record id (#825)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lawrence-lkq authored Aug 19, 2024
1 parent 19421f8 commit 18b64e4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def apply(self, request, system_id: int, *args, **kwargs):
data = slz.validated_data

manager = ComponentPermissionManager.get_manager()
manager.create_apply_record(
record = manager.create_apply_record(
data["target_app_code"],
system,
data["component_ids"],
Expand All @@ -94,7 +94,7 @@ def apply(self, request, system_id: int, *args, **kwargs):
request.user.username,
)

return V1OKJsonResponse("OK")
return V1OKJsonResponse("OK", data={"record_id": record.id})


class AppPermissionRenewAPIView(viewsets.GenericViewSet):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ def test_apply(self, settings, mocker, request_factory, unique_id):

result = get_response_json(response)
assert result["code"] == 0, result
assert AppPermissionApplyRecord.objects.filter(bk_app_code=unique_id).exists()
record = AppPermissionApplyRecord.objects.get(bk_app_code=unique_id)
assert record.id == result["data"]["record_id"]


class TestAppPermissionViewSet:
Expand Down

0 comments on commit 18b64e4

Please sign in to comment.