Skip to content
Snippets Groups Projects
Commit 0bad1c71 authored by Shinya Maeda's avatar Shinya Maeda
Browse files

Fix Review App Multiple Deletion API payload

Currently, the paylod contains many unnecessary information.
These are removed for freeing up the network bandwidth.

Changelog: fixed
parent 99f91ccc
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -77,7 +77,7 @@ class Environments < ::API::Base
 
desc "Delete multiple stopped review apps" do
detail "Remove multiple stopped review environments older than a specific age"
success Entities::Environment
success Entities::EnvironmentBasic
end
params do
optional :before, type: Time, desc: "The timestamp before which environments can be deleted. Defaults to 30 days ago.", default: -> { 30.days.ago }
Loading
Loading
@@ -90,8 +90,8 @@ class Environments < ::API::Base
result = ::Environments::ScheduleToDeleteReviewAppsService.new(user_project, current_user, params).execute
 
response = {
scheduled_entries: Entities::Environment.represent(result.scheduled_entries),
unprocessable_entries: Entities::Environment.represent(result.unprocessable_entries)
scheduled_entries: Entities::EnvironmentBasic.represent(result.scheduled_entries),
unprocessable_entries: Entities::EnvironmentBasic.represent(result.unprocessable_entries)
}
 
if result.success?
Loading
Loading
{
"type": "array",
"items": {
"type": "object",
"properties": {
"$ref": "./environment.json"
}
}
}
Loading
Loading
@@ -360,6 +360,8 @@
expect(json_response["scheduled_entries"].size).to eq(1)
expect(json_response["scheduled_entries"].first["id"]).to eq(old_stopped_review_env.id)
expect(json_response["unprocessable_entries"].size).to eq(0)
expect(json_response["scheduled_entries"]).to match_schema('public_api/v4/environments')
expect(json_response["unprocessable_entries"]).to match_schema('public_api/v4/environments')
 
expect(old_stopped_review_env.reload.auto_delete_at).to eq(1.week.from_now)
expect(new_stopped_review_env.reload.auto_delete_at).to be_nil
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment