Skip to content

Add parent-teacher messaging feature and announcements#271

Open
slimaneBohouch wants to merge 4 commits into
Open-TutorAi:mainfrom
slimaneBohouch:feat/parent-teacher-messaging
Open

Add parent-teacher messaging feature and announcements#271
slimaneBohouch wants to merge 4 commits into
Open-TutorAi:mainfrom
slimaneBohouch:feat/parent-teacher-messaging

Conversation

@slimaneBohouch

@slimaneBohouch slimaneBohouch commented Jun 26, 2026

Copy link
Copy Markdown

Summary

This PR introduces the first pass of parent-teacher communication features
across the backend, domain services, tests, and Svelte dashboards.

It enables direct messaging between parents and teachers about their children,
with full attachment support, teacher announcements with priority levels,
and teacher availability status — all accessible from dedicated parent and
teacher portal dashboards.


User Story

As a parent, I want a dedicated place to contact my child's teachers, read classroom announcements, and see teacher availability, so that I can stay informed and share relevant documents without relying on disconnected external channels.

As a teacher, I want to manage parent conversations, send announcements with priority levels, and publish my availability, so that families receive timely updates and know when to expect a response.


What Changed

  • Added parent-teacher messaging flows with conversation lists, message
    sending, read tracking, and attachment support (PDF, images, documents).
  • Added teacher announcements with create, edit, publish, unpublish, delete,
    read tracking, and unread counts visible to parents.
  • Added teacher availability support for office hours and availability state.
  • Added new backend routers, services, repositories, and models for messages,
    announcements, and teacher-related data.
  • Added parent and teacher dashboard UI for messages, announcements,
    and availability.
  • Added localization strings (EN/FR) for the new UI surfaces.
  • Added targeted tests for announcements, availability, and message attachments.

Changelog Entry

Added

  • Parent-teacher messaging support including conversations, message sending,
    read state, and attachments (PDF, images, documents).
  • Teacher announcements with publishing workflow (draft → published)
    and unread tracking for parents.
  • Parent dashboard UI: Teachers list, Messages inbox, Conversation view,
    Announcements feed with unread badge.
  • Teacher dashboard UI: Parent messages inbox, Conversation view,
    Announcements manager with create/publish/unpublish.
  • Teacher availability status (online/offline) shown in conversation header.

Changed

  • Updated backend routing and dependency injection to support the new
    communication services.
  • Expanded frontend dashboards and translations for parent and teacher roles.

Fixed

  • Improved role-based communication flows for parents and teachers.

Security

  • No new security issues introduced.

Breaking Changes

  • None.

Additional Information

This PR provides the initial communication workflow between parents and teachers.

Relevant testing:

pytest tests/test_announcements.py tests/test_availability.py tests/test_message_attachments.py
cd ui && npm run check
cd ui && npm run lint

Branch: feat/parent-teacher-messaging
Target: dev


Screenshots

👨‍👩‍👦 Parent Portal — Messages Inbox

The parent sees all conversations with their child's teachers.
Each conversation shows the teacher name, child context, and last message timestamp.

p4

💬 Parent Portal — Conversation View

The parent can read and send messages to the teacher.
Messages show timestamps and read status (double checkmark ✓✓).

p2

📎 Parent Portal — File Attachment (PDF Download)

Parents can send and receive PDF attachments.
Clicking a file attachment opens a native download dialog.

p3

🏫 Parent Portal — Teachers List

The parent sees a list of their child's teachers with a direct
"Message" button to start a conversation.

p4

📢 Parent Portal — Announcements Feed

Parents receive announcements published by teachers,
with priority badges (Important/Urgent) and unread count.

p5

👩‍🏫 Teacher Portal — Messages from Parents

The teacher sees all parent messages in a split inbox view.
The conversation shows full message history with attachments.

t1

📎 Teacher Portal — PDF Attachment Sent by Parent

The teacher can view and download attachments sent by parents
(e.g. python-basics-sample-chapters.pdf).

