Commit 0bad1c71 authored by Shinya Maeda's avatar Shinya Maeda

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
......@@ -77,7 +77,7 @@ module API
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 }
......@@ -90,8 +90,8 @@ module API
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?
......
{
"type": "array",
"items": {
"type": "object",
"properties": {
"$ref": "./environment.json"
}
}
}
......@@ -360,6 +360,8 @@ RSpec.describe API::Environments do
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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment