SKOLE-DIRY — Digital Diary Module
Module ID:SKOLE-DIRY | Version: 1.0 | Status: ActiveProducts: Parent App (read/status update) · Teacher App (create/manage) · Web App (view)
1. Overview
| Field | Value |
|---|---|
| Module Name | Digital Diary |
| Module Code | DIRY |
| Business Value | Replaces physical homework diaries. Teachers post assignments with due dates, priority levels, and attachments. Parents view and mark homework as completed, keeping both sides aligned on academic tasks. |
Scope In
- Teachers: Create, edit, delete diary entries (homework, classwork, notes, reminders)
- Parents: View diary entries for their child, mark as completed
- Filtering by grade, student, diary type, status
Scope Out
- File upload (attachment_url stored but upload handled externally)
- Student self-service diary access
2. Requirements
Functional Requirements (FR)
What the module must DO — actions, behaviors, and outcomes.- SKOLE-DIRY-FR001: The module shall allow teachers to create diary entries with title, description, grade, type (homework, classwork, note, reminder), due date, priority, and optional attachment URLs.
- SKOLE-DIRY-FR002: The module shall allow targeting diary entries to either an entire grade or a specific student.
- SKOLE-DIRY-FR003: The module shall enable teachers to update and soft-delete diary entries.
- SKOLE-DIRY-FR004: The module shall allows parents to view all relevant diary entries for their child’s grade or student ID.
- SKOLE-DIRY-FR005: The module shall allow parents to mark a diary entry as ‘completed’ for their child.
- SKOLE-DIRY-FR006: The module shall support priority levels: low, medium, and high.
- SKOLE-DIRY-FR007: The module shall allows web admins to view all diary activities across the school.
Non-Functional Requirements (NFR)
How well the module must do it — performance, security, and reliability.- SKOLE-DIRY-NFR001: The module shall behave reliably by ensuring soft-deleted entries (
deleted_status = 1) never appear in consumer API responses. - SKOLE-DIRY-NFR002: The module shall perform visual highlighting for overdue pending tasks in the parent application.
- SKOLE-DIRY-NFR003: The module shall ensure that diary entries are delivered to parents with minimal latency after being published by a teacher.
Constraints
Rules and boundaries — tech choices and platform restrictions.- C001: We must implement soft-deletion using a
deleted_statusflag because the platform architecture avoids permanent data removal for audit purposes. - C002: We must use external file storage for attachments as the platform does not currently host raw binary assets for diary entries.
3. Sub-modules / Backlog
| ID | Sub-module | Priority | Status | Estimate | Linked FR |
|---|---|---|---|---|---|
SKOLE-DIRY-SM001 | Teacher diary management (CRUD) | P0 | Done | 3d | FR001–FR003 |
SKOLE-DIRY-SM002 | Parent diary viewer | P0 | Done | 2d | FR004–FR005 |
SKOLE-DIRY-SM003 | Web admin diary view | P1 | Done | 1d | FR008 |
SKOLE-DIRY-SM004 | File attachment support | P2 | Partial | — | FR001 |
4. Logical Implementation
Entry Lifecycle State Machine
Teacher Create Flow
Parent View Flow
Parent Status Update Flow
Error Handling
| Scenario | HTTP | Message |
|---|---|---|
| Entry not found | 404 | ”Diary entry not found” |
| Invalid diary_type | 400 | Validation error |
| Soft-deleted entry | 404 | ”Not found” (filtered at query level) |
5. UI Requirements
Parent App — DiaryScreen
| ID | Screen | Route | Description |
|---|---|---|---|
SKOLE-DIRY-UI001 | DiaryScreen | /diary | Filtered list of diary entries grouped by due date with status indicators |
| ID | Component | Props | ||
|---|---|---|---|---|
SKOLE-DIRY-UC001 | DiaryCard | entry, onMarkComplete, isOverdue | ||
SKOLE-DIRY-UC002 | DiaryTypeFilter | types[], selected, onChange | ||
SKOLE-DIRY-UC003 | PriorityBadge | `priority: low | medium | high` |
SKOLE-DIRY-UC004 | DueDateChip | due_date, isOverdue | ||
SKOLE-DIRY-UC005 | AttachmentLink | url |
- Loading: 3 skeleton cards
- Empty: “No diary entries for this period”
- Error: Toast + retry button
Teacher App — DiaryScreen
| ID | Screen | Route | Description |
|---|---|---|---|
SKOLE-DIRY-UI002 | DiaryScreen | /diary | Full CRUD interface for managing diary entries, with grade/student selectors |
| ID | Component | Props |
|---|---|---|
SKOLE-DIRY-UC006 | DiaryForm | initialValues, onSubmit, loading |
SKOLE-DIRY-UC007 | GradeStudentPicker | grades[], students[], onSelect |
SKOLE-DIRY-UC008 | DeleteConfirmModal | onConfirm, onCancel |
Web App — Diary Page
| ID | Screen | Route | Description |
|---|---|---|---|
SKOLE-DIRY-UI003 | Diary Page | /:skoleId/diary | Read-only tabular view with filters for grade, type, date range |
6. Conditional Expressions
| ID | Expression | Trigger | True Action | False Action |
|---|---|---|---|---|
SKOLE-DIRY-CE001 | entry.deleted_status === 1 | DB query | Exclude from results | Include |
SKOLE-DIRY-CE002 | entry.due_date < today && entry.status !== 'completed' | DiaryCard render | Show overdue badge (red) | Normal style |
SKOLE-DIRY-CE003 | entry.status === 'completed' | DiaryCard render | Show checkmark, grey out | Show pending style |
SKOLE-DIRY-CE004 | entry.priority === 'high' | DiaryCard render | Red PriorityBadge | Normal badge color |
SKOLE-DIRY-CE005 | entry.student_id !== null | Teacher query filter | Target specific student | Target whole grade |
SKOLE-DIRY-CE006 | entry.attachment_url !== null | DiaryCard render | Show attachment link | Hide attachment section |
SKOLE-DIRY-CE007 | user.type === 'staff' | Diary screen render | Show edit/delete controls | Hide teacher-only actions |
7. Internal Module Connections
| Direction | Module | Data / Event | Condition |
|---|---|---|---|
| DIRY → AUTH | Auth | JWT skole_id scopes all queries | Every request |
| DIRY → STUD | Students | student_id links entry to a specific student | When student-specific entry |
| ENGG → DIRY | Engagement | Comments and reactions attach to diary entries via entity_type='diary' | On comment/react action |
| DASH → DIRY | Dashboard | Pending diary count shown on parent dashboard | Dashboard load |
8. External Connections
| ID | Service | Purpose | Failure Behavior |
|---|---|---|---|
SKOLE-DIRY-EX001 | PostgreSQL (Prisma) | Read/write digital_diary | 500 error |
SKOLE-DIRY-EX002 | File Storage (URL-based) | attachment_url links to external file host | Broken link shown to user |
9. Database Tables
| ID | Table | Role |
|---|---|---|
SKOLE-DIRY-TB001 | digital_diary | All diary entries |
digital_diary Schema
| Column | Type | Notes |
|---|---|---|
id | Int PK | Auto-increment |
skole_id | VarChar(15) | School tenant key |
staff_id | Int | Teacher who created it |
grade | VarChar(50) | Target grade |
student_id | Int? | Specific student (optional) |
diary_type | VarChar(50) | homework/classwork/note/reminder |
title | VarChar(255) | Entry title |
description | Text | Full entry content |
due_date | Date | Completion deadline |
attachment_url | VarChar(500) | External file link |
priority | VarChar(25) | low/medium/high |
status | VarChar(25) | pending/completed |
deleted_status | Int | 0=active, 1=deleted |
created_at | Timestamp | — |
updated_at | Timestamp | — |
10. API Endpoints Summary
| ID | Method | Route | Auth | Description |
|---|---|---|---|---|
| PARENT-01 | GET | /parent-app/digital-diary | JWT | List child’s diary entries |
| PARENT-02 | GET | /parent-app/digital-diary/:id | JWT | Read single entry |
| PARENT-03 | PUT | /parent-app/digital-diary/:id | JWT | Mark entry completed |
| PARENT-04 | POST | /parent-app/digital-diary/:id/attachments | JWT | Upload attachment |
| TEACH-01 | GET | /teachers-app/digital-diary | JWT | List all entries |
| TEACH-02 | GET | /teachers-app/digital-diary/:id | JWT | Read entry detail |
| TEACH-03 | POST | /teachers-app/digital-diary | JWT | Create entry |
| TEACH-04 | PUT | /teachers-app/digital-diary/:id | JWT | Update entry |
| TEACH-05 | DELETE | /teachers-app/digital-diary/:id | JWT | Delete entry |
| ADMIN-01 | GET | /web-app/digital-diary | JWT | List all entries |
| ADMIN-02 | GET | /web-app/digital-diary/:id | JWT | View entry detail |
| ADMIN-03 | POST | /web-app/digital-diary | JWT | Create entry |
- Default sort: by due_date ascending
PARENT-01: List Child’s Diary Entries
Section 1: Endpoint Summary
Returns all diary entries visible to parent for their child, including homework, classwork notes, and reminders. Filters by priority, type, and status.Section 2: HTTP Details
- HTTP Method: GET
- Endpoint URL:
/parent-app/digital-diary - Authentication: JWT Bearer Token (Parent)
- Rate Limit: 100 requests per minute
Section 4: Query Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| diary_type | String | No | - | Filter: homework, classwork, note, reminder |
| status | String | No | pending | Filter: pending, completed |
| priority | String | No | - | Filter: low, medium, high |
| from_date | Date | No | 30 days ago | Start date |
| to_date | Date | No | Today | End date |
| take | Integer | No | 20 | Page size |
| skip | Integer | No | 0 | Offset |
Section 6: Response Schema (Success - 200)
Section 7: Error Responses
401 - UnauthorizedSection 8: Implementation Examples
JavaScript:Section 9: Database Context
Tables:- digital_diary (primary)
- students (join for access control)
Section 10: Business Logic & Validations
Filtering:- Automatically hides deleted entries (deleted_status = 1)
- Scopes to parent’s school and child’s grade
- Respects privacy: parents see only entries for their child’s grade/student
- Default sort: by due_date ascending
Section 11: Related Endpoints
- GET
/parent-app/digital-diary/:id- Single entry detail - PUT
/parent-app/digital-diary/:id- Mark completed - POST
/parent-app/digital-diary/:id/attachments- Upload file
Section 12: Response Summary Table
| Status | Scenario | Error Code | Message |
|---|---|---|---|
| 200 ✅ | Success | - | Entries retrieved |
| 401 ❌ | Unauthorized | UNAUTHORIZED | Invalid token |
PARENT-02: Get Diary Entry Detail
Section 1: Endpoint Summary
Fetch complete details of a single diary entry including full description, attachments, and completion status.Section 2: HTTP Details
- HTTP Method: GET
- Endpoint URL:
/parent-app/digital-diary/:id - Authentication: JWT (Parent)
Section 3: Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | UUID | Yes | Entry ID |
Section 6: Response Schema (Success - 200)
Section 8: Implementation Examples
JavaScript:Section 12: Response Summary Table
| Status | Scenario | Error Code |
|---|---|---|
| 200 ✅ | Success | - |
| 404 ❌ | Not found | NOT_FOUND |
PARENT-03: Mark Entry Completed
Section 1: Endpoint Summary
Parent marks a diary entry as completed for their child, updating status to reflect completion.Section 2: HTTP Details
- HTTP Method: PUT
- Endpoint URL:
/parent-app/digital-diary/:id - Authentication: JWT (Parent)
Section 5: Request Body Schema
Section 6: Response Schema (Success - 200)
Section 8: Implementation Examples
JavaScript:Section 12: Response Summary Table
| Status | Scenario | Error Code |
|---|---|---|
| 200 ✅ | Success | - |
PARENT-04: Upload Attachment
Section 1: Endpoint Summary
Allows parents to attach files (completion proof, photos) to diary entries.Section 2: HTTP Details
- HTTP Method: POST
- Endpoint URL:
/parent-app/digital-diary/:id/attachments - Content-Type:
multipart/form-data - Authentication: JWT (Parent)
Section 5: Request Body Schema
Section 6: Response Schema (Success - 201)
Section 8: Implementation Examples
JavaScript:Section 12: Response Summary Table
| Status | Scenario | Error Code |
|---|---|---|
| 201 ✅ | Success | - |
TEACH-01: List Teacher’s Diary Entries
Section 1: Endpoint Summary
Teacher views all diary entries they created with filtering by type, priority, date.Section 2: HTTP Details
- HTTP Method: GET
- Endpoint URL:
/teachers-app/digital-diary - Authentication: JWT (Staff)
Section 4: Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| diary_type | String | No | Filter by type |
| grade_id | UUID | No | Filter by target grade |
| status | String | No | Filter by status |
| take | Integer | No | Page size |
Section 6: Response Schema (Success - 200)
Section 8: Implementation Examples
JavaScript:Section 12: Response Summary Table
| Status | Scenario | Error Code |
|---|---|---|
| 200 ✅ | Success | - |
TEACH-02: Get Entry Detail
Section 1: Endpoint Summary
Fetch complete entry details for viewing/editing.Section 2: HTTP Details
- HTTP Method: GET
- Endpoint URL:
/teachers-app/digital-diary/:id - Authentication: JWT (Staff)
Section 6: Response Schema (Success - 200)
Section 12: Response Summary Table
| Status | Scenario | Error Code |
|---|---|---|
| 200 ✅ | Success | - |
TEACH-03: Create Diary Entry
Section 1: Endpoint Summary
Teacher creates new diary entry (homework, classwork, note, reminder) for grade or specific student.Section 2: HTTP Details
- HTTP Method: POST
- Endpoint URL:
/teachers-app/digital-diary - Authentication: JWT (Staff)
Section 5: Request Body Schema
Section 6: Response Schema (Success - 201)
Section 7: Error Responses
400 - Invalid TypeSection 8: Implementation Examples
JavaScript:Section 12: Response Summary Table
| Status | Scenario | Error Code |
|---|---|---|
| 201 ✅ | Success | - |
| 400 ❌ | Invalid | INVALID_TYPE |
TEACH-04: Update Entry
Section 1: Endpoint Summary
Teacher updates diary entry contents, deadline, or priority.Section 2: HTTP Details
- HTTP Method: PUT
- Endpoint URL:
/teachers-app/digital-diary/:id - Authentication: JWT (Staff)
Section 5: Request Body Schema
Section 6: Response Schema (Success - 200)
Section 8: Implementation Examples
JavaScript:Section 12: Response Summary Table
| Status | Scenario | Error Code |
|---|---|---|
| 200 ✅ | Success | - |
TEACH-05: Delete Entry
Section 1: Endpoint Summary
Teacher soft-deletes a diary entry (hidden from parents but retained in database for audit).Section 2: HTTP Details
- HTTP Method: DELETE
- Endpoint URL:
/teachers-app/digital-diary/:id - Authentication: JWT (Staff)
Section 6: Response Schema (Success - 200)
Section 8: Implementation Examples
JavaScript:Section 9: Database Context
Setsdeleted_status = 1, entry hidden from all consumer APIs
Section 12: Response Summary Table
| Status | Scenario | Error Code |
|---|---|---|
| 200 ✅ | Success | - |
ADMIN-01: List All Entries (Web App)
Section 1: Endpoint Summary
Admin views all diary entries across school with global filters.Section 2: HTTP Details
- HTTP Method: GET
- Endpoint URL:
/web-app/digital-diary - Authentication: JWT (Admin)
Section 4: Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| grade_id | UUID | No | Filter by grade |
| created_by | UUID | No | Filter by teacher |
| diary_type | String | No | Filter by type |
| include_deleted | Boolean | No | Include soft-deleted |
Section 6: Response Schema (Success - 200)
Section 12: Response Summary Table
| Status | Scenario | Error Code |
|---|---|---|
| 200 ✅ | Success | - |
ADMIN-02: Get Entry Detail (Web App)
Section 1: Endpoint Summary
Admin views complete diary entry details including creator and target audience.Section 2: HTTP Details
- HTTP Method: GET
- Endpoint URL:
/web-app/digital-diary/:id - Authentication: JWT (Admin)
Section 12: Response Summary Table
| Status | Scenario | Error Code |
|---|---|---|
| 200 ✅ | Success | - |
ADMIN-03: Create Entry (Web App)
Section 1: Endpoint Summary
Admin creates diary entries on behalf of staff (for system announcements or corrections).Section 2: HTTP Details
- HTTP Method: POST
- Endpoint URL:
/web-app/digital-diary - Authentication: JWT (Admin)
Section 5: Request Body Schema
Section 6: Response Schema (Success - 201)
Section 12: Response Summary Table
| Status | Scenario | Error Code |
|---|---|---|
| 201 ✅ | Success | - |
12. Summary Table: All 12 Digital Diary Endpoints
| ID | Endpoint | Method | Description | Status |
|---|---|---|---|---|
| PARENT-01 | /parent-app/digital-diary | GET | List entries | ✅ Documented |
| PARENT-02 | /parent-app/digital-diary/:id | GET | Entry detail | ✅ Documented |
| PARENT-03 | /parent-app/digital-diary/:id | PUT | Mark completed | ✅ Documented |
| PARENT-04 | /parent-app/digital-diary/:id/attachments | POST | Upload file | ✅ Documented |
| TEACH-01 | /teachers-app/digital-diary | GET | List entries | ✅ Documented |
| TEACH-02 | /teachers-app/digital-diary/:id | GET | Entry detail | ✅ Documented |
| TEACH-03 | /teachers-app/digital-diary | POST | Create entry | ✅ Documented |
| TEACH-04 | /teachers-app/digital-diary/:id | PUT | Update entry | ✅ Documented |
| TEACH-05 | /teachers-app/digital-diary/:id | DELETE | Delete entry | ✅ Documented |
| ADMIN-01 | /web-app/digital-diary | GET | List all | ✅ Documented |
| ADMIN-02 | /web-app/digital-diary/:id | GET | Entry detail | ✅ Documented |
| ADMIN-03 | /web-app/digital-diary | POST | Create entry | ✅ Documented |