Browse Source

Update: Api mobile

master
unknown 1 year ago
parent
commit
b6076c50bc
  1. 2
      app/Http/Controllers/API/v1/AssetStatusApi/AssetStatusApiController.php
  2. 29
      app/Http/Controllers/API/v1/PeminjamanApi/PeminjamanApiController.php
  3. 21
      app/Http/Controllers/API/v1/WarehouseApi/WarehouseApiController.php
  4. 5
      app/Models/asset_status.php
  5. 3
      composer.json
  6. 220
      composer.lock
  7. 2873
      package-lock.json
  8. 10
      routes/api.php

2
app/Http/Controllers/API/v1/AssetStatusApi/AssetStatusApiController.php

@ -10,7 +10,7 @@ class AssetStatusApiController extends Controller
{
public function index()
{
$m_asset = \App\Models\m_asset::with(['warehouse'])->get();
$m_asset = \App\Models\Peti::with(['warehouse', 'tipe_peti', 'customer'])->get();
return ResponseFormatter::success([
'message' => 'Data asset berhasil diambil',

29
app/Http/Controllers/API/v1/PeminjamanApi/PeminjamanApiController.php

@ -12,26 +12,35 @@ class PeminjamanApiController extends Controller
{
public function index()
{
$peminjaman = \App\Models\asset_status::with(['asset', 'warehouse'])->get();
$peminjaman = \App\Models\asset_status::with(['peti.customer', 'peti.tipe_peti', 'warehouse'])->get();
return ResponseFormatter::success([
'message' => 'Data peminjaman berhasil diambil',
'peminjam' => $peminjaman
'asset_status' => $peminjaman
]);
}
public function store(Request $request)
public function show($id)
{
$this->validate($request, [
'asset_id' => 'required',
'exit_at' => 'required',
'exit_pic' => 'required',
'exit_warehouse' => 'required',
$peminjaman = asset_status::with(['peti', 'warehouse'])->find($id);
return ResponseFormatter::success([
'message' => 'Data peminjaman berhasil diambil ID',
'asset_status' => $peminjaman
]);
}
$data = $request->all();
public function store(Request $request)
{
$peminjaman = asset_status::create($data);
$peminjaman = asset_status::create([
'asset_id' => $request->asset_id,
'exit_at' => $request->exit_at,
'exit_pic' => $request->exit_pic,
'exit_warehouse' => $request->exit_warehouse,
'created_by' => $request->created_by,
'updated_by' => $request->updated_by,
]);
return ResponseFormatter::success([
'message' => 'Data peminjaman berhasil ditambahkan',

21
app/Http/Controllers/API/v1/WarehouseApi/WarehouseApiController.php

@ -0,0 +1,21 @@
<?php
namespace App\Http\Controllers\API\v1\WarehouseApi;
use Illuminate\Http\Request;
use App\Helpers\ResponseFormatter;
use App\Http\Controllers\Controller;
class WarehouseApiController extends Controller
{
public function index()
{
$warehouse = \App\Models\m_warehouse::all();
return ResponseFormatter::success([
'status' => true,
'message' => 'Data warehouse berhasil diambil',
'warehouse' => $warehouse
]);
}
}

5
app/Models/asset_status.php

@ -2,8 +2,11 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use App\Models\Peti;
use App\Models\Customer;
use App\Models\Type_peti;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class asset_status extends Model
{

3
composer.json

@ -14,8 +14,7 @@
"laravel/tinker": "^2.8",
"maatwebsite/excel": "^3.1",
"php-open-source-saver/jwt-auth": "^2.1",
"simplesoftwareio/simple-qrcode": "^4.2",
"tymon/jwt-auth": "^2.0"
"simplesoftwareio/simple-qrcode": "^4.2"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",

220
composer.lock generated

@ -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": "77a43e24a271e47f5d39a109b78e09c6",
"content-hash": "37f98cab1d340231d5d4d9764bef781d",
"packages": [
{
"name": "bacon/bacon-qr-code",
@ -1811,20 +1811,20 @@
},
{
"name": "lcobucci/clock",
"version": "3.1.0",
"version": "3.0.0",
"source": {
"type": "git",
"url": "https://github.com/lcobucci/clock.git",
"reference": "30a854ceb22bd87d83a7a4563b3f6312453945fc"
"reference": "039ef98c6b57b101d10bd11d8fdfda12cbd996dc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/lcobucci/clock/zipball/30a854ceb22bd87d83a7a4563b3f6312453945fc",
"reference": "30a854ceb22bd87d83a7a4563b3f6312453945fc",
"url": "https://api.github.com/repos/lcobucci/clock/zipball/039ef98c6b57b101d10bd11d8fdfda12cbd996dc",
"reference": "039ef98c6b57b101d10bd11d8fdfda12cbd996dc",
"shasum": ""
},
"require": {
"php": "~8.2.0",
"php": "~8.1.0 || ~8.2.0",
"psr/clock": "^1.0"
},
"provide": {
@ -1832,13 +1832,13 @@
},
"require-dev": {
"infection/infection": "^0.26",
"lcobucci/coding-standard": "^10.0.0",
"lcobucci/coding-standard": "^9.0",
"phpstan/extension-installer": "^1.2",
"phpstan/phpstan": "^1.10.7",
"phpstan/phpstan-deprecation-rules": "^1.1.3",
"phpstan/phpstan-phpunit": "^1.3.10",
"phpstan/phpstan-strict-rules": "^1.5.0",
"phpunit/phpunit": "^10.0.17"
"phpstan/phpstan": "^1.9.4",
"phpstan/phpstan-deprecation-rules": "^1.1.1",
"phpstan/phpstan-phpunit": "^1.3.2",
"phpstan/phpstan-strict-rules": "^1.4.4",
"phpunit/phpunit": "^9.5.27"
},
"type": "library",
"autoload": {
@ -1859,7 +1859,7 @@
"description": "Yet another clock abstraction",
"support": {
"issues": "https://github.com/lcobucci/clock/issues",
"source": "https://github.com/lcobucci/clock/tree/3.1.0"
"source": "https://github.com/lcobucci/clock/tree/3.0.0"
},
"funding": [
{
@ -1871,7 +1871,7 @@
"type": "patreon"
}
],
"time": "2023-03-20T19:12:25+00:00"
"time": "2022-12-19T15:00:24+00:00"
},
{
"name": "lcobucci/jwt",
@ -2343,16 +2343,16 @@
},
{
"name": "maatwebsite/excel",
"version": "3.1.48",
"version": "3.1.49",
"source": {
"type": "git",
"url": "https://github.com/SpartnerNL/Laravel-Excel.git",
"reference": "6d0fe2a1d195960c7af7bf0de760582da02a34b9"
"reference": "769209f49ebe3419017114f98bd61e2a7d9af259"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/SpartnerNL/Laravel-Excel/zipball/6d0fe2a1d195960c7af7bf0de760582da02a34b9",
"reference": "6d0fe2a1d195960c7af7bf0de760582da02a34b9",
"url": "https://api.github.com/repos/SpartnerNL/Laravel-Excel/zipball/769209f49ebe3419017114f98bd61e2a7d9af259",
"reference": "769209f49ebe3419017114f98bd61e2a7d9af259",
"shasum": ""
},
"require": {
@ -2407,7 +2407,7 @@
],
"support": {
"issues": "https://github.com/SpartnerNL/Laravel-Excel/issues",
"source": "https://github.com/SpartnerNL/Laravel-Excel/tree/3.1.48"
"source": "https://github.com/SpartnerNL/Laravel-Excel/tree/3.1.49"
},
"funding": [
{
@ -2419,7 +2419,7 @@
"type": "github"
}
],
"time": "2023-02-22T21:01:38+00:00"
"time": "2023-10-26T09:01:33+00:00"
},
{
"name": "maennchen/zipstream-php",
@ -2678,16 +2678,16 @@
},
{
"name": "monolog/monolog",
"version": "3.4.0",
"version": "3.5.0",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/monolog.git",
"reference": "e2392369686d420ca32df3803de28b5d6f76867d"
"reference": "c915e2634718dbc8a4a15c61b0e62e7a44e14448"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/e2392369686d420ca32df3803de28b5d6f76867d",
"reference": "e2392369686d420ca32df3803de28b5d6f76867d",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/c915e2634718dbc8a4a15c61b0e62e7a44e14448",
"reference": "c915e2634718dbc8a4a15c61b0e62e7a44e14448",
"shasum": ""
},
"require": {
@ -2763,7 +2763,7 @@
],
"support": {
"issues": "https://github.com/Seldaek/monolog/issues",
"source": "https://github.com/Seldaek/monolog/tree/3.4.0"
"source": "https://github.com/Seldaek/monolog/tree/3.5.0"
},
"funding": [
{
@ -2775,7 +2775,7 @@
"type": "tidelift"
}
],
"time": "2023-06-21T08:46:11+00:00"
"time": "2023-10-27T15:32:31+00:00"
},
{
"name": "namshi/jose",
@ -3014,16 +3014,16 @@
},
{
"name": "nette/utils",
"version": "v4.0.2",
"version": "v4.0.3",
"source": {
"type": "git",
"url": "https://github.com/nette/utils.git",
"reference": "cead6637226456b35e1175cc53797dd585d85545"
"reference": "a9d127dd6a203ce6d255b2e2db49759f7506e015"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nette/utils/zipball/cead6637226456b35e1175cc53797dd585d85545",
"reference": "cead6637226456b35e1175cc53797dd585d85545",
"url": "https://api.github.com/repos/nette/utils/zipball/a9d127dd6a203ce6d255b2e2db49759f7506e015",
"reference": "a9d127dd6a203ce6d255b2e2db49759f7506e015",
"shasum": ""
},
"require": {
@ -3094,9 +3094,9 @@
],
"support": {
"issues": "https://github.com/nette/utils/issues",
"source": "https://github.com/nette/utils/tree/v4.0.2"
"source": "https://github.com/nette/utils/tree/v4.0.3"
},
"time": "2023-09-19T11:58:07+00:00"
"time": "2023-10-29T21:02:13+00:00"
},
{
"name": "nikic/php-parser",
@ -4960,16 +4960,16 @@
},
{
"name": "symfony/http-foundation",
"version": "v6.3.6",
"version": "v6.3.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-foundation.git",
"reference": "c186627f52febe09c6d5270b04f8462687a250a6"
"reference": "59d1837d5d992d16c2628cd0d6b76acf8d69b33e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/c186627f52febe09c6d5270b04f8462687a250a6",
"reference": "c186627f52febe09c6d5270b04f8462687a250a6",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/59d1837d5d992d16c2628cd0d6b76acf8d69b33e",
"reference": "59d1837d5d992d16c2628cd0d6b76acf8d69b33e",
"shasum": ""
},
"require": {
@ -5017,7 +5017,7 @@
"description": "Defines an object-oriented layer for the HTTP specification",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/http-foundation/tree/v6.3.6"
"source": "https://github.com/symfony/http-foundation/tree/v6.3.7"
},
"funding": [
{
@ -5033,20 +5033,20 @@
"type": "tidelift"
}
],
"time": "2023-10-17T11:32:53+00:00"
"time": "2023-10-28T23:55:27+00:00"
},
{
"name": "symfony/http-kernel",
"version": "v6.3.6",
"version": "v6.3.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-kernel.git",
"reference": "4945f5001b06ff9080cd3d8f1f9f069094c0d156"
"reference": "6d4098095f93279d9536a0e9124439560cc764d0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/4945f5001b06ff9080cd3d8f1f9f069094c0d156",
"reference": "4945f5001b06ff9080cd3d8f1f9f069094c0d156",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/6d4098095f93279d9536a0e9124439560cc764d0",
"reference": "6d4098095f93279d9536a0e9124439560cc764d0",
"shasum": ""
},
"require": {
@ -5130,7 +5130,7 @@
"description": "Provides a structured process for converting a Request into a Response",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/http-kernel/tree/v6.3.6"
"source": "https://github.com/symfony/http-kernel/tree/v6.3.7"
},
"funding": [
{
@ -5146,7 +5146,7 @@
"type": "tidelift"
}
],
"time": "2023-10-21T13:12:51+00:00"
"time": "2023-10-29T14:31:45+00:00"
},
{
"name": "symfony/mailer",
@ -6432,16 +6432,16 @@
},
{
"name": "symfony/translation",
"version": "v6.3.6",
"version": "v6.3.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation.git",
"reference": "869b26c7a9d4b8a48afdd77ab36031909c87e3a2"
"reference": "30212e7c87dcb79c83f6362b00bde0e0b1213499"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/translation/zipball/869b26c7a9d4b8a48afdd77ab36031909c87e3a2",
"reference": "869b26c7a9d4b8a48afdd77ab36031909c87e3a2",
"url": "https://api.github.com/repos/symfony/translation/zipball/30212e7c87dcb79c83f6362b00bde0e0b1213499",
"reference": "30212e7c87dcb79c83f6362b00bde0e0b1213499",
"shasum": ""
},
"require": {
@ -6507,7 +6507,7 @@
"description": "Provides tools to internationalize your application",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/translation/tree/v6.3.6"
"source": "https://github.com/symfony/translation/tree/v6.3.7"
},
"funding": [
{
@ -6523,7 +6523,7 @@
"type": "tidelift"
}
],
"time": "2023-10-17T11:32:53+00:00"
"time": "2023-10-28T23:11:45+00:00"
},
{
"name": "symfony/translation-contracts",
@ -6814,90 +6814,6 @@
},
"time": "2023-01-03T09:29:04+00:00"
},
{
"name": "tymon/jwt-auth",
"version": "2.0.0",
"source": {
"type": "git",
"url": "https://github.com/tymondesigns/jwt-auth.git",
"reference": "b0868a5b00801889a9e0c81a737963d8004e708c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/tymondesigns/jwt-auth/zipball/b0868a5b00801889a9e0c81a737963d8004e708c",
"reference": "b0868a5b00801889a9e0c81a737963d8004e708c",
"shasum": ""
},
"require": {
"illuminate/auth": "^9.0|^10.0",
"illuminate/contracts": "^9.0|^10.0",
"illuminate/http": "^9.0|^10.0",
"illuminate/support": "^9.0|^10.0",
"lcobucci/jwt": "^4.0",
"nesbot/carbon": "^2.0",
"php": "^8.0"
},
"require-dev": {
"illuminate/console": "^9.0|^10.0",
"illuminate/database": "^9.0|^10.0",
"illuminate/routing": "^9.0|^10.0",
"mockery/mockery": ">=0.9.9",
"phpunit/phpunit": "^9.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-develop": "1.0-dev",
"dev-2.x": "2.0-dev"
},
"laravel": {
"aliases": {
"JWTAuth": "Tymon\\JWTAuth\\Facades\\JWTAuth",
"JWTFactory": "Tymon\\JWTAuth\\Facades\\JWTFactory"
},
"providers": [
"Tymon\\JWTAuth\\Providers\\LaravelServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Tymon\\JWTAuth\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Sean Tymon",
"email": "tymon148@gmail.com",
"homepage": "https://tymon.xyz",
"role": "Developer"
}
],
"description": "JSON Web Token Authentication for Laravel and Lumen",
"homepage": "https://github.com/tymondesigns/jwt-auth",
"keywords": [
"Authentication",
"JSON Web Token",
"auth",
"jwt",
"laravel"
],
"support": {
"issues": "https://github.com/tymondesigns/jwt-auth/issues",
"source": "https://github.com/tymondesigns/jwt-auth"
},
"funding": [
{
"url": "https://www.patreon.com/seantymon",
"type": "patreon"
}
],
"time": "2023-02-16T16:29:41+00:00"
},
{
"name": "vlucas/phpdotenv",
"version": "v5.5.0",
@ -7370,16 +7286,16 @@
},
{
"name": "laravel/pint",
"version": "v1.13.4",
"version": "v1.13.5",
"source": {
"type": "git",
"url": "https://github.com/laravel/pint.git",
"reference": "428c1eae1be4d2994c88234ffe3fea6800532e0d"
"reference": "df105cf8ce7a8f0b8a9425ff45cd281a5448e423"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/pint/zipball/428c1eae1be4d2994c88234ffe3fea6800532e0d",
"reference": "428c1eae1be4d2994c88234ffe3fea6800532e0d",
"url": "https://api.github.com/repos/laravel/pint/zipball/df105cf8ce7a8f0b8a9425ff45cd281a5448e423",
"reference": "df105cf8ce7a8f0b8a9425ff45cd281a5448e423",
"shasum": ""
},
"require": {
@ -7432,7 +7348,7 @@
"issues": "https://github.com/laravel/pint/issues",
"source": "https://github.com/laravel/pint"
},
"time": "2023-10-24T15:44:13+00:00"
"time": "2023-10-26T09:26:10+00:00"
},
{
"name": "laravel/sail",
@ -8173,16 +8089,16 @@
},
{
"name": "phpunit/phpunit",
"version": "10.4.1",
"version": "10.4.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "62bd7af13d282deeb95650077d28ba3600ca321c"
"reference": "cacd8b9dd224efa8eb28beb69004126c7ca1a1a1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/62bd7af13d282deeb95650077d28ba3600ca321c",
"reference": "62bd7af13d282deeb95650077d28ba3600ca321c",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/cacd8b9dd224efa8eb28beb69004126c7ca1a1a1",
"reference": "cacd8b9dd224efa8eb28beb69004126c7ca1a1a1",
"shasum": ""
},
"require": {
@ -8254,7 +8170,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
"source": "https://github.com/sebastianbergmann/phpunit/tree/10.4.1"
"source": "https://github.com/sebastianbergmann/phpunit/tree/10.4.2"
},
"funding": [
{
@ -8270,7 +8186,7 @@
"type": "tidelift"
}
],
"time": "2023-10-08T05:01:11+00:00"
"time": "2023-10-26T07:21:45+00:00"
},
{
"name": "sebastian/cli-parser",
@ -9496,16 +9412,16 @@
},
{
"name": "symfony/yaml",
"version": "v6.3.3",
"version": "v6.3.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
"reference": "e23292e8c07c85b971b44c1c4b87af52133e2add"
"reference": "9758b6c69d179936435d0ffb577c3708d57e38a8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/e23292e8c07c85b971b44c1c4b87af52133e2add",
"reference": "e23292e8c07c85b971b44c1c4b87af52133e2add",
"url": "https://api.github.com/repos/symfony/yaml/zipball/9758b6c69d179936435d0ffb577c3708d57e38a8",
"reference": "9758b6c69d179936435d0ffb577c3708d57e38a8",
"shasum": ""
},
"require": {
@ -9548,7 +9464,7 @@
"description": "Loads and dumps YAML files",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/yaml/tree/v6.3.3"
"source": "https://github.com/symfony/yaml/tree/v6.3.7"
},
"funding": [
{
@ -9564,7 +9480,7 @@
"type": "tidelift"
}
],
"time": "2023-07-31T07:08:24+00:00"
"time": "2023-10-28T23:31:00+00:00"
},
{
"name": "theseer/tokenizer",
@ -9626,5 +9542,5 @@
"php": "^8.1"
},
"platform-dev": [],
"plugin-api-version": "2.6.0"
"plugin-api-version": "2.3.0"
}

2873
package-lock.json generated

File diff suppressed because it is too large Load Diff

10
routes/api.php

@ -24,8 +24,14 @@ Route::prefix('v1')->group(function () {
Route::post('/logout', App\Http\Controllers\API\v1\AuthApi\LogoutApiController::class)->name('logout');
Route::put('/user/edit', App\Http\Controllers\API\v1\AuthApi\EditApiController::class)->name('user.edit');
Route::get('/peminjaman-barang', [App\Http\Controllers\API\v1\PeminjamanApi\PeminjamanApiController::class, 'index'])->name('peminjaman-barang');
Route::get('/m-asset', [App\Http\Controllers\API\v1\AssetStatusApi\AssetStatusApiController::class, 'index'])->name('status.barang');
Route::get('/asset-status', [App\Http\Controllers\API\v1\PeminjamanApi\PeminjamanApiController::class, 'index'])->name('peminjaman-barang');
Route::post('/asset-status/store', [App\Http\Controllers\API\v1\PeminjamanApi\PeminjamanApiController::class, 'store'])->name('peminjaman-barang.store');
Route::get('/asset-status/show/{id}', [App\Http\Controllers\API\v1\PeminjamanApi\PeminjamanApiController::class, 'show'])->name('peminjaman-barang.show');
Route::get('/peti-asset', [App\Http\Controllers\API\v1\AssetStatusApi\AssetStatusApiController::class, 'index'])->name('peti.barang');
Route::get('/m-warehouse', [App\Http\Controllers\API\v1\WarehouseApi\WarehouseApiController::class, 'index'])->name('warehouse');
});
Route::middleware('auth:sanctum')->get('/user', function (Request $request) {

Loading…
Cancel
Save