Skip to content

A free open source IT asset/license management system

Updated routes

snipedf2545ef80fb
diff --git a/routes/api.php b/routes/api.php
index eeb644d13a..9e32bf6070 100644
--- a/routes/api.php
+++ b/routes/api.php
@@ -1314,7 +1314,7 @@ Route::group(['prefix' => 'v1', 'middleware' => ['api', 'api-throttle:api']], fu
'index'
]
)->name('api.files.index')
- ->where(['object_type' => 'assets|hardware|models|users|locations|accessories|consumables|licenses|components']);
+ ->where(['object_type' => 'assets|asset_maintenance|hardware|models|users|locations|accessories|consumables|licenses|components']);
// Get a file
Route::get('{object_type}/{id}/files/{file_id}',
@@ -1323,7 +1323,7 @@ Route::group(['prefix' => 'v1', 'middleware' => ['api', 'api-throttle:api']], fu
'show'
]
)->name('api.files.show')
- ->where(['object_type' => 'assets|hardware|models|users|locations|accessories|consumables|licenses|components']);
+ ->where(['object_type' => 'assets|asset_maintenance|hardware|models|users|locations|accessories|consumables|licenses|components']);
// Upload files(s)
Route::post('{object_type}/{id}/files',
@@ -1332,7 +1332,7 @@ Route::group(['prefix' => 'v1', 'middleware' => ['api', 'api-throttle:api']], fu
'store'
]
)->name('api.files.store')
- ->where(['object_type' => 'assets|hardware|models|users|locations|accessories|consumables|licenses|components']);
+ ->where(['object_type' => 'assets|asset_maintenance|hardware|models|users|locations|accessories|consumables|licenses|components']);
// Delete files(s)
Route::delete('{object_type}/{id}/files/{file_id}/delete',
diff --git a/routes/web.php b/routes/web.php
index 40a1d163ec..e747ffe0b0 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -13,7 +13,7 @@ use App\Http\Controllers\DepreciationsController;
use App\Http\Controllers\GroupsController;
use App\Http\Controllers\HealthController;
use App\Http\Controllers\LabelsController;
-use App\Http\Controllers\LocationsController;
+use App\Http\Controllers\UploadedFilesController;
use App\Http\Controllers\ManufacturersController;
use App\Http\Controllers\ModalController;
use App\Http\Controllers\NotesController;
@@ -693,6 +693,39 @@ Route::group(['middleware' => 'web'], function () {
'logout',
[LoginController::class, 'logout']
)->name('logout.post');
+
+
+
+ /**
+ * Uploaded files API routes
+ */
+
+ // Get a file
+ Route::get('{object_type}/{id}/files/{file_id}',
+ [
+ UploadedFilesController::class,
+ 'show'
+ ]
+ )->name('ui.files.show')
+ ->where(['object_type' => 'assets|asset_maintenance|hardware|models|users|locations|accessories|consumables|licenses|components']);
+
+ // Upload files(s)
+ Route::post('{object_type}/{id}/files',
+ [
+ UploadedFilesController::class,
+ 'store'
+ ]
+ )->name('ui.files.store')
+ ->where(['object_type' => 'assets|asset_maintenance|hardware|models|users|locations|accessories|consumables|licenses|components']);
+
+ // Delete files(s)
+ Route::delete('{object_type}/{id}/files/{file_id}/delete',
+ [
+ UploadedFilesController::class,
+ 'destroy'
+ ]
+ )->name('ui.files.destroy')
+ ->where(['object_type' => 'assets|hardware|models|users|locations|accessories|consumables|licenses|components']);
});
diff --git a/routes/web/components.php b/routes/web/components.php
index 44f4fe10e5..cbc7b70899 100644
--- a/routes/web/components.php
+++ b/routes/web/components.php
@@ -25,20 +25,6 @@ Route::group(['prefix' => 'components', 'middleware' => ['auth']], function () {
[Components\ComponentCheckinController::class, 'store']
)->name('components.checkin.store');
- Route::post(
- '{componentId}/upload',
- [Components\ComponentsFilesController::class, 'store']
- )->name('upload/component');
-
- Route::delete(
- '{componentId}/showfile/{fileId}/delete',
- [Components\ComponentsFilesController::class, 'destroy']
- )->name('delete/componentfile');
-
- Route::get(
- '{componentId}/showfile/{fileId}/{download?}',
- [Components\ComponentsFilesController::class, 'show']
- )->name('show.componentfile');
});
diff --git a/routes/web/consumables.php b/routes/web/consumables.php
index 5059c4bc5a..53ec09425e 100644
--- a/routes/web/consumables.php
+++ b/routes/web/consumables.php
@@ -16,20 +16,6 @@ Route::group(['prefix' => 'consumables', 'middleware' => ['auth']], function ()
[Consumables\ConsumableCheckoutController::class, 'store']
)->name('consumables.checkout.store');
- Route::post(
- '{consumableId}/upload',
- [Consumables\ConsumablesFilesController::class, 'store']
- )->name('upload/consumable');
-
- Route::delete(
- '{consumableId}/showfile/{fileId}/delete',
- [Consumables\ConsumablesFilesController::class, 'destroy']
- )->name('delete/consumablefile');
-
- Route::get(
- '{consumableId}/showfile/{fileId}/{download?}',
- [Consumables\ConsumablesFilesController::class, 'show']
- )->name('show.consumablefile');
Route::get('{consumable}/clone',
[Consumables\ConsumablesController::class, 'clone']
diff --git a/routes/web/hardware.php b/routes/web/hardware.php
index 9c15a31f62..6fcfbd0b72 100644
--- a/routes/web/hardware.php
+++ b/routes/web/hardware.php
@@ -5,7 +5,6 @@ use App\Http\Controllers\Assets\AssetsController;
use App\Http\Controllers\Assets\BulkAssetsController;
use App\Http\Controllers\Assets\AssetCheckoutController;
use App\Http\Controllers\Assets\AssetCheckinController;
-use App\Http\Controllers\Assets\AssetFilesController;
use App\Models\Setting;
use Tabuna\Breadcrumbs\Trail;
use Illuminate\Support\Facades\Route;
@@ -141,19 +140,6 @@ Route::group(
[AssetsController::class, 'getRestore']
)->name('restore/hardware')->withTrashed();
- Route::post('{asset}/upload',
- [AssetFilesController::class, 'store']
- )->name('upload/asset')->withTrashed();
-
- Route::get('{asset}/showfile/{fileId}/{download?}',
- [AssetFilesController::class, 'show']
- )->name('show/assetfile')->withTrashed();
-
- Route::delete('{asset}/showfile/{fileId}/delete',
- [AssetFilesController::class, 'destroy']
- )->name('delete/assetfile')->withTrashed();
- Route::get('hardware/bulkedit', [BulkAssetsController::class, 'bulkEditForm'])->name('hardware.bulkedit');
-
Route::post(
'bulkedit',
[BulkAssetsController::class, 'edit']
diff --git a/routes/web/licenses.php b/routes/web/licenses.php
index 6bffa58aa9..3abe15d5be 100644
--- a/routes/web/licenses.php
+++ b/routes/web/licenses.php
@@ -47,19 +47,6 @@ Route::group(['prefix' => 'licenses', 'middleware' => ['auth']], function () {
[Licenses\LicenseCheckoutController::class, 'bulkCheckout']
)->name('licenses.bulkcheckout');
- Route::post(
- '{licenseId}/upload',
- [Licenses\LicenseFilesController::class, 'store']
- )->name('upload/license');
-
- Route::delete(
- '{licenseId}/showfile/{fileId}/delete',
- [Licenses\LicenseFilesController::class, 'destroy']
- )->name('delete/licensefile');
- Route::get(
- '{licenseId}/showfile/{fileId}/{download?}',
- [Licenses\LicenseFilesController::class, 'show']
- )->name('show.licensefile');
Route::get(
'export',
[
diff --git a/routes/web/locations.php b/routes/web/locations.php
index ff2218f5be..30bfbb87e3 100644
--- a/routes/web/locations.php
+++ b/routes/web/locations.php
@@ -1,24 +1,10 @@
<?php
use App\Http\Controllers\LocationsController;
-use App\Http\Controllers\LocationsFilesController;
use Illuminate\Support\Facades\Route;
Route::group(['prefix' => 'locations', 'middleware' => ['auth']], function () {
- Route::post('{location}/upload',
- [LocationsFilesController::class, 'store']
- )->name('upload/locations')->withTrashed();
-
- Route::get('{location}/showfile/{fileId}/{download?}',
- [LocationsFilesController::class, 'show']
- )->name('show/locationsfile')->withTrashed();
-
- Route::delete('{location}/showfile/{fileId}/delete',
- [LocationsFilesController::class, 'destroy']
- )->name('delete/locationsfile')->withTrashed();
-
-
Route::post(
'bulkdelete',
[LocationsController::class, 'postBulkDelete']
@@ -34,7 +20,6 @@ Route::group(['prefix' => 'locations', 'middleware' => ['auth']], function () {
[LocationsController::class, 'postRestore']
)->name('locations.restore');
-
Route::get('{locationId}/clone',
[LocationsController::class, 'getClone']
)->name('clone/location');
diff --git a/routes/web/models.php b/routes/web/models.php
index 8c003ba662..f8a962fb5e 100644
--- a/routes/web/models.php
+++ b/routes/web/models.php
@@ -1,7 +1,6 @@
<?php
use App\Http\Controllers\AssetModelsController;
-use App\Http\Controllers\AssetModelsFilesController;
use App\Http\Controllers\BulkAssetModelsController;
use Illuminate\Support\Facades\Route;
use Tabuna\Breadcrumbs\Trail;
@@ -11,18 +10,6 @@ use Tabuna\Breadcrumbs\Trail;
Route::group(['prefix' => 'models', 'middleware' => ['auth']], function () {
- Route::post('{model}/upload',
- [AssetModelsFilesController::class, 'store']
- )->name('upload/models')->withTrashed();
-
- Route::get('{model}/showfile/{fileId}/{download?}',
- [AssetModelsFilesController::class, 'show']
- )->name('show/modelfile')->withTrashed();
-
- Route::delete('{model}/showfile/{fileId}/delete',
- [AssetModelsFilesController::class, 'destroy']
- )->name('delete/modelfile')->withTrashed();
-
Route::get(
'{model}/clone',
[
diff --git a/routes/web/users.php b/routes/web/users.php
index e0f44bfdbb..06a210daa5 100644
--- a/routes/web/users.php
+++ b/routes/web/users.php
@@ -1,7 +1,6 @@
<?php
use App\Http\Controllers\Users;
-use App\Http\Controllers\Users\UserFilesController;
use Illuminate\Support\Facades\Route;
// User Management
@@ -64,30 +63,6 @@ Route::group(['prefix' => 'users', 'middleware' => ['auth']], function () {
]
)->name('unsuspend/user');
- Route::post(
- '{user}/upload',
- [
- Users\UserFilesController::class,
- 'store'
- ]
- )->name('upload/user')->withTrashed();
-
- Route::delete(
- '{userId}/showfile/{fileId}/delete',
- [
- Users\UserFilesController::class,
- 'destroy'
- ]
- )->name('userfile.destroy');
-
- Route::get(
- '{user}/showfile/{fileId}',
- [
- Users\UserFilesController::class,
- 'show'
- ]
- )->name('show/userfile')->withTrashed();
-
Route::post(
'{userId}/password',
[