A free open source IT asset/license management system
a couple quick things
spencerrlongg9d8433bd6d9f
diff --git a/app/Http/Controllers/Api/AssetsController.php b/app/Http/Controllers/Api/AssetsController.phpindex 8968f2199f..6699fd87e6 100644--- a/app/Http/Controllers/Api/AssetsController.php+++ b/app/Http/Controllers/Api/AssetsController.php@@ -543,9 +543,12 @@ class AssetsController extends Controller$asset->fill($request->validated());$asset->user_id = Auth::id();- $asset->archived = '0';- $asset->physical = '1';- $asset->depreciate = '0';+ // @todo: verify eol is working as expected - move to request? or do I want this at all?+ // might just remove this and then use the method from here https://github.com/snipe/snipe-it/pull/13846+ //$asset->asset_eol_date = $request->validated()['asset_eol_date'] ?? $asset->present()->eol_date();+ $asset->archived = '0';+ $asset->physical = '1';+ $asset->depreciate = '0';/*** this is here just legacy reasons. Api\AssetControllerdiff --git a/tests/Feature/Api/Assets/AssetStoreTest.php b/tests/Feature/Api/Assets/AssetStoreTest.phpindex 72e94bf0b5..e423745176 100644--- a/tests/Feature/Api/Assets/AssetStoreTest.php+++ b/tests/Feature/Api/Assets/AssetStoreTest.php@@ -40,7 +40,7 @@ class AssetStoreTest extends TestCase'archived' => true,'asset_eol_date' => '2024-06-02','asset_tag' => 'random_string',- 'assigned_to' => $userAssigned->id,+ 'assigned_user' => $userAssigned->id, // assigned_to is set in the request, assigned_to isn't set through the api request'company_id' => $company->id,'depreciate' => true,'last_audit_date' => '2023-09-03',@@ -72,7 +72,7 @@ class AssetStoreTest extends TestCase$this->assertEquals('2024-06-02', $asset->asset_eol_date);$this->assertEquals('random_string', $asset->asset_tag);// @todo: This isn't in the docs but it's in the controller (should it be removed?)- $this->assertEquals($userAssigned->id, $asset->assigned_to); //todo: figure this out+ $this->assertEquals($userAssigned->id, $asset->assigned_to);// @todo: This is not in the docs but it's in the controller$this->assertTrue($asset->company->is($company));// @todo: this is explicitly set 0 in the controller but they docs say they are customizable@@ -313,6 +313,7 @@ class AssetStoreTest extends TestCase$apiAsset = Asset::find($response['payload']['id']);$this->assertTrue($apiAsset->adminuser->is($user));+ // I think this makes sense, but open to a sanity check$this->assertTrue($asset->assignedAssets()->first()->is($apiAsset));}}