clqms-be/.serena/memories/task_completion.md

68 lines
2.3 KiB
Markdown

# CLQMS Task Completion Checklist
When completing a task, ensure:
## 1. Tests Pass
```bash
./vendor/bin/phpunit
```
- All existing tests must pass
- Add new tests for new features
- Test naming: `test<Action><Scenario><Result>`
## 2. API Documentation Updated (CRITICAL)
When updating ANY controller, update corresponding OpenAPI YAML:
| Controller | YAML Path File | YAML Schema File |
|-----------|----------------|------------------|
| `PatientController` | `paths/patients.yaml` | `components/schemas/patient.yaml` |
| `PatVisitController` | `paths/patient-visits.yaml` | `components/schemas/patient-visit.yaml` |
| `OrderTestController` | `paths/orders.yaml` | `components/schemas/orders.yaml` |
| `SpecimenController` | `paths/specimen.yaml` | `components/schemas/specimen.yaml` |
| `TestsController` | `paths/tests.yaml` | `components/schemas/tests.yaml` |
| `AuthController` | `paths/authentication.yaml` | `components/schemas/authentication.yaml` |
| `ResultController` | `paths/results.yaml` | `components/schemas/*.yaml` |
| `EdgeController` | `paths/edge-api.yaml` | `components/schemas/edge-api.yaml` |
| `LocationController` | `paths/locations.yaml` | `components/schemas/master-data.yaml` |
| `ValueSetController` | `paths/valuesets.yaml` | `components/schemas/valuesets.yaml` |
| `ContactController` | `paths/contact.yaml` | (inline schemas) |
After updating YAML files:
```bash
node public/bundle-api-docs.js
```
## 3. Code Quality Checks
- PSR-12 compliance where applicable
- No database queries in controllers
- Use transactions for multi-table operations
- Proper error handling with try-catch for JWT/external calls
- Log errors: `log_message('error', $message)`
## 4. Response Format Verification
Ensure all responses follow the standard format:
```php
return $this->respond([
'status' => 'success|failed',
'message' => 'Description',
'data' => $data
], $httpStatus);
```
## 5. Security Checklist
- Use `auth` filter for protected routes
- Sanitize user inputs
- Use parameterized queries
- No secrets committed to repo (use .env)
## 6. Naming Conventions
- Classes: PascalCase
- Methods: camelCase
- Properties: snake_case (legacy) / camelCase (new)
- Database columns: PascalCase (legacy convention)
## 7. Do NOT Commit Unless Explicitly Asked
- Check status: `git status`
- Never commit .env files
- Never commit secrets