diff --git a/app/Actions/Fortify/CreateNewUser.php b/app/Actions/Fortify/CreateNewUser.php index 16f22b4..ae2a33d 100644 --- a/app/Actions/Fortify/CreateNewUser.php +++ b/app/Actions/Fortify/CreateNewUser.php @@ -32,7 +32,7 @@ public function create(array $input): User 'name' => $input['name'], 'username' => $input['username'], 'email' => $input['email'], - //'phone' => $input['phone'], + // 'phone' => $input['phone'], 'phone' => phone($input['phone'])->formatE164(), 'password' => Hash::make($input['password']), ]); diff --git a/app/Http/Controllers/Staff/StudiesController.php b/app/Http/Controllers/Staff/StudiesController.php index 7b71cb0..d41ff4f 100644 --- a/app/Http/Controllers/Staff/StudiesController.php +++ b/app/Http/Controllers/Staff/StudiesController.php @@ -26,7 +26,7 @@ public function details() ->on($study) ->log(); - //return view('staff.studies.details', compact('study')); + // return view('staff.studies.details', compact('study')); return response()->json($study); } } diff --git a/app/Models/StudyDetails.php b/app/Models/StudyDetails.php index 5fcc562..9c1d8c3 100644 --- a/app/Models/StudyDetails.php +++ b/app/Models/StudyDetails.php @@ -12,4 +12,12 @@ public function study(): BelongsTo { return $this->belongsTo(Study::class); } + + protected function casts() + { + return [ + 'properties' => 'array', + 'series' => 'array', + ]; + } } diff --git a/app/Models/StudySeries.php b/app/Models/StudySeries.php deleted file mode 100644 index 0060cb4..0000000 --- a/app/Models/StudySeries.php +++ /dev/null @@ -1,21 +0,0 @@ -belongsTo(Study::class); - } - - protected function casts(): array - { - return [ - 'series_date' => 'datetime', - ]; - } -} diff --git a/config/permission.php b/config/permission.php index 2a520f3..74c6402 100644 --- a/config/permission.php +++ b/config/permission.php @@ -75,8 +75,8 @@ /* * Change this if you want to name the related pivots other than defaults */ - 'role_pivot_key' => null, //default 'role_id', - 'permission_pivot_key' => null, //default 'permission_id', + 'role_pivot_key' => null, // default 'role_id', + 'permission_pivot_key' => null, // default 'permission_id', /* * Change this if you want to name the related model primary key other than diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index 08a5a99..fcbbf96 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -30,10 +30,12 @@ class UserFactory extends Factory public function definition(): array { return [ - 'name' => fake()->name(), + 'first_name' => fake()->firstName(), + 'last_name' => fake()->lastName(), + 'display_name' => fake()->name(), 'username' => fake()->unique()->userName(), 'email' => fake()->unique()->safeEmail(), - 'email_verified_at' => now(), + 'email_verified_at' => fake()->dateTime(), 'last_seen_at' => fake()->dateTime(), 'phone' => fake()->phoneNumber(), 'user_role' => static::$role ??= UserRole::Guest->value, @@ -44,6 +46,7 @@ public function definition(): array 'profile_photo_path' => null, 'current_team_id' => null, 'institute_id' => null, + 'is_active' => fake()->boolean(), ]; } diff --git a/database/migrations/0001_01_01_000000_create_users_table.php b/database/migrations/0001_01_01_000000_create_users_table.php index 1ff4679..22ce0cc 100644 --- a/database/migrations/0001_01_01_000000_create_users_table.php +++ b/database/migrations/0001_01_01_000000_create_users_table.php @@ -24,13 +24,13 @@ public function up(): void $table->string('email')->nullable()->index(); $table->timestamp('email_verified_at')->nullable(); $table->string('password'); - $table->rememberToken(); $table->unsignedTinyInteger('user_role')->default(UserRole::Guest->value); $table->foreignId('current_team_id')->nullable(); $table->string('profile_photo_path')->nullable(); $table->foreignIdFor(Institute::class)->nullable()->index(); $table->string('timezone')->default('Asia/Dhaka'); $table->timestamp('last_seen_at')->nullable(); + $table->rememberToken(); $table->timestamps(); }); diff --git a/database/migrations/2024_12_26_171058_create_permission_tables.php b/database/migrations/2024_12_26_171058_create_permission_tables.php index dcfb881..69e39ed 100644 --- a/database/migrations/2024_12_26_171058_create_permission_tables.php +++ b/database/migrations/2024_12_26_171058_create_permission_tables.php @@ -25,7 +25,7 @@ public function up(): void } Schema::create($tableNames['permissions'], function (Blueprint $table) { - //$table->engine('InnoDB'); + // $table->engine('InnoDB'); $table->bigIncrements('id'); // permission id $table->string('name'); // For MyISAM use string('name', 225); // (or 166 for InnoDB with Redundant/Compact row format) $table->string('guard_name'); // For MyISAM use string('guard_name', 25); @@ -35,7 +35,7 @@ public function up(): void }); Schema::create($tableNames['roles'], function (Blueprint $table) use ($teams, $columnNames) { - //$table->engine('InnoDB'); + // $table->engine('InnoDB'); $table->bigIncrements('id'); // role id if ($teams || config('permission.testing')) { // permission.testing is a fix for sqlite testing $table->unsignedBigInteger($columnNames['team_foreign_key'])->nullable(); diff --git a/database/migrations/2024_12_28_144858_create_study_details_table.php b/database/migrations/2024_12_28_144858_create_study_details_table.php index 728c5a9..f2bbb25 100644 --- a/database/migrations/2024_12_28_144858_create_study_details_table.php +++ b/database/migrations/2024_12_28_144858_create_study_details_table.php @@ -11,16 +11,13 @@ public function up(): void Schema::create('study_details', function (Blueprint $table) { $table->id(); $table->foreignId('study_id')->unique()->constrained('studies')->cascadeOnDelete(); - //$table->foreignId('user_id')->constrained('users'); + // $table->foreignId('user_id')->constrained('users'); $table->text('clinical_history')->nullable(); $table->text('surgical_history')->nullable(); $table->text('lab_results')->nullable(); $table->text('clinical_diagnosis')->nullable(); - $table->string('station_name')->nullable(); - $table->string('operators_name')->nullable(); - $table->string('manufacturer')->nullable(); - $table->string('manufacturer_model_name')->nullable(); - $table->string('software_versions')->nullable(); + $table->json('properties')->nullable(); + $table->json('series')->nullable(); $table->timestamps(); }); } diff --git a/database/migrations/2024_12_30_130820_create_study_series_table.php b/database/migrations/2024_12_30_130820_create_study_series_table.php deleted file mode 100644 index 69b1449..0000000 --- a/database/migrations/2024_12_30_130820_create_study_series_table.php +++ /dev/null @@ -1,33 +0,0 @@ -id(); - $table->foreignId('study_id')->constrained('studies')->cascadeOnDelete(); - $table->string('orthanc_uid')->unique(); - $table->dateTime('series_date'); - $table->string('series_instance_uid')->nullable(); - $table->string('body_part_examined')->nullable(); - $table->string('series_description')->nullable(); - $table->string('modality', 4)->nullable(); - $table->string('series_number')->nullable(); - $table->string('protocol_name')->nullable(); - $table->string('sequence_name')->nullable(); - $table->string('performed_procedure_step_description')->nullable(); - $table->unsignedSmallInteger('num_instances')->nullable(); - $table->timestamps(); - }); - } - - public function down(): void - { - Schema::dropIfExists('study_series'); - } -}; diff --git a/database/seeders/UserSeeder.php b/database/seeders/UserSeeder.php index e1d428f..7f5ad76 100644 --- a/database/seeders/UserSeeder.php +++ b/database/seeders/UserSeeder.php @@ -14,9 +14,12 @@ public function run(): void // User::factory(10)->create(); User::factory()->create([ - 'name' => 'Administrator', + 'first_name' => 'Administrator', + 'display_name' => 'Administrator', 'username' => 'admin', 'email' => 'test@example.com', + 'email_verified_at' => now(), + 'phone' => '+8801733938582', 'user_role' => UserRole::Admin->value, ]);