From 5749e2d22186043a3521f3e832afde9726c14301 Mon Sep 17 00:00:00 2001 From: Teis Lindemark Date: Sat, 10 Apr 2021 16:14:03 +0200 Subject: [PATCH] Added inventiry managment --- .../InventoryCommentController.php | 45 ++ app/Http/Controllers/InventoryController.php | 65 ++ .../Controllers/InventoryCountController.php | 36 ++ .../Controllers/StorageLocationController.php | 66 ++ app/Models/Inventory.php | 37 ++ app/Models/InventoryComment.php | 25 + app/Models/InventoryCount.php | 26 + app/Models/StorageLocation.php | 21 + composer.json | 2 + composer.lock | 600 +++++++++++++++++- ...0_114917_create_table_storage_location.php | 36 ++ ...21_04_10_114927_create_table_inventory.php | 38 ++ ...0_115011_create_table_inventorycomment.php | 36 ++ ...115151_create_table_inventory_counting.php | 37 ++ routes/web.php | 21 + 15 files changed, 1090 insertions(+), 1 deletion(-) create mode 100644 app/Http/Controllers/InventoryCommentController.php create mode 100644 app/Http/Controllers/InventoryController.php create mode 100644 app/Http/Controllers/InventoryCountController.php create mode 100644 app/Http/Controllers/StorageLocationController.php create mode 100644 app/Models/Inventory.php create mode 100644 app/Models/InventoryComment.php create mode 100644 app/Models/InventoryCount.php create mode 100644 app/Models/StorageLocation.php create mode 100644 database/migrations/2021_04_10_114917_create_table_storage_location.php create mode 100644 database/migrations/2021_04_10_114927_create_table_inventory.php create mode 100644 database/migrations/2021_04_10_115011_create_table_inventorycomment.php create mode 100644 database/migrations/2021_04_10_115151_create_table_inventory_counting.php diff --git a/app/Http/Controllers/InventoryCommentController.php b/app/Http/Controllers/InventoryCommentController.php new file mode 100644 index 0000000..6db8d1d --- /dev/null +++ b/app/Http/Controllers/InventoryCommentController.php @@ -0,0 +1,45 @@ +get(); + return response()->json($comments); + } + + public function create(Request $request, $inventory_id) + { + $comment = new InventoryComment; + $comment->comment = $request->comment; + $comment->user_id = $request->user_id; + $comment->inventory_id = $inventory_id; + $comment->save(); + return response()->json($comment); + } + + public function update(Request $request, $id) + { + $comment = InventoryComment::find($id); + if($request->input('comment')) { + $comment->comment = $request->input('comment'); + } + $comment->save(); + return response()->json($comment); + } + + public function destroy($id) + { + $comment = InventoryComment::find($id); + $comment->delete(); + + return response()->json('inventory comment removed successfully'); + } +} +?> \ No newline at end of file diff --git a/app/Http/Controllers/InventoryController.php b/app/Http/Controllers/InventoryController.php new file mode 100644 index 0000000..ba2abb7 --- /dev/null +++ b/app/Http/Controllers/InventoryController.php @@ -0,0 +1,65 @@ +get(); + return response()->json($storagelocations); + } + + public function create(Request $request, $storagelocation_id) + { + $inventory = new Inventory; + $inventory->inventoryCategoryCodeSetId = $request->inventoryCategoryCodeSetId; + $inventory->inventoryCategoryCodeId = $request->inventoryCategoryCodeId; + $inventory->name = $request->name; + $inventory->storagelocation_id = $storagelocation_id; + $inventory->description = $request->description; + $inventory->save(); + return response()->json($inventory); + } + + public function show($id) + { + $inventory = Inventory::find($id); + return response()->json($inventory); + } + + public function update(Request $request, $id) + { + $inventory = Inventory::find($id); + if($request->input('inventoryCategoryCodeSetId')) { + $inventory->inventoryCategoryCodeSetId = $request->input('inventoryCategoryCodeSetId'); + } + if($request->input('inventoryCategoryCodeId')) { + $inventory->inventoryCategoryCodeId = $request->input('inventoryCategoryCodeId'); + } + if($request->input('name')) { + $inventory->name = $request->input('name'); + } + if($request->input('storagelocation_id')) { + $inventory->storagelocation_id = $request->input('storagelocation_id'); + } + if($request->input('description')) { + $inventory->description = $request->input('description'); + } + $inventory->save(); + return response()->json($inventory); + } + + public function destroy($id) + { + $inventory = Inventory::find($id); + $inventory->delete(); + + return response()->json('inventory removed successfully'); + } +} +?> \ No newline at end of file diff --git a/app/Http/Controllers/InventoryCountController.php b/app/Http/Controllers/InventoryCountController.php new file mode 100644 index 0000000..8e373c3 --- /dev/null +++ b/app/Http/Controllers/InventoryCountController.php @@ -0,0 +1,36 @@ +get(); + return response()->json($counts); + } + + public function create(Request $request, $inventory_id) + { + $count = new InventoryCount; + $count->inventory_id = $inventory_id; + $count->counted_at = $request->counted_at; + $count->count = $request->count; + $count->user_id = $request->user_id; + $count->save(); + return response()->json($count); + } + + public function destroy($id) + { + $count = InventoryCount::find($id); + $count->delete(); + + return response()->json('inventory count removed successfully'); + } +} +?> \ No newline at end of file diff --git a/app/Http/Controllers/StorageLocationController.php b/app/Http/Controllers/StorageLocationController.php new file mode 100644 index 0000000..e1583fb --- /dev/null +++ b/app/Http/Controllers/StorageLocationController.php @@ -0,0 +1,66 @@ +json($storagelocations); + } + + public function create(Request $request) + { + $location = new StorageLocation; + $location->name = $request->name; + $location->description = $request->description; + $location->long = $request->long; + $location->lat = $request->lat; + $location->save(); + return response()->json($location); + } + + public function show($id) + { + $location = StorageLocation::find($id); + return response()->json($location); + } + + public function update(Request $request, $id) + { + $location = StorageLocation::find($id); + if($request->input('name')) { + $location->name = $request->input('name'); + } + if($request->input('description')) { + $location->description = $request->input('description'); + } + if($request->input('long')) { + $location->long = $request->input('long'); + } + if($request->input('lat')) { + $location->lat = $request->input('lat'); + } + $location->save(); + return response()->json($location); + } + + public function destroy($id) + { + $location = StorageLocation::find($id); + $location->delete(); + + return response()->json('location removed successfully'); + } +} +?> \ No newline at end of file diff --git a/app/Models/Inventory.php b/app/Models/Inventory.php new file mode 100644 index 0000000..e08be7b --- /dev/null +++ b/app/Models/Inventory.php @@ -0,0 +1,37 @@ +belongsTo(StorageLocation::class, 'storagelocation_id', 'id'); + } + + public function comments() + { + return $this->hasMany(InventoryComment::class, 'inventory_id', 'id'); + } + + public function counts() + { + return $this->hasMany(InventoryCount::class, 'inventory_id', 'id'); + } +} +?> \ No newline at end of file diff --git a/app/Models/InventoryComment.php b/app/Models/InventoryComment.php new file mode 100644 index 0000000..345d4c3 --- /dev/null +++ b/app/Models/InventoryComment.php @@ -0,0 +1,25 @@ +belongsTo(Inventory::class, 'inventory_id', 'id'); + } +} +?> \ No newline at end of file diff --git a/app/Models/InventoryCount.php b/app/Models/InventoryCount.php new file mode 100644 index 0000000..97b5f98 --- /dev/null +++ b/app/Models/InventoryCount.php @@ -0,0 +1,26 @@ +belongsTo(Inventory::class, 'inventory_id', 'id'); + } +} +?> \ No newline at end of file diff --git a/app/Models/StorageLocation.php b/app/Models/StorageLocation.php new file mode 100644 index 0000000..f9e6736 --- /dev/null +++ b/app/Models/StorageLocation.php @@ -0,0 +1,21 @@ +hasMany(Inventory::class, 'storagelocation_id', 'id'); + } +} +?> \ No newline at end of file diff --git a/composer.json b/composer.json index 37f0023..2df86e2 100644 --- a/composer.json +++ b/composer.json @@ -7,6 +7,8 @@ "require": { "php": "^7.3|^8.0", "auth0/auth0-php": "^7.6", + "doctrine/dbal": "^3.0", + "grimzy/laravel-mysql-spatial": "^5.0", "guzzlehttp/guzzle": "^7.3", "laravel/lumen-framework": "^8.0" }, diff --git a/composer.lock b/composer.lock index a3cb143..56b1465 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "7d987dec4277aff08295190ccd554ff9", + "content-hash": "6b1339334966ee6626a44cfa4fc60fc5", "packages": [ { "name": "auth0/auth0-php", @@ -188,6 +188,384 @@ ], "time": "2021-01-20T22:51:39+00:00" }, + { + "name": "composer/package-versions-deprecated", + "version": "1.11.99.1", + "source": { + "type": "git", + "url": "https://github.com/composer/package-versions-deprecated.git", + "reference": "7413f0b55a051e89485c5cb9f765fe24bb02a7b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/7413f0b55a051e89485c5cb9f765fe24bb02a7b6", + "reference": "7413f0b55a051e89485c5cb9f765fe24bb02a7b6", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.1.0 || ^2.0", + "php": "^7 || ^8" + }, + "replace": { + "ocramius/package-versions": "1.11.99" + }, + "require-dev": { + "composer/composer": "^1.9.3 || ^2.0@dev", + "ext-zip": "^1.13", + "phpunit/phpunit": "^6.5 || ^7" + }, + "type": "composer-plugin", + "extra": { + "class": "PackageVersions\\Installer", + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "PackageVersions\\": "src/PackageVersions" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be" + } + ], + "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", + "support": { + "issues": "https://github.com/composer/package-versions-deprecated/issues", + "source": "https://github.com/composer/package-versions-deprecated/tree/1.11.99.1" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2020-11-11T10:22:58+00:00" + }, + { + "name": "doctrine/cache", + "version": "1.10.2", + "source": { + "type": "git", + "url": "https://github.com/doctrine/cache.git", + "reference": "13e3381b25847283a91948d04640543941309727" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/cache/zipball/13e3381b25847283a91948d04640543941309727", + "reference": "13e3381b25847283a91948d04640543941309727", + "shasum": "" + }, + "require": { + "php": "~7.1 || ^8.0" + }, + "conflict": { + "doctrine/common": ">2.2,<2.4" + }, + "require-dev": { + "alcaeus/mongo-php-adapter": "^1.1", + "doctrine/coding-standard": "^6.0", + "mongodb/mongodb": "^1.1", + "phpunit/phpunit": "^7.0", + "predis/predis": "~1.0" + }, + "suggest": { + "alcaeus/mongo-php-adapter": "Required to use legacy MongoDB driver" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.9.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.", + "homepage": "https://www.doctrine-project.org/projects/cache.html", + "keywords": [ + "abstraction", + "apcu", + "cache", + "caching", + "couchdb", + "memcached", + "php", + "redis", + "xcache" + ], + "support": { + "issues": "https://github.com/doctrine/cache/issues", + "source": "https://github.com/doctrine/cache/tree/1.10.x" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fcache", + "type": "tidelift" + } + ], + "time": "2020-07-07T18:54:01+00:00" + }, + { + "name": "doctrine/dbal", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/dbal.git", + "reference": "ee6d1260d5cc20ec506455a585945d7bdb98662c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/ee6d1260d5cc20ec506455a585945d7bdb98662c", + "reference": "ee6d1260d5cc20ec506455a585945d7bdb98662c", + "shasum": "" + }, + "require": { + "composer/package-versions-deprecated": "^1.11.99", + "doctrine/cache": "^1.0", + "doctrine/event-manager": "^1.0", + "php": "^7.3 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^8.1", + "jetbrains/phpstorm-stubs": "^2019.1", + "phpstan/phpstan": "^0.12.40", + "phpstan/phpstan-strict-rules": "^0.12.2", + "phpunit/phpunit": "^9.4", + "psalm/plugin-phpunit": "^0.10.0", + "symfony/console": "^2.0.5|^3.0|^4.0|^5.0", + "vimeo/psalm": "^3.17.2" + }, + "suggest": { + "symfony/console": "For helpful console commands such as SQL execution and import of files." + }, + "bin": [ + "bin/doctrine-dbal" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\DBAL\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + } + ], + "description": "Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.", + "homepage": "https://www.doctrine-project.org/projects/dbal.html", + "keywords": [ + "abstraction", + "database", + "db2", + "dbal", + "mariadb", + "mssql", + "mysql", + "oci8", + "oracle", + "pdo", + "pgsql", + "postgresql", + "queryobject", + "sasql", + "sql", + "sqlite", + "sqlserver", + "sqlsrv" + ], + "support": { + "issues": "https://github.com/doctrine/dbal/issues", + "source": "https://github.com/doctrine/dbal/tree/3.0.0" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fdbal", + "type": "tidelift" + } + ], + "time": "2020-11-15T18:20:41+00:00" + }, + { + "name": "doctrine/event-manager", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/event-manager.git", + "reference": "41370af6a30faa9dc0368c4a6814d596e81aba7f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/event-manager/zipball/41370af6a30faa9dc0368c4a6814d596e81aba7f", + "reference": "41370af6a30faa9dc0368c4a6814d596e81aba7f", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "conflict": { + "doctrine/common": "<2.9@dev" + }, + "require-dev": { + "doctrine/coding-standard": "^6.0", + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\": "lib/Doctrine/Common" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + }, + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + } + ], + "description": "The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.", + "homepage": "https://www.doctrine-project.org/projects/event-manager.html", + "keywords": [ + "event", + "event dispatcher", + "event manager", + "event system", + "events" + ], + "support": { + "issues": "https://github.com/doctrine/event-manager/issues", + "source": "https://github.com/doctrine/event-manager/tree/1.1.x" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fevent-manager", + "type": "tidelift" + } + ], + "time": "2020-05-29T18:28:51+00:00" + }, { "name": "doctrine/inflector", "version": "2.0.3", @@ -492,6 +870,107 @@ ], "time": "2020-12-29T14:50:06+00:00" }, + { + "name": "geo-io/interface", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/geo-io/interface.git", + "reference": "cf46fe7b013de20ab8b601238c7d91b480810644" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/geo-io/interface/zipball/cf46fe7b013de20ab8b601238c7d91b480810644", + "reference": "cf46fe7b013de20ab8b601238c7d91b480810644", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "psr-4": { + "GeoIO\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com" + } + ], + "description": "Geo I/O base interfaces.", + "keywords": [ + "geo", + "geometry", + "io" + ], + "support": { + "issues": "https://github.com/geo-io/interface/issues", + "source": "https://github.com/geo-io/interface/tree/v1.0.1" + }, + "time": "2016-07-28T07:17:02+00:00" + }, + { + "name": "geo-io/wkb-parser", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/geo-io/wkb-parser.git", + "reference": "cceee8f4e8b2058f3f1a0372c930140f23fe1ee1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/geo-io/wkb-parser/zipball/cceee8f4e8b2058f3f1a0372c930140f23fe1ee1", + "reference": "cceee8f4e8b2058f3f1a0372c930140f23fe1ee1", + "shasum": "" + }, + "require": { + "geo-io/interface": "~1.0", + "php": ">=5.3.3" + }, + "require-dev": { + "mockery/mockery": "~0.9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "GeoIO\\WKB\\Parser\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com" + } + ], + "description": "Well-known binary (WKB) Parser.", + "keywords": [ + "geo", + "geometry", + "io", + "parser", + "wkb" + ], + "support": { + "issues": "https://github.com/geo-io/wkb-parser/issues", + "source": "https://github.com/geo-io/wkb-parser/tree/master" + }, + "time": "2015-06-30T04:19:13+00:00" + }, { "name": "graham-campbell/result-type", "version": "v1.0.1", @@ -558,6 +1037,68 @@ ], "time": "2020-04-13T13:17:36+00:00" }, + { + "name": "grimzy/laravel-mysql-spatial", + "version": "5.0.0", + "source": { + "type": "git", + "url": "https://github.com/grimzy/laravel-mysql-spatial.git", + "reference": "b89ed02ee4f9113a9fa952ae5f0e78bb5e82aa2a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/grimzy/laravel-mysql-spatial/zipball/b89ed02ee4f9113a9fa952ae5f0e78bb5e82aa2a", + "reference": "b89ed02ee4f9113a9fa952ae5f0e78bb5e82aa2a", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-pdo": "*", + "geo-io/wkb-parser": "^1.0", + "illuminate/database": "^8.0", + "jmikola/geojson": "^1.0", + "php": ">=7.3" + }, + "require-dev": { + "doctrine/dbal": "^2.5", + "laravel/browser-kit-testing": "^2.0", + "laravel/laravel": "^8.0", + "mockery/mockery": "^1.3", + "phpunit/phpunit": "~6.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0.x-dev" + }, + "laravel": { + "providers": [ + "Grimzy\\LaravelMysqlSpatial\\SpatialServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Grimzy\\LaravelMysqlSpatial\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Joseph Estefane", + "email": "estefanejoe@gmail.com" + } + ], + "description": "MySQL spatial data types extension for Laravel.", + "support": { + "issues": "https://github.com/grimzy/laravel-mysql-spatial/issues", + "source": "https://github.com/grimzy/laravel-mysql-spatial/tree/5.0.0" + }, + "time": "2020-10-17T07:28:10+00:00" + }, { "name": "guzzlehttp/guzzle", "version": "7.3.0", @@ -2220,6 +2761,63 @@ }, "time": "2020-11-02T14:01:41+00:00" }, + { + "name": "jmikola/geojson", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/jmikola/geojson.git", + "reference": "6ec3016cc0215667b7775f6ead7bd0337ad66eee" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/jmikola/geojson/zipball/6ec3016cc0215667b7775f6ead7bd0337ad66eee", + "reference": "6ec3016cc0215667b7775f6ead7bd0337ad66eee", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~3.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-0": { + "GeoJson\\": "src/" + }, + "classmap": [ + "stubs/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jeremy Mikola", + "email": "jmikola@gmail.com" + } + ], + "description": "GeoJSON implementation for PHP", + "homepage": "https://github.com/jmikola/geojson", + "keywords": [ + "geo", + "geojson", + "geospatial" + ], + "support": { + "issues": "https://github.com/jmikola/geojson/issues", + "source": "https://github.com/jmikola/geojson/tree/master" + }, + "time": "2015-09-27T15:35:21+00:00" + }, { "name": "laravel/lumen-framework", "version": "v8.2.1", diff --git a/database/migrations/2021_04_10_114917_create_table_storage_location.php b/database/migrations/2021_04_10_114917_create_table_storage_location.php new file mode 100644 index 0000000..07b90b9 --- /dev/null +++ b/database/migrations/2021_04_10_114917_create_table_storage_location.php @@ -0,0 +1,36 @@ +bigIncrements('id'); + $table->string('name')->notNullable(); + $table->text('description'); + $table->string('long'); + $table->string('lat'); + $table->softDeletes($column = 'deleted_at', $precision = 0); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('storagelocation'); + } +} diff --git a/database/migrations/2021_04_10_114927_create_table_inventory.php b/database/migrations/2021_04_10_114927_create_table_inventory.php new file mode 100644 index 0000000..ce22eaa --- /dev/null +++ b/database/migrations/2021_04_10_114927_create_table_inventory.php @@ -0,0 +1,38 @@ +bigIncrements('id'); + $table->bigInteger('inventoryCategoryCodeSetId')->notNullable(); + $table->string('inventoryCategoryCodeId')->notNullable(); + $table->string('name')->notNullable(); + $table->unsignedBigInteger('storagelocation_id')->notNullable(); + $table->text('description'); + $table->softDeletes($column = 'deleted_at', $precision = 0); + $table->timestamps(); + $table->foreign('storagelocation_id')->references('id')->on('storagelocation'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('inventory'); + } +} diff --git a/database/migrations/2021_04_10_115011_create_table_inventorycomment.php b/database/migrations/2021_04_10_115011_create_table_inventorycomment.php new file mode 100644 index 0000000..da2d263 --- /dev/null +++ b/database/migrations/2021_04_10_115011_create_table_inventorycomment.php @@ -0,0 +1,36 @@ +bigIncrements('id'); + $table->mediumText('comment')->notNullable(); + $table->bigInteger('user_id')->notNullable(); + $table->unsignedBigInteger('inventory_id')->notNullable(); + $table->softDeletes($column = 'deleted_at', $precision = 0); + $table->timestamps(); + $table->foreign('inventory_id')->references('id')->on('inventory'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('inventorycomment'); + } +} diff --git a/database/migrations/2021_04_10_115151_create_table_inventory_counting.php b/database/migrations/2021_04_10_115151_create_table_inventory_counting.php new file mode 100644 index 0000000..83f3554 --- /dev/null +++ b/database/migrations/2021_04_10_115151_create_table_inventory_counting.php @@ -0,0 +1,37 @@ +bigIncrements('id'); + $table->unsignedBigInteger('inventory_id')->notNullable(); + $table->dateTime('counted_at', $precision = 0); + $table->bigInteger('count')->notNullable(); + $table->bigInteger('user_id')->notNullable(); + $table->softDeletes($column = 'deleted_at', $precision = 0); + $table->timestamps(); + $table->foreign('inventory_id')->references('id')->on('inventory'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('inventorycounting'); + } +} diff --git a/routes/web.php b/routes/web.php index c0f8ac0..19abe4f 100644 --- a/routes/web.php +++ b/routes/web.php @@ -48,4 +48,25 @@ $router->post('/company/{orgno}/crew/{crew_id}/note', 'CompanyNoteController@create'); $router->put('/note/{id}', 'CompanyNoteController@update'); $router->delete('/note/{id}', 'CompanyNoteController@destroy'); + // Storage locations + $router->get('/storage', 'StorageLocationController@index'); + $router->post('/storage', 'StorageLocationController@create'); + $router->get('/storage/{id}', 'StorageLocationController@show'); + $router->put('/storage/{id}', 'StorageLocationController@update'); + $router->delete('/storage/{id}', 'StorageLocationController@destroy'); + // Inventory + $router->get('/storage/{storagelocation_id}/inventory', 'InventoryController@inventoryByLocation'); + $router->post('/storage/{storagelocation_id}/inventory', 'InventoryController@create'); + $router->get('/inventory/{id}', 'InventoryController@show'); + $router->put('/inventory/{id}', 'InventoryController@update'); + $router->delete('/inventory/{id}', 'InventoryController@destroy'); + // Inventory comment + $router->get('/inventory/{inventory_id}/comments', 'InventoryCommentController@commentsByInventory'); + $router->post('/inventory/{inventory_id}/comment', 'InventoryCommentController@create'); + $router->put('/comment/{id}', 'InventoryCommentController@update'); + $router->delete('/comment/{id}', 'InventoryCommentController@destroy'); + // Inventory count + $router->get('/inventory/{inventory_id}/count', 'InventoryCountController@countsByInventory'); + $router->post('/inventory/{inventory_id}/count', 'InventoryCountController@create'); + $router->delete('/count/{id}', 'InventoryCountController@destroy'); }); \ No newline at end of file