t2

📋 Teacher Portal — Announcements (Empty State)

The teacher's announcements page with the "+ Nouvelle annonce" button.

t3

✍️ Teacher Portal — Create Announcement Form

The teacher fills in the announcement form with title, content,
and priority level (Normal / Important / Urgent).

t4

📝 Teacher Portal — Announcement in Draft State

After creation the announcement shows as "Brouillon" (draft)
before being published to parents.

t5

✅ Teacher Portal — Announcement Published

The teacher publishes the announcement — it now shows as "Publiée"
and becomes visible to parents.

t6

🔄 Teacher Portal — Full Conversation with Parent

Full teacher-side conversation view showing all exchanged messages
and PDF attachments from both sides.

t7

slimaneBohouch and others added 2 commits June 26, 2026 20:12
…-messaging

# Conflicts:
#	accounts/users/service.py
#	data/models/__init__.py
#	gateway/http/app.py
#	gateway/http/dependencies.py
#	gateway/http/routers/auth.py
#	ui/src/routes/parent/+page.svelte
#	ui/src/routes/teacher/+page.svelte
@Dakir-Ai Dakir-Ai self-requested a review June 27, 2026 08:49
@Oumaima-elkhoummassi

Copy link
Copy Markdown

Hi @slimaneBouchouch

The PR description itself is well structured (changelog format, testing commands, screenshots) - that part is solid.

What's missing: there's no documentation file in docs/ for this feature (messaging, announcements, teacher availability). Per the project rule, this needs at least:

  • A technical doc (endpoints, data models for messages/announcements)
  • A user guide, since there's a UI for both parents and teachers

Could you add these before this is ready for review?

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds an initial parent–teacher communication feature set across the backend (models/services/routers), frontend (parent + teacher dashboards), documentation, and tests. It introduces messaging with attachments, teacher announcements with publish/read tracking, and teacher availability.

Changes:

  • Added backend domains + API routes for parent–teacher messages (incl. attachments), announcements, and teacher availability under /api/v1.
  • Added parent/teacher dashboard UI (sidebar navigation, inbox/conversation views, announcements UI) plus time formatting + i18n keys.
  • Added targeted pytest coverage for announcements, availability, and message attachments; added documentation pages for the new feature.

Reviewed changes

Copilot reviewed 42 out of 42 changed files in this pull request and generated 16 comments.

