> ## Documentation Index
> Fetch the complete documentation index at: https://docs.criar.in/llms.txt
> Use this file to discover all available pages before exploring further.

# Noticeboard Module

> SKOLE-NOTB — Noticeboard Module

# SKOLE-NOTB — Noticeboard Module

**Module ID:** `SKOLE-NOTB` | **Version:** 1.0 | **Status:** Active\
**Products:** Parent App (read) · Teacher App (create/manage) · Web App (manage)

***

## 1. Overview

| Field              | Value                                                                                                                                                                                     |
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Module Name**    | Noticeboard                                                                                                                                                                               |
| **Module Code**    | NOTB                                                                                                                                                                                      |
| **Business Value** | Central broadcast channel for formal school announcements (fee due dates, holidays, exam schedules, circulars). Provides a permanent, searchable record replacing physical notice boards. |

### Scope In

* Post, edit, soft-delete notices with title, description, type
* All parents and staff see the same school-wide feed
* Filter by notice\_type

### Scope Out

* Targeted notices to specific grade/student (use Activities for that)
* Email/push delivery of notices (planned)

***

## 2. Requirements

### Functional Requirements (FR)

*What the module must DO — actions, behaviors, and outcomes.*

* **SKOLE-NOTB-FR001:** The module shall allow teachers and admins to create formal notices with title, description, and type.
* **SKOLE-NOTB-FR002:** The module shall support specific notice types: general, exam, holiday, fee, and circular.
* **SKOLE-NOTB-FR003:** The module shall enable authorized users to edit and soft-delete existing notices.
* **SKOLE-NOTB-FR004:** The module shall provide all school community members with a synchronized, school-wide notice feed.
* **SKOLE-NOTB-FR005:** The module shall allow users to filter notices by their assigned type.

### Non-Functional Requirements (NFR)

*How well the module must do it — performance, security, and reliability.*

* **SKOLE-NOTB-NFR001:** The module shall perform chronological sorting by displaying notices in newest-first order.
* **SKOLE-NOTB-NFR002:** The module shall behave reliably by strictly excluding soft-deleted notices (`notice_deleted = 1`) from all active feeds.
* **SKOLE-NOTB-NFR003:** The module shall ensure consistent visibility across all platform surfaces (Parent, Teacher, and Web apps).

### Constraints

*Rules and boundaries — tech choices and platform restrictions.*

* **C001:** We must treat Noticeboard as a school-wide broadcast module, unlike the student-targeted Activities module, to ensure broad dissemination of formal information.
* **C002:** We must reuse the Engagement module's reaction capabilities to allow parents to acknowledge formal notices.

***

## 3. Sub-modules / Backlog

| ID                 | Sub-module                | Priority | Status | Estimate | Linked FR   |
| ------------------ | ------------------------- | -------- | ------ | -------- | ----------- |
| `SKOLE-NOTB-SM001` | Teacher notice management | P0       | Done   | 1d       | FR001–FR003 |
| `SKOLE-NOTB-SM002` | Parent noticeboard viewer | P0       | Done   | 1d       | FR004–FR005 |
| `SKOLE-NOTB-SM003` | Web admin noticeboard     | P1       | Done   | 1d       | FR001–FR005 |

***

## 4. Logical Implementation

### Core Query (both parent and teacher)

```text theme={null}
GET /parent-app/noticeboard?notice_type=
  WHERE skole_id = jwt.skole_id AND notice_deleted = 0
  ORDER BY created_at DESC
```

### Error Handling

| Scenario          | HTTP | Message                 |
| ----------------- | ---- | ----------------------- |
| Missing skole\_id | 400  | "skole\_id is required" |
| Notice not found  | 404  | "Notice not found"      |

***

## 5. UI Requirements

### Parent App — NoticeboardScreen

| ID                 | Screen            | Route          | Description                                       |
| ------------------ | ----------------- | -------------- | ------------------------------------------------- |
| `SKOLE-NOTB-UI001` | NoticeboardScreen | `/noticeboard` | Scrollable feed of school notices with type chips |

**Components:**

