Files
clinicpro/migrations/Version20260716091352.php
hamedandClaude Opus 4.8 15c92903e1 feat: replace patient messages tab with pinnable notes
Port the tauri AddNoteModal notes feature into the admin patient case-file,
replacing the mislabeled «پیام‌ها» (SMS log) tab with «یادداشت‌ها».

Backend (src/Patient):
- PatientNote entity + repository (record-scoped, pinned-first ordering)
- CRUD endpoints on PatientController: GET /notes, POST /note,
  PATCH /note/{uuid} (edit body + toggle pin), DELETE /note/{uuid}
- author display name captured server-side from the current user
- migration for patient_notes; docs/api/patient.md updated

Frontend (assets/admin):
- NotesTab: compose box, newest/oldest sort, pinned-first list with
  accent rail + pin/edit/delete, edit modal, confirm-delete, empty state
- tab key/label/icon messages -> notes; onAddNote deep-links the notes tab

Tests: PatientNoteTest (create/list-order/edit/pin/delete/validation/ownership),
PatientDetailPage notes cases (render/empty/pin/create).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-16 12:51:33 +03:30

36 lines
1.7 KiB
PHP

<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20260716091352 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add patient_notes table (pinnable staff notes on patient records)';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE patient_notes (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, body LONGTEXT NOT NULL, pinned TINYINT NOT NULL, author_name VARCHAR(120) DEFAULT NULL, created_at INT NOT NULL, updated_at INT DEFAULT NULL, record_id INT NOT NULL, created_by INT DEFAULT NULL, UNIQUE INDEX UNIQ_942D7D43D17F50A6 (uuid), INDEX IDX_942D7D43DE12AB56 (created_by), INDEX idx_patient_notes_record (record_id), PRIMARY KEY (id)) DEFAULT CHARACTER SET utf8mb4');
$this->addSql('ALTER TABLE patient_notes ADD CONSTRAINT FK_942D7D434DFD750C FOREIGN KEY (record_id) REFERENCES patient_records (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE patient_notes ADD CONSTRAINT FK_942D7D43DE12AB56 FOREIGN KEY (created_by) REFERENCES users (id) ON DELETE SET NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE patient_notes DROP FOREIGN KEY FK_942D7D434DFD750C');
$this->addSql('ALTER TABLE patient_notes DROP FOREIGN KEY FK_942D7D43DE12AB56');
$this->addSql('DROP TABLE patient_notes');
}
}