Skip to content

Commit

Permalink
Merge branch 'main' into LP-102-registration-test-case
Browse files Browse the repository at this point in the history
  • Loading branch information
mah-shamim authored Oct 14, 2023
2 parents 6a9e737 + d63330a commit 0663d6c
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 125 deletions.
26 changes: 24 additions & 2 deletions database/migrations/2014_10_12_000000_create_users_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,36 @@
*/
public function up(): void
{
if (Schema::hasTable('users')) {
throw new \ErrorException('`users` table already exists. please remove migration file and backup user data.');
}

Schema::create('users', function (Blueprint $table) {
$table->id();
$table->foreignId('parent_id')->nullable()->constrained('users');
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('mobile')->nullable();
$table->string('email')->nullable();
$table->string('login_id')->unique();
$table->string('password');
$table->unsignedSmallInteger('wrong_password')->default(0);
$table->string('pin')->nullable();
$table->unsignedSmallInteger('wrong_pin')->default(0);
$table->string('status')->nullable();
$table->string('language')->nullable();
$table->string('currency')->nullable();
$table->string('app_version')->default('1.0.0')->nullable();
$table->rememberToken();
$table->string('fcm_token')->nullable();
$table->foreignId('creator_id')->nullable();
$table->foreignId('editor_id')->nullable();
$table->foreignId('destroyer_id')->nullable();
$table->foreignId('restorer_id')->nullable();
$table->timestamps();
$table->softDeletes();
$table->timestamp('restored_at')->nullable();
$table->timestamp('email_verified_at')->nullable();
$table->timestamp('mobile_verified_at')->nullable();
});
}

Expand Down

This file was deleted.

52 changes: 0 additions & 52 deletions src/Http/Requests/ImportProfileRequest.php

This file was deleted.

77 changes: 77 additions & 0 deletions src/Http/Resources/ProfileResource.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?php

namespace Fintech\Auth\Http\Resources;

use Carbon\Carbon;
use Fintech\Auth\Models\Profile;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
use Illuminate\Support\Collection;

/**
* Class ProfileResource
* @package Fintech\Auth\Http\Resources
*
* @property-read mixed $user_profile_data
* @property-read string $id_type
* @property-read string|int $id_no
* @property-read string $id_issue_country
* @property-read Carbon $id_expired_at
* @property-read Carbon $id_issue_at
* @property-read bool $id_no_duplicate
* @property-read Carbon $date_of_birth
* @property-read string $app_version
* @property-read float $total_balance
* @property-read Collection $roles
* @property-read Profile|null $profile
* @property-read Carbon $email_verified_at
* @property-read Carbon $mobile_verified_at
* @property-read Carbon $created_at
* @property-read Carbon $updated_at
*/
class ProfileResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param Request
* @return array
*/
public function toArray($request)
{
$this->resource->load([
'country', 'state', 'city',
'presentCountry', 'presentState', 'presentCity',
]);

return [
'user_profile_data' => $this->user_profile_data ?? null,
'id_type' => $this->id_type ?? null,
'id_no' => $this->id_no ?? null,
'id_issue_country' => $this->id_issue_country ?? null,
'id_expired_at' => $this->id_expired_at ?? null,
'id_issue_at' => $this->id_issue_at ?? null,
'id_no_duplicate' => $this->id_no_duplicate ?? null,
'date_of_birth' => $this->date_of_birth ?? null,
'address' => $this->permanent_address ?? null,
'city_id' => $this->city_id ?? null,
'city_name' => $this->city->name ?? null,
'state_id' => $this->state_id ?? null,
'state_name' => $this->state->name ?? null,
'country_id' => $this->country_id ?? null,
'country_name' => $this->country->name ?? null,
'post_code' => $this->post_code ?? null,
'present_address' => $this->present_address ?? null,
'present_city_id' => $this->present_city_id ?? null,
'present_city_name' => $this->presentCity->name ?? null,
'present_state_id' => $this->present_state_id ?? null,
'present_state_name' => $this->presentState->name ?? null,
'present_country_id' => $this->present_country_id ?? null,
'present_country_name' => $this->presentCountry->name ?? null,
'present_post_code' => $this->present_post_code ?? null,
'blacklisted' => $this->blacklisted ?? null,
'created_at' => $this->created_at ?? null,
'updated_at' => $this->updated_at ?? null,
];
}
}
3 changes: 2 additions & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public function getEnvironmentSetUp($app)

$migrations = [
include __DIR__ . '/../database/migrations/2014_10_12_000000_create_users_table.php',
include __DIR__ . '/../database/migrations/2023_09_25_201631_create_user_profiles_table.php',
include __DIR__ . '/../database/migrations/2023_09_25_201621_update_add_columns_in_users_table.php',
include __DIR__ . '/../database/migrations/2023_09_25_201631_create_profiles_table.php',
include __DIR__ . '/../database/migrations/2023_09_28_224955_create_permission_tables.php',
include __DIR__ . '/../database/migrations/2023_09_28_230630_create_teams_table.php'
];
Expand Down

0 comments on commit 0663d6c

Please sign in to comment.