From 2e2b30cc13ecddfd743bca677bb28c8a6285dec7 Mon Sep 17 00:00:00 2001 From: Masroor Ehsan Date: Tue, 31 Dec 2024 13:56:54 +0600 Subject: [PATCH] wip --- app/Models/Facility.php | 21 +++++++++++++++ app/Models/OrthancHost.php | 7 +++++ config/app.php | 4 +++ ...0_00_00_163912_create_institutes_table.php | 2 ++ ...0_01_31_075136_create_facilities_table.php | 26 ++++++++++++++++++ .../0001_01_01_000000_create_users_table.php | 2 ++ ...2024_12_27_060234_create_studies_table.php | 4 ++- ...2_31_074312_create_orthanc_hosts_table.php | 27 +++++++++++++++++++ 8 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 app/Models/Facility.php create mode 100644 app/Models/OrthancHost.php create mode 100644 database/migrations/0000_01_31_075136_create_facilities_table.php create mode 100644 database/migrations/2024_12_31_074312_create_orthanc_hosts_table.php diff --git a/app/Models/Facility.php b/app/Models/Facility.php new file mode 100644 index 0000000..03bbcd1 --- /dev/null +++ b/app/Models/Facility.php @@ -0,0 +1,21 @@ +belongsTo(Institute::class); + } + + protected function casts(): array + { + return [ + 'is_active' => 'boolean', + ]; + } +} diff --git a/app/Models/OrthancHost.php b/app/Models/OrthancHost.php new file mode 100644 index 0000000..a0e4ab2 --- /dev/null +++ b/app/Models/OrthancHost.php @@ -0,0 +1,7 @@ + env('APP_MAINTENANCE_STORE', 'database'), ], + 'pagination' => [ + 'study_counts' => [5, 10, 25, 50, 100], + ], + ]; diff --git a/database/migrations/0000_00_00_163912_create_institutes_table.php b/database/migrations/0000_00_00_163912_create_institutes_table.php index 1ba250f..33acd63 100644 --- a/database/migrations/0000_00_00_163912_create_institutes_table.php +++ b/database/migrations/0000_00_00_163912_create_institutes_table.php @@ -12,6 +12,8 @@ public function up(): void $table->id(); $table->string('name')->unique(); $table->boolean('is_active')->default(false); + $table->string('address')->nullable(); + $table->string('logo_path')->nullable(); $table->timestamps(); }); } diff --git a/database/migrations/0000_01_31_075136_create_facilities_table.php b/database/migrations/0000_01_31_075136_create_facilities_table.php new file mode 100644 index 0000000..b3a4fc4 --- /dev/null +++ b/database/migrations/0000_01_31_075136_create_facilities_table.php @@ -0,0 +1,26 @@ +id(); + $table->boolean('is_active')->default(false); + $table->foreignId('institute_id')->constrained('institutes')->cascadeOnDelete(); + $table->string('name'); + $table->timestamps(); + + $table->unique(['institute_id', 'name']); + }); + } + + public function down(): void + { + Schema::dropIfExists('facilities'); + } +}; 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 22ce0cc..8ae72e7 100644 --- a/database/migrations/0001_01_01_000000_create_users_table.php +++ b/database/migrations/0001_01_01_000000_create_users_table.php @@ -1,6 +1,7 @@ foreignId('current_team_id')->nullable(); $table->string('profile_photo_path')->nullable(); $table->foreignIdFor(Institute::class)->nullable()->index(); + $table->foreignIdFor(Facility::class)->nullable()->index(); $table->string('timezone')->default('Asia/Dhaka'); $table->timestamp('last_seen_at')->nullable(); $table->rememberToken(); diff --git a/database/migrations/2024_12_27_060234_create_studies_table.php b/database/migrations/2024_12_27_060234_create_studies_table.php index 8a93af3..f94b9a4 100644 --- a/database/migrations/2024_12_27_060234_create_studies_table.php +++ b/database/migrations/2024_12_27_060234_create_studies_table.php @@ -2,6 +2,7 @@ use App\Models\Enums\ReportStatus; use App\Models\Enums\StudyLevelStatus; +use App\Models\Facility; use App\Models\Institute; use App\Models\User; use Illuminate\Database\Migrations\Migration; @@ -40,7 +41,8 @@ public function up(): void $table->dateTime('reported_at')->nullable(); $table->dateTime('authorized_at')->nullable(); - $table->foreignIdFor(Institute::class)->constrained()->onDelete('cascade'); + $table->foreignIdFor(Institute::class)->constrained()->cascadeOnDelete(); + $table->foreignIdFor(Facility::class)->nullable()->constrained()->cascadeOnDelete(); $table->unsignedTinyInteger('study_status')->default(StudyLevelStatus::Pending->value); $table->unsignedTinyInteger('report_status')->default(ReportStatus::Pending->value); diff --git a/database/migrations/2024_12_31_074312_create_orthanc_hosts_table.php b/database/migrations/2024_12_31_074312_create_orthanc_hosts_table.php new file mode 100644 index 0000000..043fdb8 --- /dev/null +++ b/database/migrations/2024_12_31_074312_create_orthanc_hosts_table.php @@ -0,0 +1,27 @@ +id(); + $table->string('server_name')->unique(); + $table->string('fqdn')->unique(); + $table->string('ae_title')->nullable(); + $table->string('stone_viewer_url')->nullable(); + $table->string('ohif_viewer_url')->nullable(); + $table->string('meddream_viewer_url')->nullable(); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('orthanc_hosts'); + } +};