| ID                 | Component           | Props                             |
| ------------------ | ------------------- | --------------------------------- |
| `SKOLE-NOTB-UC001` | `NoticeCard`        | `notice`, `onPress`               |
| `SKOLE-NOTB-UC002` | `NoticeTypeFilter`  | `types[]`, `selected`, `onChange` |
| `SKOLE-NOTB-UC003` | `NoticeDetailModal` | `notice`, `visible`, `onClose`    |

### Teacher App & Web App

| ID                 | Screen                    | Route                   | Description                           |
| ------------------ | ------------------------- | ----------------------- | ------------------------------------- |
| `SKOLE-NOTB-UI002` | Teacher NoticeboardScreen | `/noticeboard`          | Feed with create/edit/delete controls |
| `SKOLE-NOTB-UI003` | Admin Noticeboard         | `/:skoleId/noticeboard` | Web CRUD for notices                  |

***

## 6. Conditional Expressions

| ID                 | Expression               | Trigger           | True Action              | False Action |
| ------------------ | ------------------------ | ----------------- | ------------------------ | ------------ |
| `SKOLE-NOTB-CE001` | `notice_deleted === 1`   | DB query          | Exclude                  | Include      |
| `SKOLE-NOTB-CE002` | `notice_type === 'exam'` | NoticeCard render | Blue type badge          | Other color  |
| `SKOLE-NOTB-CE003` | `notice_type === 'fee'`  | NoticeCard render | Orange type badge        | Other color  |
| `SKOLE-NOTB-CE004` | `user.type === 'staff'`  | Screen render     | Show edit/delete on card | Read-only    |

***

## 7. Internal Module Connections

| Direction   | Module     | Data / Event                                     | Condition       |
| ----------- | ---------- | ------------------------------------------------ | --------------- |
| NOTB → AUTH | Auth       | JWT `skole_id` scopes notices                    | Every request   |
| ENGG → NOTB | Engagement | Reactions attach via `entity_type='noticeboard'` | On react action |

***

## 8. Database Tables

| ID                 | Table          | Role               |
| ------------------ | -------------- | ------------------ |
| `SKOLE-NOTB-TB001` | `noticeboards` | All notice records |

### `noticeboards` Key Columns

| Column           | Type         | Notes                             |
| ---------------- | ------------ | --------------------------------- |
| `id`             | Int PK       | —                                 |
| `skole_id`       | VarChar(15)  | Tenant key                        |
| `notice_title`   | VarChar(255) | —                                 |
| `notice_desc`    | VarChar(255) | —                                 |
| `notice_type`    | VarChar(255) | general/exam/holiday/fee/circular |
| `notice_deleted` | Int          | 0=active, 1=deleted               |

***

## 9. API Endpoints

| ID                 | Method | Route                           | Auth         | Description         |
| ------------------ | ------ | ------------------------------- | ------------ | ------------------- |
| `SKOLE-NOTB-EP001` | GET    | `/parent-app/noticeboard`       | JWT (parent) | View all notices    |
| `SKOLE-NOTB-EP002` | GET    | `/teachers-app/noticeboard`     | JWT (staff)  | View all notices    |
| `SKOLE-NOTB-EP003` | POST   | `/teachers-app/noticeboard`     | JWT (staff)  | Create notice       |
| `SKOLE-NOTB-EP004` | PUT    | `/teachers-app/noticeboard/:id` | JWT (staff)  | Update notice       |
| `SKOLE-NOTB-EP005` | DELETE | `/teachers-app/noticeboard/:id` | JWT (staff)  | Soft-delete notice  |
| `SKOLE-NOTB-EP006` | GET    | `/web-app/noticeboard`          | JWT (user)   | Admin view notices  |
| `SKOLE-NOTB-EP007` | POST   | `/web-app/noticeboard`          | JWT (user)   | Admin create notice |
| `SKOLE-NOTB-EP008` | PUT    | `/web-app/noticeboard/:id`      | JWT (user)   | Admin update notice |
| `SKOLE-NOTB-EP009` | DELETE | `/web-app/noticeboard/:id`      | JWT (user)   | Admin delete notice |
