Add parent-teacher messaging feature and announcements#271
Add parent-teacher messaging feature and announcements#271slimaneBohouch wants to merge 4 commits into
Conversation
…-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
|
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
Could you add these before this is ready for review? |
There was a problem hiding this comment.
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 |
| import io | ||
| import pytest | ||
| from fastapi.testclient import TestClient |
| else: | ||
| teacher_id, parent_id = current_user.id, receiver_id | ||
|
|
||
| conv = self.repo.get_or_create_conversation(parent_id, teacher_id, student_id) |
| {@const dlUrl = `${getAttachmentDownloadUrl(att.id)}?token=${localStorage.token}`} | ||
| <a | ||
| href={dlUrl} | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| download={att.original_filename} |
| networks: | ||
| app-network: | ||
| driver: bridge | ||
| services: | ||
| open-tutorai: | ||
| build: | ||
| context: . | ||
| dockerfile: devops/docker/Dockerfile.backend |
| ## 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 |
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
sending, read tracking, and attachment support (PDF, images, documents).
read tracking, and unread counts visible to parents.
announcements, and teacher-related data.
and availability.
Changelog Entry
Added
read state, and attachments (PDF, images, documents).
and unread tracking for parents.
Announcements feed with unread badge.
Announcements manager with create/publish/unpublish.
Changed
communication services.
Fixed
Security
Breaking Changes
Additional Information
This PR provides the initial communication workflow between parents and teachers.
Relevant testing:
Branch:
feat/parent-teacher-messagingTarget:
devScreenshots
👨👩👦 Parent Portal — Messages Inbox
💬 Parent Portal — Conversation View
📎 Parent Portal — File Attachment (PDF Download)
🏫 Parent Portal — Teachers List
📢 Parent Portal — Announcements Feed
👩🏫 Teacher Portal — Messages from Parents
📎 Teacher Portal — PDF Attachment Sent by Parent
📋 Teacher Portal — Announcements (Empty State)
✍️ Teacher Portal — Create Announcement Form
📝 Teacher Portal — Announcement in Draft State
✅ Teacher Portal — Announcement Published
🔄 Teacher Portal — Full Conversation with Parent