remove codeigniter
This commit is contained in:
@@ -76,7 +76,7 @@ This document lists every API controller alphabetically with any inline route co
|
||||
**File:** `app/Http/Controllers/Api/Auth/AuthController.php`
|
||||
**Purpose:** JWT-backed authentication endpoints.
|
||||
|
||||
- `POST /api/v1/auth/login` (`login`) – Validates `email` and `password`, looks up the user case-insensitively, uses `ci_password_verify`, and returns `{access_token, token_type, expires_in}` or `401`.
|
||||
- `POST /api/v1/auth/login` (`login`) – Validates `email` and `password`, looks up the user case-insensitively, uses `verify_stored_password`, and returns `{access_token, token_type, expires_in}` or `401`.
|
||||
- `GET /api/v1/auth/me` (`me`) – Requires a valid bearer token, returns the decoded `User` JSON via `JWTAuth::parseToken()->authenticate()`.
|
||||
- `POST /api/v1/auth/logout` (`logout`) – Invalidates the caller’s JWT token (best-effort) and returns `{message: "Logged out"}` even if the token was already invalid.
|
||||
|
||||
@@ -95,13 +95,13 @@ This document lists every API controller alphabetically with any inline route co
|
||||
|
||||
## BaseApiController
|
||||
**File:** `app/Http/Controllers/Api/BaseApiController.php`
|
||||
**Purpose:** Shared foundation for every API controller. Wraps the Laravel request in a `CiRequestAdapter`, standardizes JSON responses, bridges CodeIgniter-style validation rules, and exposes helper utilities.
|
||||
**Purpose:** Shared foundation for every API controller. Wraps the Laravel request in a `request adapter`, standardizes JSON responses, bridges legacy-style validation rules, and exposes helper utilities.
|
||||
|
||||
- **Response helpers:** `success`, `error`, and the `respond*` variants keep payloads consistent (`{status, message, data}`) and map to the right HTTP codes (`200`, `201`, `204`, `400`, `422`, etc.).
|
||||
- **Validation bridge:** `validateRequest`, `validate`, `payloadData`, and `normalizeRules` accept CodeIgniter rule strings (e.g., `max_length[255]`, `permit_empty`) and translate them to Laravel validator syntax before running `Validator::make`.
|
||||
- **Validation bridge:** `validateRequest`, `validate`, `payloadData`, and `normalizeRules` accept legacy rule strings (e.g., `max_length[255]`, `permit_empty`) and translate them to Laravel validator syntax before running `Validator::make`.
|
||||
- **Pagination:** `paginate($source, $page, $perPage)` works with Eloquent builders, query builders, or arrays, returning `{data, pagination:{current_page, per_page, total, total_pages}}`.
|
||||
- **Session context:** `getCurrentUserId()` reads the `user_id` from the session, and `getCurrentUser()` fetches the hydrated `UserModel` record, falling back to querying `user_roles` if roles are missing from the session cache.
|
||||
- **Constructor:** captures the Laravel `Request` and exposes it as `$this->request` via `CiRequestAdapter` so consuming controllers can continue to use familiar CI-style helpers (`getGet`, `getJSON`, etc.).
|
||||
- **Constructor:** captures the Laravel `Request` and exposes it as `$this->request` via `request adapter` so consuming controllers can continue to use familiar legacy-style helpers (`getGet`, `getJSON`, etc.).
|
||||
|
||||
## BroadcastEmailController
|
||||
**File:** `app/Http/Controllers/Api/BroadcastEmailController.php`
|
||||
@@ -121,14 +121,14 @@ This document lists every API controller alphabetically with any inline route co
|
||||
- `PATCH /api/v1/calendar/{id}` (`update`) – Allows partial updates to the same fields; returns the refreshed record.
|
||||
- `DELETE /api/v1/calendar/{id}` (`delete`) – Removes the event and returns the standard success envelope.
|
||||
|
||||
## CiRequestAdapter
|
||||
**File:** `app/Http/Controllers/Api/CiRequestAdapter.php`
|
||||
**Purpose:** Lightweight shim that lets the Laravel request behave like CodeIgniter’s `$this->request`.
|
||||
## request adapter
|
||||
**File:** `app/Http/Controllers/Api/request adapter.php`
|
||||
**Purpose:** Lightweight shim that lets the Laravel request behave like legacy’s `$this->request`.
|
||||
|
||||
- `getGet()` / `getPost()` – Mirror CI helpers by returning either all query/form params or a single key with a default.
|
||||
- `getGet()` / `getPost()` – Mirror legacy helpers by returning either all query/form params or a single key with a default.
|
||||
- `getJSON($assoc = false)` – Parses the raw body once and returns decoded JSON (array/object).
|
||||
- `getVar()` – Unified accessor that checks body/query for a key.
|
||||
- `getHeader()` / `getHeaderLine()` – Pull HTTP headers using familiar CI naming.
|
||||
- `getHeader()` / `getHeaderLine()` – Pull HTTP headers using familiar legacy naming.
|
||||
- `getFile()` – Returns the uploaded file object (if any) for the key.
|
||||
- `getRawInput()` – Gives the unparsed request body string.
|
||||
- `all()` – Aggregates query, form, and JSON payloads into a single array—handy when migrating legacy controllers.
|
||||
@@ -1140,7 +1140,7 @@ This document lists every API controller alphabetically with any inline route co
|
||||
- Purchase order header with supplier name
|
||||
- Array of line items with supply names and units (if supply_id maps to inventory_items)
|
||||
- Returns 404 if not found
|
||||
- `POST /api/v1/purchase-orders` (`store`) – Create a new purchase order with line items. Supports both CodeIgniter-style form arrays and modern JSON format. Body parameters:
|
||||
- `POST /api/v1/purchase-orders` (`store`) – Create a new purchase order with line items. Supports both legacy-style form arrays and modern JSON format. Body parameters:
|
||||
- `po_number` (string, required) – Purchase order number
|
||||
- `supplier_id` (integer, required) – Supplier ID
|
||||
- `order_date` (date, required) – Order date (Y-m-d format)
|
||||
@@ -1154,7 +1154,7 @@ This document lists every API controller alphabetically with any inline route co
|
||||
- `description` (string, optional) – Item description
|
||||
- `quantity` (integer, required) – Quantity ordered
|
||||
- `unit_cost` (float, required) – Unit cost
|
||||
- **CodeIgniter-style form arrays:**
|
||||
- **legacy-style form arrays:**
|
||||
- `item_supply_id[]` (array, required) – Array of supply IDs
|
||||
- `item_description[]` (array, optional) – Array of descriptions
|
||||
- `item_quantity[]` (array, required) – Array of quantities
|
||||
@@ -1183,7 +1183,7 @@ This document lists every API controller alphabetically with any inline route co
|
||||
- All endpoints require authentication (`auth:api` middleware)
|
||||
- Purchase orders support statuses: 'draft', 'ordered', 'received', 'canceled'
|
||||
- When receiving items, the system automatically updates inventory quantities and creates movement records
|
||||
- The `store` method supports both legacy CodeIgniter form array format and modern JSON format for backward compatibility
|
||||
- The `store` method supports both legacy form array format and modern JSON format for backward compatibility
|
||||
- Line items are validated to ensure at least one valid item with quantity > 0
|
||||
- All financial calculations (subtotal, tax, total) are performed automatically
|
||||
- Database transactions ensure data consistency when creating POs or receiving items
|
||||
|
||||
Reference in New Issue
Block a user