SKOLE-ACTV — Activities Module
Module ID:SKOLE-ACTV | Version: 1.0 | Status: ActiveProducts: Parent App (view + engage) · Teacher App (create/manage) · Web App (view)
1. Overview
| Field | Value |
|---|---|
| Module Name | Activities |
| Module Code | ACTV |
| Business Value | Keeps parents informed about school activities — sports days, field trips, cultural programs. Teachers post updates; parents can comment and react, creating a two-way communication channel. |
Scope In
- Teachers: Create, update, soft-delete activities; assign to specific student or school-wide
- Parents: View activity feed, comment, react (like/love)
- Pagination, type filtering, status filtering
Scope Out
- Event RSVP / registration
- Photo gallery per activity
2. Requirements
Functional Requirements (FR)
What the module must DO — actions, behaviors, and outcomes.- SKOLE-ACTV-FR001: The module shall allow teachers to create activities with title, description, type (event, announcement, achievement, homework), and status.
- SKOLE-ACTV-FR002: The module shall enable teachers to assign activities to a specific student or make them school-wide.
- SKOLE-ACTV-FR003: The module shall allow teachers to update and soft-delete activity records.
- SKOLE-ACTV-FR004: The module shall provide parents with a paginated feed of school activities.
- SKOLE-ACTV-FR005: The module shall allow filtering by activity type and status.
- SKOLE-ACTV-FR006: The module shall perform server-side pagination for the activity feed using
pageandlimitparameters. - SKOLE-ACTV-FR007: The module shall allow web admins to view all activity records for their school.
Non-Functional Requirements (NFR)
How well the module must do it — performance, security, and reliability.- SKOLE-ACTV-NFR001: The module shall behave predictably by defaulting pagination to page 1 and a limit of 10 items if not specified.
- SKOLE-ACTV-NFR002: The module shall perform secure data filtering by excluding soft-deleted activities (
deleted_status = 1) from all feeds. - SKOLE-ACTV-NFR003: The module shall maintain high availability for the parent feed as it is a primary engagement surface.
Constraints
Rules and boundaries — tech choices and platform restrictions.- C001: We must utilize the Engagement module for handling comments and reactions on activities because of the platform’s modular architecture.
- C002: We must use a single
activitiestable for all types to maintain a unified feed logic across apps.
3. Sub-modules / Backlog
| ID | Sub-module | Priority | Status | Estimate | Linked FR |
|---|---|---|---|---|---|
SKOLE-ACTV-SM001 | Teacher activity management | P0 | Done | 3d | FR001–FR004 |
SKOLE-ACTV-SM002 | Parent activity feed | P0 | Done | 2d | FR005–FR007 |
SKOLE-ACTV-SM003 | Web admin activity view | P1 | Done | 1d | FR008 |
4. Logical Implementation
Activity Status State Machine
Teacher Create Flow
Parent View Flow
Error Handling
| Scenario | HTTP | Message |
|---|---|---|
| Missing skole_id | 400 | ”skole_id is required” |
| Activity not found (CRUD) | 404 | ”Activity not found” |
5. UI Requirements
Teacher App — ActivitiesScreen
| ID | Screen | Route | Description |
|---|---|---|---|
SKOLE-ACTV-UI001 | ActivitiesScreen | /activities | Feed with create button, edit/delete per card |
| ID | Component | Props | ||
|---|---|---|---|---|
SKOLE-ACTV-UC001 | ActivityCard | activity, onEdit, onDelete, showActions | ||
SKOLE-ACTV-UC002 | ActivityForm | initialValues, onSubmit, loading | ||
SKOLE-ACTV-UC003 | ActivityTypeChip | type | ||
SKOLE-ACTV-UC004 | StatusBadge | `status: draft | published | archived` |
Parent App — Activities Feed
| ID | Screen | Route | Description |
|---|---|---|---|
SKOLE-ACTV-UI002 | ActivitiesFeed | /activities | Paginated activity cards with reactions and comments |
| ID | Component | Props |
|---|---|---|
SKOLE-ACTV-UC005 | ReactionBar | reactions, onReact, entityId, entityType |
SKOLE-ACTV-UC006 | CommentSection | comments[], onSubmit, entityId, entityType |
SKOLE-ACTV-UC007 | PaginationControls | page, totalPages, onPageChange |
Web App
| ID | Screen | Route | Description |
|---|---|---|---|
SKOLE-ACTV-UI003 | Activities Page | /:skoleId/activities | Tabular activity list with CRUD for web admin |
6. Conditional Expressions
| ID | Expression | Trigger | True Action | False Action |
|---|---|---|---|---|
SKOLE-ACTV-CE001 | deleted_status === 1 | DB query | Exclude from results | Include |
SKOLE-ACTV-CE002 | activity.student_id !== null | Activity card render | Show “Individual” badge | Show “School-wide” badge |
SKOLE-ACTV-CE003 | user.type === 'staff' | Activity screen | Show edit/delete buttons | Read-only view |
SKOLE-ACTV-CE004 | status === 'draft' | Activity card | Show draft watermark | Normal display |
SKOLE-ACTV-CE005 | page >= totalPages | Pagination | Disable “Next” button | Enable “Next” |
7. Internal Module Connections
| Direction | Module | Data / Event | Condition |
|---|---|---|---|
| ACTV → AUTH | Auth | JWT skole_id scopes feed | Every request |
| ACTV → STUD | Students | Optional student_id assigns activity to student | When student-specific |
| ENGG → ACTV | Engagement | Comments/reactions via entity_type='activity' | On comment or react |
8. External Connections
| ID | Service | Purpose | Failure Behavior |
|---|---|---|---|
SKOLE-ACTV-EX001 | PostgreSQL (Prisma) | Read/write activities | 500 error |
9. Database Tables
| ID | Table | Role |
|---|---|---|
SKOLE-ACTV-TB001 | activities | All school activities |
activities Key Columns
| Column | Type | Notes |
|---|---|---|
id | Int PK | — |
skole_id | VarChar(15) | Tenant key |
title | VarChar(255) | Activity title |
description | Text | Full description |
activity_type | VarChar(50) | event/announcement/achievement/homework |
posted_by | VarChar(50) | Staff name |
posted_by_id | Int? | FK → staff.id |
student_id | Int? | Specific student target |
status | VarChar(25) | draft/published/archived |
deleted_status | Int | 0=active, 1=deleted |
10. API Endpoints Summary
| ID | Method | Route | Auth | Description |
|---|---|---|---|---|
| PARENT-01 | GET | /parent-app/activity | JWT | Activity feed (paginated) |
| PARENT-02 | GET | /parent-app/activity/:id | JWT | Activity detail |
| PARENT-03 | GET | /parent-app/activity/categories | JWT | List categories |
| TEACH-01 | GET | /teachers-app/activity | JWT | List activities |
| TEACH-02 | GET | /teachers-app/activity/:id | JWT | Activity detail |
| TEACH-03 | POST | /teachers-app/activity | JWT | Create activity |
| TEACH-04 | PUT | /teachers-app/activity/:id | JWT | Update activity |
| TEACH-05 | DELETE | /teachers-app/activity/:id | JWT | Delete activity |
| ADMIN-01 | GET | /web-app/activity | JWT | List all activities |
| ADMIN-02 | GET | /web-app/activity/:id | JWT | Activity detail |
| ADMIN-03 | POST | /web-app/activity | JWT | Create activity |
| ADMIN-04 | PUT | /web-app/activity/:id | JWT | Update activity |
- Auto-excludes deleted entries
PARENT-01: Activity Feed (Paginated)
Section 1: Endpoint Summary
Returns paginated feed of school activities (events, announcements, achievements) for parent’s school with filtering by type and status.Section 2: HTTP Details
- HTTP Method: GET
- Endpoint URL:
/parent-app/activity - Authentication: JWT Bearer Token (Parent)
- Rate Limit: 100 requests per minute
Section 4: Query Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| activity_type | String | No | - | Filter: event, announcement, achievement, homework |
| status | String | No | published | Filter: draft, published, archived |
| page | Integer | No | 1 | Page number (1-indexed) |
| limit | Integer | No | 10 | Items per page (max: 50) |
Section 6: Response Schema (Success - 200)
Section 7: Error Responses
401 - UnauthorizedSection 8: Implementation Examples
JavaScript:Section 9: Database Context
Tables:- activities (primary)
- schools (join for isolation)
Section 10: Business Logic & Validations
Validation:- Page
>= 1, limit<= 50 - activity_type enum check
- Status filter (published by default for parents)
- Auto-excludes deleted entries
- Scope to parent’s school (skole_id)
- Apply all filters
- Exclude deleted_status = 1 entries
- Count total matching
- Paginate and return with metadata
Section 11: Related Endpoints
- GET
/parent-app/activity/:id- Single activity detail - GET
/parent-app/activity/categories- List types
Section 12: Response Summary Table
| Status | Scenario | Error Code | Message |
|---|---|---|---|
| 200 ✅ | Success | - | Activities retrieved |
| 401 ❌ | Unauthorized | UNAUTHORIZED | Invalid JWT |
| 400 ❌ | Bad pagination | INVALID_PAGINATION | Invalid params |
PARENT-02: Get Activity Detail
Section 1: Endpoint Summary
Fetch complete activity details including full description, engagement stats, and comments.Section 2: HTTP Details
- HTTP Method: GET
- Endpoint URL:
/parent-app/activity/:id - Authentication: JWT (Parent)
Section 3: Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | UUID | Yes | Activity 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: List Activity Categories
Section 1: Endpoint Summary
Returns list of available activity types/categories for filtering.Section 2: HTTP Details
- HTTP Method: GET
- Endpoint URL:
/parent-app/activity/categories - Authentication: JWT (Parent)
Section 6: Response Schema (Success - 200)
Section 8: Implementation Examples
JavaScript:Section 12: Response Summary Table
| Status | Scenario | Error Code |
|---|---|---|
| 200 ✅ | Success | - |
TEACH-01: List Activities
Section 1: Endpoint Summary
Teacher views all activities they’ve created with filtering and pagination.Section 2: HTTP Details
- HTTP Method: GET
- Endpoint URL:
/teachers-app/activity - Authentication: JWT (Staff)
Section 4: Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| activity_type | String | No | Filter by type |
| status | String | No | Filter by status |
| page | Integer | No | Page number |
| limit | Integer | No | Items per page |
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 Activity Detail
Section 1: Endpoint Summary
Fetch complete activity details for viewing/editing.Section 2: HTTP Details
- HTTP Method: GET
- Endpoint URL:
/teachers-app/activity/:id - Authentication: JWT (Staff)
Section 6: Response Schema (Success - 200)
Section 12: Response Summary Table
| Status | Scenario | Error Code |
|---|---|---|
| 200 ✅ | Success | - |
TEACH-03: Create Activity
Section 1: Endpoint Summary
Teacher creates new activity (event, announcement, achievement, homework) for school or specific student.Section 2: HTTP Details
- HTTP Method: POST
- Endpoint URL:
/teachers-app/activity - 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 Activity
Section 1: Endpoint Summary
Teacher updates activity details, status, or description.Section 2: HTTP Details
- HTTP Method: PUT
- Endpoint URL:
/teachers-app/activity/: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 Activity
Section 1: Endpoint Summary
Teacher soft-deletes activity (hidden from parents, retained for audit).Section 2: HTTP Details
- HTTP Method: DELETE
- Endpoint URL:
/teachers-app/activity/:id - Authentication: JWT (Staff)
Section 6: Response Schema (Success - 200)
Section 9: Database Context
Setsdeleted_status = 1, hides from all consumer APIs
Section 12: Response Summary Table
| Status | Scenario | Error Code |
|---|---|---|
| 200 ✅ | Success | - |
ADMIN-01: List All Activities (Web App)
Section 1: Endpoint Summary
Admin views all activities across school with global filters.Section 2: HTTP Details
- HTTP Method: GET
- Endpoint URL:
/web-app/activity - Authentication: JWT (Admin)
Section 4: Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| activity_type | String | No | Filter by type |
| created_by | UUID | No | Filter by teacher |
| status | String | No | Filter by status |
| include_deleted | Boolean | No | Include deleted |
Section 6: Response Schema (Success - 200)
Section 12: Response Summary Table
| Status | Scenario | Error Code |
|---|---|---|
| 200 ✅ | Success | - |
ADMIN-02: Get Activity Detail (Web App)
Section 1: Endpoint Summary
Admin views complete activity details including creator and engagement stats.Section 2: HTTP Details
- HTTP Method: GET
- Endpoint URL:
/web-app/activity/:id - Authentication: JWT (Admin)
Section 12: Response Summary Table
| Status | Scenario | Error Code |
|---|---|---|
| 200 ✅ | Success | - |
ADMIN-03: Create Activity (Web App)
Section 1: Endpoint Summary
Admin creates activity on behalf of staff (system announcements, corrections).Section 2: HTTP Details
- HTTP Method: POST
- Endpoint URL:
/web-app/activity - 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 | - |
ADMIN-04: Update Activity (Web App)
Section 1: Endpoint Summary
Admin updates activity details or status.Section 2: HTTP Details
- HTTP Method: PUT
- Endpoint URL:
/web-app/activity/:id - Authentication: JWT (Admin)
Section 6: Response Schema (Success - 200)
Section 12: Response Summary Table
| Status | Scenario | Error Code |
|---|---|---|
| 200 ✅ | Success | - |
12. Summary Table: All 12 Activity Endpoints
| ID | Endpoint | Method | Description | Status |
|---|---|---|---|---|
| PARENT-01 | /parent-app/activity | GET | Activity feed | ✅ Documented |
| PARENT-02 | /parent-app/activity/:id | GET | Activity detail | ✅ Documented |
| PARENT-03 | /parent-app/activity/categories | GET | List categories | ✅ Documented |
| TEACH-01 | /teachers-app/activity | GET | List activities | ✅ Documented |
| TEACH-02 | /teachers-app/activity/:id | GET | Activity detail | ✅ Documented |
| TEACH-03 | /teachers-app/activity | POST | Create activity | ✅ Documented |
| TEACH-04 | /teachers-app/activity/:id | PUT | Update activity | ✅ Documented |
| TEACH-05 | /teachers-app/activity/:id | DELETE | Delete activity | ✅ Documented |
| ADMIN-01 | /web-app/activity | GET | List all | ✅ Documented |
| ADMIN-02 | /web-app/activity/:id | GET | Activity detail | ✅ Documented |
| ADMIN-03 | /web-app/activity | POST | Create activity | ✅ Documented |
| ADMIN-04 | /web-app/activity/:id | PUT | Update activity | ✅ Documented |