clqms-be/app/Models/EdgeResModel.php
mahdahar cb4181dbff refactor: restructure application architecture and consolidate controllers
- Consolidate page controllers into unified PagesController
- Remove deprecated V2 pages, layouts, and controllers (AuthPage, DashboardPage, V2Page)
- Add Edge resource with migration and model (EdgeResModel)
- Implement new main_layout.php for consistent page structure
- Reorganize patient views into dedicated module with dialog form
- Update routing configuration in Routes.php
- Enhance AuthFilter for improved authentication handling
- Clean up unused V2 assets (CSS, JS) and legacy images
- Update README.md with latest project information

This refactoring improves code organization, removes technical debt, and
establishes a cleaner foundation for future development.
2025-12-29 16:57:46 +07:00

64 lines
1.5 KiB
PHP

<?php
namespace App\Models;
use CodeIgniter\Model;
class EdgeResModel extends Model {
protected $table = 'edgeres';
protected $primaryKey = 'EdgeResID';
protected $useAutoIncrement = true;
protected $returnType = 'array';
protected $useSoftDeletes = false;
protected $allowedFields = [
'SiteID',
'InstrumentID',
'SampleID',
'PatientID',
'Payload',
'Status',
'AutoProcess',
'ProcessedAt',
'ErrorMessage',
'CreateDate',
'EndDate',
'ArchiveDate',
'DelDate'
];
protected $useTimestamps = false;
protected $createdField = 'CreateDate';
protected $updatedField = 'EndDate';
/**
* Get pending results for processing
*/
public function getPending($limit = 100) {
return $this->where('Status', 'pending')
->whereNull('DelDate')
->orderBy('CreateDate', 'ASC')
->findAll($limit);
}
/**
* Mark as processed
*/
public function markProcessed($id) {
return $this->update($id, [
'Status' => 'processed',
'ProcessedAt' => date('Y-m-d H:i:s')
]);
}
/**
* Mark as error
*/
public function markError($id, $errorMessage) {
return $this->update($id, [
'Status' => 'error',
'ErrorMessage' => $errorMessage,
'ProcessedAt' => date('Y-m-d H:i:s')
]);
}
}