Show a summary per file
File Description
ui/src/routes/teacher/+page.svelte Teacher dashboard layout with sidebar + sections (messages/announcements/profile).
ui/src/routes/parent/+page.svelte Parent dashboard layout with sidebar + sections (teachers/messages/announcements/profile).
ui/src/lib/utils/time.ts Shared relative/time formatting helper for message timestamps.
ui/src/lib/i18n/locales/fr-FR/translation.json Added FR translation keys for messaging UI strings.
ui/src/lib/i18n/locales/en-US/translation.json Added EN keys (currently empty values) for messaging UI strings.
ui/src/lib/components/teacher/ParentMessages.svelte Teacher-side conversation list + embedded conversation view.
ui/src/lib/components/teacher/AnnouncementsPage.svelte Teacher CRUD UI for announcements (draft/publish/unpublish/delete).
ui/src/lib/components/parent/TeachersList.svelte Parent-side “teachers of my children” list + start message action.
ui/src/lib/components/parent/MessagesInbox.svelte Parent-side conversation list + embedded conversation view.
ui/src/lib/components/parent/ConversationView.svelte Shared conversation thread UI, polling, attachments UI, availability header.
ui/src/lib/components/parent/AnnouncementsList.svelte Parent-side published announcements list with read tracking + polling.
ui/src/lib/components/common/DashboardSidebar.svelte Reusable sidebar navigation + unread badges + logout.
ui/src/lib/apis/teachers/index.ts Frontend API client for teacher availability GET/PUT.
ui/src/lib/apis/messages/index.ts Frontend API client for conversations/messages/attachments/links.
ui/src/lib/apis/announcements/index.ts Frontend API client for announcements CRUD + read tracking + unread count.
tests/test_message_attachments.py Tests for attachment upload validation, authZ, and message linkage.
tests/test_availability.py Tests for availability defaults, updates, validation, and access control.
tests/test_announcements.py Tests for announcement lifecycle, authZ, publishing visibility, read tracking.
PULL_REQUEST.md PR/feature summary document committed into the repo.
learning/teachers/service.py Availability business logic + validation.
learning/teachers/repository.py Availability persistence + upsert.
learning/messages/service.py Messaging business logic incl. conversations, read tracking, attachments.
learning/messages/repository.py Messaging persistence for linking tables, conversations, messages, attachments.
learning/messages/init.py Domain package marker.
learning/announcements/service.py Announcement business logic (teacher CRUD, parent list/read/unread count).
learning/announcements/repository.py Announcement persistence + read tracking queries.
learning/announcements/init.py Domain package marker.
gateway/http/routers/teachers.py /api/v1/teachers/* availability endpoints.
gateway/http/routers/messages.py /api/v1/messages/* messaging + attachment + admin linking endpoints.
gateway/http/routers/announcements.py /api/v1/announcements/* endpoints for teacher + parent flows.
gateway/http/dependencies.py Added service factories for new domains.
gateway/http/app.py Router registration for the new APIs under /api/v1.
docs/README.md Linked new feature documentation pages.
docs/parent-teacher-communication-user-guide.md End-user guide for parent/teacher messaging + announcements + availability.
docs/parent-teacher-communication-technical.md Backend technical reference for endpoints and data model shapes.
docker-compose.yml New root-level Compose file for backend + Ollama.
devops/docker/Dockerfile.backend Updated frontend-builder base image.
data/models/message.py New ORM models for parent-student links, teacher-student links, conversations, messages.
data/models/availability.py New ORM model for teacher availability.
data/models/attachment.py New ORM model for message attachments.
data/models/announcement.py New ORM models for announcements + read tracking.
data/models/init.py Model registration for new ORM entities.

import os
from typing import Any, Dict, List, Optional

from fastapi import APIRouter, Depends, File, Form, HTTPException, UploadFile, status

from sqlalchemy.orm import Session

from common.exceptions import AuthorizationError, NotFoundError
Comment on lines +3 to +5
import io
import pytest
from fastapi.testclient import TestClient
Comment on lines +92 to +95
else:
teacher_id, parent_id = current_user.id, receiver_id

conv = self.repo.get_or_create_conversation(parent_id, teacher_id, student_id)
Comment on lines +291 to +296
{@const dlUrl = `${getAttachmentDownloadUrl(att.id)}?token=${localStorage.token}`}
<a
href={dlUrl}
target="_blank"
rel="noopener noreferrer"
download={att.original_filename}
Comment thread docker-compose.yml
Comment on lines +1 to +8
networks:
app-network:
driver: bridge
services:
open-tutorai:
build:
context: .
dockerfile: devops/docker/Dockerfile.backend
Comment thread PULL_REQUEST.md
Comment on lines +60 to +78
## Notes Before Opening PR

Current branch: `feat/parent-teacher-messaging`

The branch is currently aligned with `main` by commit history, but the feature work is still in the local working tree. Stage and commit the changes before pushing:

```bash
git status
git add .
git commit -m "feat: add parent-teacher messaging"
git push -u origin feat/parent-teacher-messaging
```

Then open a pull request from:

```text
feat/parent-teacher-messaging -> main
```

.filter(
ParentTeacherMessage.conversation_id == conversation_id,
ParentTeacherMessage.sender_id != user_id,
ParentTeacherMessage.is_read == False, # noqa: E712
def list_published(self) -> List[Announcement]:
return (
self.session.query(Announcement)
.filter(Announcement.is_published == True) # noqa: E712
return (
self.session.query(Announcement)
.filter(
Announcement.is_published == True, # noqa: E712
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants