Create a REST API feature for managing History Activities. Architecture: - Use Service and Repository Pattern - Implement HistoryActivityService - Follow clean separation between Controller, Service, and Repository - Use pagination for list endpoint --------------------------------------- 1. Database Model --------------------------------------- Model: HistoryActivity Fields: - id (primary key, int) - date (date) - time (time) - school_id (foreign key -> Schools.id) - class_id (foreign key -> Classes.id) - subject_id (foreign key -> Subjects.id) - teacher_id (foreign key -> Teachers.id) - title (varchar 255) - description (text) - file (varchar 255, nullable) - created_at (timestamp) - updated_at (timestamp) Relationships: - HistoryActivity belongs to Class - HistoryActivity belongs to Subject - HistoryActivity belongs to Teacher - HistoryActivity belongs to School --------------------------------------- 2. Create HistoryActivity Endpoint --------------------------------------- The API should: - Create a new HistoryActivity record - Validate required fields - Support optional file upload (store file path in `file` column) - Return created data including related Class and Subject --------------------------------------- 3. List HistoryActivity Endpoint --------------------------------------- Features: - List HistoryActivity with pagination - Filter by: - date - class_id - subject_id - Include related Class and Subject data in response Example response: { "id": 1, "title": "Learning Fractions", "description": "Students practiced fraction exercises", "file": "uploads/history/file1.pdf", "created_at": "2025-02-01 10:00:00", "class": { "id": 1, "name": "Class 1A" }, "subject": { "id": 1, "name": "Mathematics" } } --------------------------------------- 4. Detail HistoryActivity Endpoint --------------------------------------- - Retrieve a single HistoryActivity by ID - Include full related data: - Class - Subject - Teacher - School