add class progress and fix endpoints
This commit is contained in:
@@ -1271,19 +1271,15 @@ This document lists every API controller alphabetically with any inline route co
|
||||
- `PATCH /api/v1/refunds/{id}` – Update status, payout amounts/methods, or notes; stamps approval/refunded timestamps when applicable.
|
||||
|
||||
## RegisterController
|
||||
**File:** `app/Http/Controllers/Api/RegisterController.php`
|
||||
**File:** `app/Http/Controllers/Api/Auth/RegisterController.php`
|
||||
**Purpose:** Public registration portal for parents/guests, including CAPTCHA and confirmation email handling. Handles user registration with validation, role assignment, optional second parent information, and email confirmation.
|
||||
|
||||
**Endpoints:**
|
||||
- `GET /api/v1/register` (`index`) – Generate or retrieve CAPTCHA challenge for registration form. Returns:
|
||||
- `captcha_question` – Random CAPTCHA string (4-8 characters) stored in session
|
||||
- `GET /api/v1/auth/register/captcha` (`captcha`) – Generate or retrieve CAPTCHA challenge for registration form. Returns:
|
||||
- `captcha` – Random CAPTCHA string (4-10 characters) stored in session
|
||||
- If CAPTCHA already exists in session, returns existing value
|
||||
- Used to prevent automated registrations
|
||||
- `GET /api/v1/register/success` (`registrationSuccess`) – Get registration success data. Returns:
|
||||
- `email` – Email address from registration session
|
||||
- Returns 400 error if no registration session exists
|
||||
- Used to display confirmation screen after successful registration
|
||||
- `POST /api/v1/register` (`register`) – Submit registration form. Body parameters:
|
||||
- `POST /api/v1/auth/register` (`store`) – Submit registration form. Body parameters:
|
||||
- **Required fields:**
|
||||
- `firstname` (string, required) – First name (2-30 chars, letters/spaces/hyphens only)
|
||||
- `lastname` (string, required) – Last name (2-30 chars, letters/spaces/hyphens only)
|
||||
@@ -1781,7 +1777,7 @@ This document lists every API controller alphabetically with any inline route co
|
||||
**Purpose:** Full REST API for managing students, class assignments, health information, and automated distribution.
|
||||
|
||||
**Endpoints:**
|
||||
- `GET /api/v1/students` (`index`) – Requires auth. Supports pagination and filters (`parent_id`, `class_id`). Augments each record with the student's current class info. Returns paginated list of students.
|
||||
- `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.
|
||||
|
||||
+187
-25
@@ -222,18 +222,69 @@
|
||||
},
|
||||
"message": {
|
||||
"type": "string",
|
||||
"example": "Login successful"
|
||||
"example": "Authenticated."
|
||||
},
|
||||
"data": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"token": {
|
||||
"type": "string",
|
||||
"example": "eyJ0eXAiOiJKV1QiLCJh..."
|
||||
"user": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"example": 2
|
||||
},
|
||||
"firstname": {
|
||||
"type": "string",
|
||||
"example": "makamak"
|
||||
},
|
||||
"lastname": {
|
||||
"type": "string",
|
||||
"example": "mkmkmkm"
|
||||
},
|
||||
"email": {
|
||||
"type": "string",
|
||||
"format": "email",
|
||||
"example": "mkdfso2123@gmail.com"
|
||||
},
|
||||
"roles": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"example": "parent"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"expires_in": {
|
||||
"type": "integer",
|
||||
"example": 3600
|
||||
"jwt": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"access_token": {
|
||||
"type": "string",
|
||||
"example": "eyJ0eXAiOiJKV1QiLCJh..."
|
||||
},
|
||||
"token_type": {
|
||||
"type": "string",
|
||||
"example": "bearer"
|
||||
},
|
||||
"expires_in": {
|
||||
"type": "integer",
|
||||
"example": 216000
|
||||
}
|
||||
}
|
||||
},
|
||||
"sanctum": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"access_token": {
|
||||
"type": "string",
|
||||
"example": "2|5NJcqQ8YixX8NIhvKZpGoW1x4BUzhEsshSiIbCFFce48f27f"
|
||||
},
|
||||
"token_type": {
|
||||
"type": "string",
|
||||
"example": "bearer"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -241,7 +292,19 @@
|
||||
},
|
||||
"RegisterRequest": {
|
||||
"type": "object",
|
||||
"required": ["firstname", "lastname", "email", "password", "captcha_answer"],
|
||||
"required": [
|
||||
"firstname",
|
||||
"lastname",
|
||||
"gender",
|
||||
"email",
|
||||
"confirm_email",
|
||||
"cellphone",
|
||||
"city",
|
||||
"state",
|
||||
"zip",
|
||||
"accept_school_policy",
|
||||
"captcha"
|
||||
],
|
||||
"properties": {
|
||||
"firstname": {
|
||||
"type": "string",
|
||||
@@ -251,22 +314,80 @@
|
||||
"type": "string",
|
||||
"example": "Khalil"
|
||||
},
|
||||
"gender": {
|
||||
"type": "string",
|
||||
"example": "Female"
|
||||
},
|
||||
"email": {
|
||||
"type": "string",
|
||||
"format": "email",
|
||||
"example": "parent@example.com"
|
||||
},
|
||||
"password": {
|
||||
"confirm_email": {
|
||||
"type": "string",
|
||||
"example": "Str0ngPass!"
|
||||
"format": "email",
|
||||
"example": "parent@example.com"
|
||||
},
|
||||
"phone": {
|
||||
"cellphone": {
|
||||
"type": "string",
|
||||
"example": "1234567890"
|
||||
"example": "203-555-1234"
|
||||
},
|
||||
"captcha_answer": {
|
||||
"address_street": {
|
||||
"type": "string",
|
||||
"example": "42"
|
||||
"example": "123 Main St"
|
||||
},
|
||||
"apt": {
|
||||
"type": "string",
|
||||
"example": "Apt 4B"
|
||||
},
|
||||
"city": {
|
||||
"type": "string",
|
||||
"example": "New Haven"
|
||||
},
|
||||
"state": {
|
||||
"type": "string",
|
||||
"example": "CT"
|
||||
},
|
||||
"zip": {
|
||||
"type": "string",
|
||||
"example": "06510"
|
||||
},
|
||||
"accept_school_policy": {
|
||||
"type": "boolean",
|
||||
"example": true
|
||||
},
|
||||
"captcha": {
|
||||
"type": "string",
|
||||
"example": "A1B2"
|
||||
},
|
||||
"is_parent": {
|
||||
"type": "boolean",
|
||||
"example": true
|
||||
},
|
||||
"no_second_parent_info": {
|
||||
"type": "boolean",
|
||||
"example": false
|
||||
},
|
||||
"second_firstname": {
|
||||
"type": "string",
|
||||
"example": "Omar"
|
||||
},
|
||||
"second_lastname": {
|
||||
"type": "string",
|
||||
"example": "Khalil"
|
||||
},
|
||||
"second_gender": {
|
||||
"type": "string",
|
||||
"example": "Male"
|
||||
},
|
||||
"second_email": {
|
||||
"type": "string",
|
||||
"format": "email",
|
||||
"example": "second.parent@example.com"
|
||||
},
|
||||
"second_cellphone": {
|
||||
"type": "string",
|
||||
"example": "203-555-4567"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -303,23 +424,37 @@
|
||||
"RegisterResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"status": {
|
||||
"ok": {
|
||||
"type": "boolean",
|
||||
"example": true
|
||||
},
|
||||
"message": {
|
||||
"type": "string",
|
||||
"example": "User registered successfully"
|
||||
},
|
||||
"data": {
|
||||
"registration": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"user": {
|
||||
"$ref": "#/components/schemas/UserSummary"
|
||||
"user_id": {
|
||||
"type": "integer",
|
||||
"example": 4321
|
||||
},
|
||||
"message": {
|
||||
"email": {
|
||||
"type": "string",
|
||||
"example": "Registration successful. Please check your email for verification."
|
||||
"format": "email",
|
||||
"example": "parent@example.com"
|
||||
},
|
||||
"firstname": {
|
||||
"type": "string",
|
||||
"example": "Yara"
|
||||
},
|
||||
"lastname": {
|
||||
"type": "string",
|
||||
"example": "Khalil"
|
||||
},
|
||||
"role": {
|
||||
"type": "string",
|
||||
"example": "parent"
|
||||
},
|
||||
"activation_sent": {
|
||||
"type": "boolean",
|
||||
"example": true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1074,7 +1209,7 @@
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/api/v1/register": {
|
||||
"/api/v1/auth/register": {
|
||||
"post": {
|
||||
"operationId": "register",
|
||||
"tags": ["Auth"],
|
||||
@@ -1473,6 +1608,16 @@
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "parent_ids[]",
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "class_id",
|
||||
"in": "query",
|
||||
@@ -4624,6 +4769,23 @@
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "parent_id",
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "parent_ids[]",
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
|
||||
Reference in New Issue
Block a user