> ## 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.

# Food Menu Module

> SKOLE-FOOD — Food Menu Module

# SKOLE-FOOD — Food Menu Module

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

***

## 1. Overview

| Field              | Value                                                                                                                                                                       |
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Module Name**    | Food Menu                                                                                                                                                                   |
| **Module Code**    | FOOD                                                                                                                                                                        |
| **Business Value** | Transparently communicates the school cafeteria/tiffin menu to parents. Parents know what meals are planned, reducing guesswork and supporting children with dietary needs. |

### Scope In

* Create and manage menu items with title, items, nutrients, health benefits, day, and period
* Schedule menus for specific days and periods
* Parent read-only view, filterable by day/period

### Scope Out

* Allergen filtering / medical diet customization
* Online meal ordering or payment

***

## 2. Requirements

### Functional Requirements (FR)

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

* **SKOLE-FOOD-FR001:** The module shall allow admins and teachers to define food menu items with details on title, items, nutrients, and health benefits.
* **SKOLE-FOOD-FR002:** The module shall enable scheduling of menu items for specific days of the week and meal periods (breakfast, lunch, snack).
* **SKOLE-FOOD-FR003:** The module shall allow parents to view the weekly food menu, filtered by day and period.
* **SKOLE-FOOD-FR004:** The module shall allow admins to toggle the status of menu items (active/inactive).
* **SKOLE-FOOD-FR005:** The module shall provide soft-deletion for menu records.

### Non-Functional Requirements (NFR)

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

* **SKOLE-FOOD-NFR001:** The module shall perform multi-tenant scoping by ensuring food data is strictly isolated by `skole_id`.
* **SKOLE-FOOD-NFR002:** The module shall behave reliably by excluding items marked for deletion (`deleted_status = 1`) from all frontend views.

### Constraints

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

* **C001:** We must separate the menu item definition from the schedule mapping in the database to allow for recurring menu rotations.
* **C002:** We must maintain compatibility with the platform-wide soft-deletion pattern using the `deleted_status` integer column.

***

## 3. Sub-modules / Backlog

| ID                 | Sub-module               | Priority | Status | Estimate | Linked FR                |
| ------------------ | ------------------------ | -------- | ------ | -------- | ------------------------ |
| `SKOLE-FOOD-SM001` | Food menu CRUD           | P0       | Done   | 2d       | FR001–FR002, FR004–FR005 |
| `SKOLE-FOOD-SM002` | Parent menu viewer       | P0       | Done   | 1d       | FR003                    |
| `SKOLE-FOOD-SM003` | Menu schedule management | P1       | Done   | 1d       | FR002                    |

***

## 4. Logical Implementation

```text theme={null}
GET /parent-app/food-menu?day=Monday&period=lunch
  WHERE skole_id = jwt.skole_id AND deleted_status = 0
  AND menu_day = 'Monday' AND period = 'lunch'
```

```text theme={null}
POST /teachers-app/food-menu
  { skole_id, food_menu_title, food_menu_items, menu_nutrients,
    menu_health_benefits, menu_day, period, status }
```

***

## 5. UI Requirements

### Parent App

| ID                 | Screen         | Route        | Description                                            |
| ------------------ | -------------- | ------------ | ------------------------------------------------------ |
| `SKOLE-FOOD-UI001` | FoodMenuScreen | `/food-menu` | Weekly grid or day-selector with menu cards per period |

**Components:**

| ID                 | Component          | Props                            |
| ------------------ | ------------------ | -------------------------------- |
| `SKOLE-FOOD-UC001` | `MenuCard`         | `item`, `period`                 |
| `SKOLE-FOOD-UC002` | `DaySelector`      | `days[]`, `selected`, `onChange` |
| `SKOLE-FOOD-UC003` | `NutrientsSection` | `nutrients`                      |

### Teacher App & Web App

| ID                 | Screen          | Route                 | Description                            |
| ------------------ | --------------- | --------------------- | -------------------------------------- |
| `SKOLE-FOOD-UI002` | FoodMenuManage  | `/food`               | Create/edit/delete menus with schedule |
| `SKOLE-FOOD-UI003` | Admin Food Menu | `/:skoleId/food-menu` | Web display and management             |

***

## 6. Conditional Expressions

| ID                 | Expression                   | Trigger     | True Action            | False Action |
| ------------------ | ---------------------------- | ----------- | ---------------------- | ------------ |
| `SKOLE-FOOD-CE001` | `deleted_status === 1`       | DB query    | Exclude                | Include      |
| `SKOLE-FOOD-CE002` | `menu.status === 'inactive'` | Parent view | Hide                   | Show         |
| `SKOLE-FOOD-CE003` | `selectedDay` changes        | Parent app  | Re-fetch menus for day | —            |

***

## 7. Database Tables

| ID                 | Table                | Role                        |
| ------------------ | -------------------- | --------------------------- |
| `SKOLE-FOOD-TB001` | `food_menus`         | Menu item definitions       |
| `SKOLE-FOOD-TB002` | `food_menu_schedule` | Day/period schedule mapping |

***

## 8. API Endpoints

| ID                 | Method | Route                         | Auth         | Description           |
| ------------------ | ------ | ----------------------------- | ------------ | --------------------- |
| `SKOLE-FOOD-EP001` | GET    | `/parent-app/food-menu`       | JWT (parent) | View daily menu       |
| `SKOLE-FOOD-EP002` | GET    | `/teachers-app/food-menu`     | JWT (staff)  | View all menus        |
| `SKOLE-FOOD-EP003` | POST   | `/teachers-app/food-menu`     | JWT (staff)  | Create menu item      |
| `SKOLE-FOOD-EP004` | PUT    | `/teachers-app/food-menu/:id` | JWT (staff)  | Update menu item      |
| `SKOLE-FOOD-EP005` | DELETE | `/teachers-app/food-menu/:id` | JWT (staff)  | Delete menu item      |
| `SKOLE-FOOD-EP006` | GET    | `/web-app/food-menu`          | JWT (user)   | Admin view menus      |
| `SKOLE-FOOD-EP007` | POST   | `/web-app/food-menu`          | JWT (user)   | Admin create menu     |
| `SKOLE-FOOD-EP008` | PUT    | `/web-app/food-menu/:id`      | JWT (user)   | Admin update menu     |
| `SKOLE-FOOD-EP009` | DELETE | `/web-app/food-menu/:id`      | JWT (user)   | Admin delete menu     |
| `SKOLE-FOOD-EP010` | POST   | `/web-app/food-menu-schedule` | JWT (user)   | Create schedule entry |
