diff --git a/app/Http/Requests/StudySeriesRequest.php b/app/Http/Requests/StudySeriesRequest.php new file mode 100644 index 0000000..ebacfcb --- /dev/null +++ b/app/Http/Requests/StudySeriesRequest.php @@ -0,0 +1,24 @@ + ['required', 'exists:studies'], + 'body_part_examined' => ['nullable'], + 'series_description' => ['nullable'], + 'series_date' => ['nullable', 'date'], + 'series_number' => ['required'], + ]; + } + + public function authorize(): bool + { + return true; + } +} diff --git a/app/Http/Resources/StudySeriesResource.php b/app/Http/Resources/StudySeriesResource.php new file mode 100644 index 0000000..7acaf32 --- /dev/null +++ b/app/Http/Resources/StudySeriesResource.php @@ -0,0 +1,26 @@ + $this->id, + 'body_part_examined' => $this->body_part_examined, + 'series_description' => $this->series_description, + 'series_date' => $this->series_date, + 'series_number' => $this->series_number, + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, + + 'study_id' => $this->study_id, + ]; + } +} diff --git a/app/Models/StudySeries.php b/app/Models/StudySeries.php new file mode 100644 index 0000000..0060cb4 --- /dev/null +++ b/app/Models/StudySeries.php @@ -0,0 +1,21 @@ +belongsTo(Study::class); + } + + protected function casts(): array + { + return [ + 'series_date' => 'datetime', + ]; + } +} diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index 9fc5606..0141493 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -35,7 +35,7 @@ public function definition(): array 'email' => fake()->unique()->safeEmail(), 'email_verified_at' => now(), 'phone' => fake()->phoneNumber(), - 'role' => static::$role ??= UserRole::Technician->value, + 'user_role' => static::$role ??= UserRole::Guest->value, 'password' => static::$password ??= Hash::make('password'), 'two_factor_secret' => null, 'two_factor_recovery_codes' => null, 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 5b75906..ff26ead 100644 --- a/database/migrations/0001_01_01_000000_create_users_table.php +++ b/database/migrations/0001_01_01_000000_create_users_table.php @@ -26,7 +26,6 @@ public function up(): void $table->foreignId('current_team_id')->nullable(); $table->string('profile_photo_path')->nullable(); $table->foreignIdFor(Institute::class)->nullable()->index(); - $table->string('avatar')->nullable(); $table->string('timezone')->default('Asia/Dhaka'); $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 new file mode 100644 index 0000000..69b1449 --- /dev/null +++ b/database/migrations/2024_12_30_130820_create_study_series_table.php @@ -0,0 +1,33 @@ +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 a45f00b..e1d428f 100644 --- a/database/seeders/UserSeeder.php +++ b/database/seeders/UserSeeder.php @@ -17,7 +17,7 @@ public function run(): void 'name' => 'Administrator', 'username' => 'admin', 'email' => 'test@example.com', - 'role' => UserRole::Admin->value, + 'user_role' => UserRole::Admin->value, ]); $chevron = Institute::where('name', 'Chevron')->first(); @@ -25,12 +25,18 @@ public function run(): void User::factory(2)->create([ 'institute_id' => $chevron->id, - 'role' => UserRole::Technician->value, + 'user_role' => UserRole::Technician->value, ]); User::factory(2)->create([ 'institute_id' => $srini->id, - 'role' => UserRole::Technician->value, + 'user_role' => UserRole::Technician->value, ]); + + User::factory(2)->create([ + 'user_role' => UserRole::Radiologist->value, + ]); + + User::factory(4)->create(); } }