Skip to content

A free open source IT asset/license management system

Updated routes with new endpoints

snipe5fceef1dc3f0
diff --git a/routes/api.php b/routes/api.php
index c51b99159f..181c5b0207 100644
--- a/routes/api.php
+++ b/routes/api.php
@@ -430,13 +430,13 @@ Route::group(['prefix' => 'v1', 'middleware' => ['api', 'throttle:api']], functi
'parameters' => ['group' => 'group_id'],
]
); // end groups API routes
-
+
/**
* Assets API routes
*/
Route::group(['prefix' => 'hardware'], function () {
-
+
Route::get('selectlist',
[
Api\AssetsController::class,
@@ -524,18 +524,19 @@ Route::group(['prefix' => 'v1', 'middleware' => ['api', 'throttle:api']], functi
)->name('api.asset.checkin');
Route::post('{id}/checkout',
- [
+ [
Api\AssetsController::class,
'checkout'
- ]
+ ]
)->name('api.asset.checkout');
- Route::post('{asset_id}/restore',
+ Route::post('{asset_id}/restore',
[
Api\AssetsController::class,
'restore'
]
- )->name('api.assets.restore');
+ )->name('api.assets.restore');
+
Route::post('{asset_id}/files',
[
Api\AssetFilesController::class,
@@ -563,8 +564,30 @@ Route::group(['prefix' => 'v1', 'middleware' => ['api', 'throttle:api']], functi
'destroy'
]
)->name('api.assets.files.destroy');
+
+
+
+ /** Begin assigned routes */
+ Route::get('{asset}/assigned/assets',
+ [
+ Api\AssetsController::class,
+ 'assignedAssets'
+ ]
+ )->name('api.assets.assigned_assets');
+
+ Route::get('{asset}/assigned/accessories',
+ [
+ Api\AssetsController::class,
+ 'assignedAccessories'
+ ]
+ )->name('api.assets.assigned_accessories');
+ /** End assigned routes */
+
});
+
+
+
// pulling this out of resource route group to begin normalizing for route-model binding.
// this would probably keep working with the resource route group, but the general practice is for
// the model name to be the parameter - and i think it's a good differentiation in the code while we convert the others.
@@ -705,6 +728,8 @@ Route::group(['prefix' => 'v1', 'middleware' => ['api', 'throttle:api']], functi
]
)->name('api.locations.viewusers');
+
+ // Legacy URL for compatibility
Route::get('{location}/assets',
[
Api\LocationsController::class,
@@ -712,13 +737,23 @@ Route::group(['prefix' => 'v1', 'middleware' => ['api', 'throttle:api']], functi
]
)->name('api.locations.viewassets');
+
+ // Add a comment here, you moron
+ /** Begin assigned routes */
+ Route::get('{location}/assigned/assets',
+ [
+ Api\LocationsController::class,
+ 'assignedAssets'
+ ]
+ )->name('api.locations.assigned_assets');
+
Route::get('{location}/assigned/accessories',
[
Api\LocationsController::class,
'assignedAccessories'
]
)->name('api.locations.assigned_accessories');
-
+ /** End assigned routes */
});
Route::resource('locations',