Overview
Each message lives in ParentTutorMessage with parentId, tutorId, studentId, and a role (PARENT or TUTOR). A thread is identified by the triple (parent, tutor, student) — so if you have multiple children with the same tutor, each gets its own thread.
Authorisation is strict: the parent must be linked to the student (via ParentStudentLink) for the read/write to be allowed. Admins can read any thread.
Linking parent and student
A ParentStudentLink row must exist before messaging is possible. Two ways to create it:
- Parent invites student — from the parent dashboard, enter the student's email or registered phone. The student confirms the link from their account; once confirmed, you can message any tutor your child has bought from.
- Student invites parent — from Student dashboard → Family, the student adds a parent email; the parent accepts the invite via a magic link email.
ParentStudentLink.Starting a thread
- From Parent dashboard → Messages, click New thread.
- Pick the linked student and the tutor (only tutors your child is enrolled with appear).
- Type your first message and send.
After the first message, the thread is auto-saved. Both you and the tutor see it in your message lists.
Sending a message
The send endpoint is POST /api/parent/messages with { tutorId, studentId, message, attachmentUrl? }. The server figures out your role from your account:
- If you're the parent, your
parentIdis your own user ID and the role is PARENT. - If you're the tutor, the role is TUTOR and the server looks up the parent for the student. If no parent is linked yet, the message is rejected with a clear error.
Read receipts
When you open a thread, all of the other party's messages that you haven't yet read are stamped readAt = now. The thread list shows a "X unread" badge per thread for messages you haven't seen. The other party can see (per message) whether you've read it.
Attachments
Each message can have one attachmentUrl. The UI lets you upload a file (image, PDF) which uploads to the platform's asset bucket and stores the URL on the message. Open the attachment in a new tab from any message.
Tutor's view
Tutors see all parent threads under Tutor dashboard → Messages → Parents. The thread shows the student's name and the parent's name; tutors typically pin urgent threads to the top and snooze low-priority ones.
Threads have no SLA enforced by the platform, but they're a contractual touchpoint with families — quick replies build trust.