API GET repository stock column output fix [SCI-6550] (#4030)

* Add include stock unit items to Stock column get [SCI-6550]

* Fix stock column test [SCI-6550]

* Fix hound [SCI-6550]
This commit is contained in:
ajugo 2022-04-19 16:05:17 +02:00 committed by GitHub
parent 1a2a58ff5f
commit 54474b2bba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 5 deletions

View file

@ -34,7 +34,7 @@ module Api
def show
render jsonapi: @inventory_column,
serializer: InventoryColumnSerializer,
include: :inventory_list_items
include: %i(inventory_list_items repository_stock_unit_items)
end
def update

View file

@ -165,7 +165,7 @@ class Extends
'RepositoryChecklistValue' => 'checklist',
'RepositoryAssetValue' => 'file',
'RepositoryStatusValue' => 'status',
'RepositoryStockValue' => 'stock_value' }
'RepositoryStockValue' => 'stock' }
OMNIAUTH_PROVIDERS = %i(linkedin customazureactivedirectory okta)

View file

@ -235,7 +235,7 @@ RSpec.describe 'Api::V1::InventoryColumnsController', type: :request do
{ type: 'inventory_columns',
attributes: {
name: Faker::Name.unique.name,
data_type: 'stock_value',
data_type: 'stock',
metadata: {
decimals: 3
}
@ -434,8 +434,9 @@ RSpec.describe 'Api::V1::InventoryColumnsController', type: :request do
team_id: @teams.first.id,
inventory_id: @teams.first.repositories.second.id
), headers: @valid_headers
expect(response).to have_http_status(400)
expect(RepositoryColumn.where(id: deleted_id)).to exist
expect(response).to have_http_status(200)
expect(RepositoryColumn.where(id: deleted_id)).to_not exist
expect(RepositoryCell.where(repository_column: deleted_id).count).to equal 0
end
end