fix student registration
This commit is contained in:
@@ -1779,8 +1779,8 @@ This document lists every API controller alphabetically with any inline route co
|
||||
**Endpoints:**
|
||||
- `GET /api/v1/students` (`index`) – Requires auth. Supports filters (`parent_id`, `parent_ids[]`). Returns list of students for the selected school year.
|
||||
- `GET /api/v1/students/{id}` (`show`) – Requires auth. Returns detailed student profile plus current class section information.
|
||||
- `POST /api/v1/students` (`store`) – Requires auth. Creates a new student. Validates demographic fields (firstname, lastname, dob, gender, parent_id) and automatically stamps school year, semester, and registration date.
|
||||
- `PATCH /api/v1/students/{id}` (`update`) – Requires auth. Updates student information. Accepts fields: `school_id`, `firstname`, `lastname`, `dob` (automatically calculates age), `gender`, `registration_grade`, `photo_consent`, `parent_id`, `registration_date`, `tuition_paid`, `year_of_registration`, `school_year`, `rfid_tag`, `semester`, `is_new`. Also supports health information: `medical_conditions` (comma/semicolon/newline separated list), `allergies` (comma/semicolon/newline separated list), `medical_touched`, `allergies_touched` (flags to indicate user interaction). Health lists are normalized, deduplicated, and synced with related tables. Only updates fields that are provided and non-empty.
|
||||
- `POST /api/v1/students` (`store`) – Requires auth. Creates a new student. Validates demographic fields (firstname, lastname, dob, gender, parent_id). When the parent has no existing students, emergency contact fields are required (`name`, `cellphone`, `email`, optional `relation`) and an `emergency_contacts` record is created. Automatically stamps school year, semester, and registration date.
|
||||
- `PATCH /api/v1/students/{id}` (`update`) – Requires auth. Updates student information. Accepts fields: `school_id`, `firstname`, `lastname`, `dob` (automatically calculates age), `gender`, `registration_grade`, `photo_consent`, `parent_id`, `registration_date`, `tuition_paid`, `year_of_registration`, `school_year`, `semester`, `is_new`. Also supports health information: `medical_conditions` (comma/semicolon/newline separated list), `allergies` (comma/semicolon/newline separated list), `medical_touched`, `allergies_touched` (flags to indicate user interaction). Health lists are normalized, deduplicated, and synced with related tables. Only updates fields that are provided and non-empty.
|
||||
- `DELETE /api/v1/students/{id}` (`destroy`) – Requires auth. Removes the student record.
|
||||
- `POST /api/v1/students/assign-class` (`assignClassStudent`) – Requires auth. Assigns a student to a class section. Accepts `student_id` and `class_section_id`. Updates `student_class` table, enrollment records, attendance data/records, and all score-related tables (homework, quiz, project, participation, midterm_exam, final_exam, final_score, semester_scores) for the current semester/year. Returns assignment details including attendance and score update statistics.
|
||||
- `POST /api/v1/students/auto-distribute` (`autoDistributeSections`) – Requires auth. Automatically distributes students from promotion queue into lettered sections for a class. Accepts `class_id` (or `class_section_id` to derive class_id), `students_per_section`, and optional `school_year`. Balances male/female distribution across sections. Only considers students with enrollment status 'payment pending' or 'enrolled'. Updates promotion queue and student_class records. Returns summary with distribution details per section (total, male, female counts).
|
||||
@@ -1794,6 +1794,31 @@ This document lists every API controller alphabetically with any inline route co
|
||||
- Health list normalization (removes duplicates, filters placeholders like "none", "n/a")
|
||||
- Transaction-safe operations with rollback on errors
|
||||
|
||||
**Student registration payload example:**
|
||||
```json
|
||||
{
|
||||
"school_year": "2025-2026",
|
||||
"firstname": "Sara",
|
||||
"lastname": "Ahmed",
|
||||
"dob": "2016-03-25",
|
||||
"age": 8,
|
||||
"gender": "Female",
|
||||
"is_active": true,
|
||||
"registration_grade": "3",
|
||||
"is_new": true,
|
||||
"photo_consent": true,
|
||||
"parent_id": 1,
|
||||
"registration_date": "2026-03-25",
|
||||
"tuition_paid": true,
|
||||
"semester": "Fall",
|
||||
"year_of_registration": 2026,
|
||||
"name": "Amina Ahmed",
|
||||
"cellphone": "5555555555",
|
||||
"email": "amina.ahmed@example.com",
|
||||
"relation": "Mother"
|
||||
}
|
||||
```
|
||||
|
||||
## SupplierController
|
||||
**File:** `app/Http/Controllers/Api/SupplierController.php`
|
||||
**Purpose:** CRUD for supplier/vendor records used by purchase orders and inventory management.
|
||||
|
||||
Reference in New Issue
Block a user