From fd99454b454c011f3b0e6189531a64adfff268a1 Mon Sep 17 00:00:00 2001 From: MD ARIFUL HAQUE Date: Mon, 20 Nov 2023 00:04:23 +0600 Subject: [PATCH 1/5] LP-15 user status route create --- routes/api.php | 1 + 1 file changed, 1 insertion(+) diff --git a/routes/api.php b/routes/api.php index 57f9a56..b16610f 100644 --- a/routes/api.php +++ b/routes/api.php @@ -53,6 +53,7 @@ ->name('verify-otp'); Route::middleware(config('fintech.auth.middleware'))->group(function () { + Route::get('users/user-status', [UserController::class, 'userStatus'])->name('users.user-status'); Route::apiResource('users', UserController::class); Route::post('users/{user}/restore', [UserController::class, 'restore'])->name('users.restore'); Route::post('users/{user}/reset/{field}', [UserController::class, 'reset']) From f6f0b0efd8eaec68cbd8de2a0ee18478fcd7d10e Mon Sep 17 00:00:00 2001 From: MD ARIFUL HAQUE Date: Mon, 20 Nov 2023 00:04:57 +0600 Subject: [PATCH 2/5] LP-15 userStatus method create --- src/Http/Controllers/UserController.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Http/Controllers/UserController.php b/src/Http/Controllers/UserController.php index 48d5d02..e08196f 100644 --- a/src/Http/Controllers/UserController.php +++ b/src/Http/Controllers/UserController.php @@ -11,6 +11,7 @@ use Fintech\Auth\Http\Requests\UserAuthResetRequest; use Fintech\Auth\Http\Resources\UserCollection; use Fintech\Auth\Http\Resources\UserResource; +use Fintech\Core\Enums\Auth\UserStatus; use Fintech\Core\Exceptions\DeleteOperationException; use Fintech\Core\Exceptions\RestoreOperationException; use Fintech\Core\Exceptions\StoreOperationException; @@ -323,4 +324,18 @@ public function reset(string|int $id, string $field, UserAuthResetRequest $reque return $this->failed($exception->getMessage()); } } + + /** + * @return array + */ + public function userStatus(): array + { + $userStatus = UserStatus::cases(); + $array = []; + foreach($userStatus as $case) { + $array[$case->value] = $case->name; + } + return $array; + + } } From 62bbf2d2f5cfc63268136a585effcc54ee95ea31 Mon Sep 17 00:00:00 2001 From: MD ARIFUL HAQUE Date: Mon, 20 Nov 2023 00:20:41 +0600 Subject: [PATCH 3/5] LP-15 status add --- src/Services/UserService.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Services/UserService.php b/src/Services/UserService.php index a2c3742..5cee27f 100644 --- a/src/Services/UserService.php +++ b/src/Services/UserService.php @@ -6,6 +6,7 @@ use Fintech\Auth\Interfaces\ProfileRepository; use Fintech\Auth\Interfaces\UserRepository; use Fintech\Core\Enums\Auth\PasswordResetOption; +use Fintech\Core\Enums\Auth\UserStatus; use Illuminate\Support\Facades\Config; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Hash; @@ -101,6 +102,10 @@ private function formatDataFromInput($inputs, bool $forCreate = false) : $inputs['roles']; } + if (isset($data['status']) && !empty($data['status'])) { + $data['status'] = $data['status'] ?? UserStatus::Registered->value; + } + return $data; } From 703de1921f87741fccd688875be23b5a77eae13e Mon Sep 17 00:00:00 2001 From: MD ARIFUL HAQUE Date: Mon, 20 Nov 2023 00:22:46 +0600 Subject: [PATCH 4/5] LP-15 status validation rules add --- src/Http/Requests/StoreUserRequest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Http/Requests/StoreUserRequest.php b/src/Http/Requests/StoreUserRequest.php index a2159da..d307e5c 100644 --- a/src/Http/Requests/StoreUserRequest.php +++ b/src/Http/Requests/StoreUserRequest.php @@ -66,6 +66,7 @@ public function rules(): array 'present_country_id' => ['integer', 'nullable'], 'present_post_code' => ['string', 'nullable'], 'nationality' => ['string', 'nullable'], + 'status' => ['string', 'nullable'], ]); $rules[config('fintech.auth.auth_field', 'login_id')] = config('fintech.auth.auth_field_rules', ['required', 'string', 'min:6', 'max:255']); From 88ded04f7b4d5698b333cea6ed057bff10875126 Mon Sep 17 00:00:00 2001 From: hafijul233 Date: Sun, 19 Nov 2023 21:53:03 +0000 Subject: [PATCH 5/5] Fix styling --- routes/api.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routes/api.php b/routes/api.php index 1fba9a1..22deff3 100644 --- a/routes/api.php +++ b/routes/api.php @@ -83,7 +83,7 @@ Route::prefix('dropdown')->name('auth.')->group(function () { Route::get('id-doc-types', [IdDocTypeController::class, 'dropdown'])->name('id-doc-types.dropdown'); Route::get('roles', [RoleController::class, 'dropdown'])->name('roles.dropdown'); -// Route::get('teams', [\Fintech\Auth\Http\Controllers\TeamController::class, 'dropdown'])->name('teams.dropdown'); + // Route::get('teams', [\Fintech\Auth\Http\Controllers\TeamController::class, 'dropdown'])->name('teams.dropdown'); Route::get('users', [UserController::class, 'dropdown'])->name('users.dropdown'); Route::get('user-statuses', [UserController::class, 'statusDropdown'])->name('user-statuses.dropdown'); Route::get('proof-of-addresses', [UserController::class, 'proofOfAddressDropdown'])->name('user-proof-of-address.dropdown');