feat(patients): phase B4 — messages (پیام‌ها)

Add a patient message/communication log: a new PatientMessage entity
(record-scoped, CASCADE) + repository, and owner-scoped endpoints
(GET messages, POST message, DELETE message) with a validated channel
(sms/note/call/email). Wire the "پیام‌ها" tab in PatientDetailPage
(send box + list + delete). PHPUnit covers create/list/delete + ownership
+ validation; Vitest covers the tab. API docs updated.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
hamed
2026-07-13 15:35:10 +03:30
co-authored by Claude Opus 4.8
parent 976c4f0c0a
commit 5fb4c52246
8 changed files with 358 additions and 1 deletions
+10 -1
View File
@@ -55,7 +55,7 @@ describe('PatientDetailPage (پرونده تب‌دار)', () => {
it('shows a placeholder for not-yet-built tabs', async () => {
renderDetail();
await screen.findByText('ساغر صابری');
fireEvent.click(screen.getByText('پیام‌ها'));
fireEvent.click(screen.getByText('کال سنتر'));
expect(screen.getByText(/به‌زودی تکمیل می‌شود/)).toBeInTheDocument();
});
@@ -75,4 +75,13 @@ describe('PatientDetailPage (پرونده تب‌دار)', () => {
// modal opens with a title field
expect(await screen.findByPlaceholderText('مثلاً: معاینه اولیه')).toBeInTheDocument();
});
it('renders the messages tab with a send box', async () => {
renderDetail();
await screen.findByText('ساغر صابری');
fireEvent.click(screen.getByText('پیام‌ها'));
expect(await screen.findByPlaceholderText('متن پیام...')).toBeInTheDocument();
expect(screen.getByRole('button', { name: 'ارسال' })).toBeInTheDocument();
expect(await screen.findByText('پیامی ثبت نشده است.')).toBeInTheDocument();
});
});