mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
some notes and a little progress
This commit is contained in:
parent
1e810d2426
commit
0ffceb9691
|
@ -633,8 +633,9 @@ class AssetsController extends Controller
|
||||||
$asset->model()->associate(AssetModel::find($request->validated()['model_id'])) : null;
|
$asset->model()->associate(AssetModel::find($request->validated()['model_id'])) : null;
|
||||||
($request->has('company_id')) ?
|
($request->has('company_id')) ?
|
||||||
$asset->company_id = Company::getIdForCurrentUser($request->validated()['company_id']) : null;
|
$asset->company_id = Company::getIdForCurrentUser($request->validated()['company_id']) : null;
|
||||||
($request->has('rtd_location_id')) ?
|
// TODO: this seems like bad logic maybe? it means that if you submit an rtd_location_id and a location_id in the same request location_id is overwritten with rtd_location_id. seems wrong.
|
||||||
$asset->location_id = $request->validated()['rtd_location_id'] : null;
|
//($request->has('rtd_location_id')) ?
|
||||||
|
// $asset->location_id = $request->validated()['rtd_location_id'] : null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* this is here just legacy reasons. Api\AssetController
|
* this is here just legacy reasons. Api\AssetController
|
||||||
|
|
|
@ -81,14 +81,14 @@ class AssetUpdateTest extends TestCase
|
||||||
$updatedAsset = Asset::find($response['payload']['id']);
|
$updatedAsset = Asset::find($response['payload']['id']);
|
||||||
|
|
||||||
// TODO: this isn't working, i assume `adminuser` is the user that created asset
|
// TODO: this isn't working, i assume `adminuser` is the user that created asset
|
||||||
|
// maybe i don't need to test this on an update???
|
||||||
//$this->assertTrue($updatedAsset->adminuser->is($user));
|
//$this->assertTrue($updatedAsset->adminuser->is($user));
|
||||||
|
|
||||||
$this->assertEquals('2024-06-02', $updatedAsset->asset_eol_date);
|
$this->assertEquals('2024-06-02', $updatedAsset->asset_eol_date);
|
||||||
$this->assertEquals('random_string', $updatedAsset->asset_tag);
|
$this->assertEquals('random_string', $updatedAsset->asset_tag);
|
||||||
$this->assertEquals($userAssigned->id, $updatedAsset->assigned_to);
|
$this->assertEquals($userAssigned->id, $updatedAsset->assigned_to);
|
||||||
$this->assertTrue($updatedAsset->company->is($company));
|
$this->assertTrue($updatedAsset->company->is($company));
|
||||||
// TODO: this doesn't work
|
$this->assertTrue($updatedAsset->location->is($location));
|
||||||
//$this->assertTrue($updatedAsset->location->is($location));
|
|
||||||
$this->assertTrue($updatedAsset->model->is($model));
|
$this->assertTrue($updatedAsset->model->is($model));
|
||||||
$this->assertEquals('A New Asset', $updatedAsset->name);
|
$this->assertEquals('A New Asset', $updatedAsset->name);
|
||||||
$this->assertEquals('Some notes', $updatedAsset->notes);
|
$this->assertEquals('Some notes', $updatedAsset->notes);
|
||||||
|
@ -109,7 +109,7 @@ class AssetUpdateTest extends TestCase
|
||||||
|
|
||||||
$this->settings->enableAutoIncrement();
|
$this->settings->enableAutoIncrement();
|
||||||
|
|
||||||
$response = $this->actingAsForApi(User::factory()->editAssets()->create())
|
$this->actingAsForApi(User::factory()->editAssets()->create())
|
||||||
->patchJson((route('api.assets.update', $asset->id)), [
|
->patchJson((route('api.assets.update', $asset->id)), [
|
||||||
'purchase_date' => '2021-01-01',
|
'purchase_date' => '2021-01-01',
|
||||||
])
|
])
|
||||||
|
@ -119,6 +119,7 @@ class AssetUpdateTest extends TestCase
|
||||||
|
|
||||||
$asset->refresh();
|
$asset->refresh();
|
||||||
|
|
||||||
|
// what's the problem here? logic problem? might need to skip this for this PR
|
||||||
$this->assertEquals('2024-01-01', $asset->asset_eol_date);
|
$this->assertEquals('2024-01-01', $asset->asset_eol_date);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue