migrated is_archived to timestamp

This commit is contained in:
Dr Masroor Ehsan 2025-01-10 15:42:47 +06:00
parent bb76ed696c
commit 1a97f96b5d
4 changed files with 19 additions and 14 deletions

View File

@ -20,11 +20,6 @@ public function facility(): BelongsTo
return $this->belongsTo(Facility::class);
}
private function restEndpoint(string $path): Uri
{
return Uri::of($this->rest_api_endpoint)->withPath($path);
}
public function stoneViewerUrl(): Uri
{
return $this->restEndpoint($this->stone_viewer_path);
@ -34,4 +29,9 @@ public function ohifViewerUrl(): Uri
{
return $this->restEndpoint($this->ohif_viewer_path);
}
private function restEndpoint(string $path): Uri
{
return Uri::of($this->rest_api_endpoint)->withPath($path);
}
}

View File

@ -9,6 +9,7 @@
use App\Models\Traits\HashableId;
use App\Services\Pacs\PacsUrlGen;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Concerns\HasTimestamps;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
@ -47,19 +48,19 @@ public function shares(): HasMany
return $this->hasMany(SharedStudy::class);
}
public function scopeActive($query)
public function scopeActive(Builder $query): Builder
{
return $query->where('is_archived', false);
return $query->whereNull('archived_at');
}
public function scopeArchived($query)
public function scopeArchived(Builder $query): Builder
{
return $query->where('is_archived', true);
return $query->whereNotNull('archived_at');
}
public function scopeUnlocked($query)
public function scopeUnlocked(Builder $query): Builder
{
return $query->where('is_locked', false);
return $query->whereNotNull('locked_at');
}
public function getHistoryLink(): string
@ -129,7 +130,12 @@ public function isAssigned(int $rad_id): bool
public function isActive(): bool
{
return $this->is_archived === false;
return $this->archived_at === null;
}
public function isArchived(): bool
{
return $this->archived_at !== null;
}
public function getReportStatusLedAttribute(): string

View File

@ -15,7 +15,7 @@ public function __invoke(StudiesSync $sync, Closure $next): StudiesSync
$sync->resetQueues();
$studies = DB::table('studies')
->where('is_archived', false)
->whereNull('archived_at')
->get(['orthanc_uuid', 'study_status'])
->pluck('study_status', 'orthanc_uuid');

View File

@ -16,7 +16,6 @@ public function up(): void
$table->id();
$table->foreignIdFor(OrthancHost::class)->index();
$table->string('orthanc_uuid')->index();
$table->boolean('is_archived')->default(false);
$table->unsignedTinyInteger('priority')->default(Priority::Routine);
$table->string('patient_uuid')->nullable()->index();