|
Fix Model layer & API robustness batch (7 items)
- Entity::update() now checks rowCount; returns false when no rows affected. - Entity::update() preserves modified_fields on PDOException (try/catch). - Device::set_device_token() caches auth() call instead of 3 repeated invocations. - User::__construct() removed eager profile query; profile() now lazy-loads via get_pet_instance(). - alias_is_uniq() in Areas and Devices models accepts optional exclude_id to skip self on update. - Controllers updated to pass entity id to alias_is_uniq() so updating alias to current value succeeds. - CronController::run_regular_cron_scripts() wraps each script in try/catch; logs failure and continues. - App::api_auth_guard() replaced exit() with return false; EventsHandlers stops routing on auth rejection. - Tests added: EntityCrud (missing-record + preserved-fields), UserEntity (lazy-loading), CronController (failure-continuation), AppAuthGuard (structured 401 output), Areas/Devices validation (same-alias update allowed). - Test bootstrap: added logs_enable/logs_folder to FCONF to suppress PHP warnings in Cron tests. All 136 server tests pass, 334 assertions. All 167 Vue client tests pass. |
|---|
|
|
| server/SHServ/App.php |
|---|
| server/SHServ/Controllers/AreasRESTAPIController.php |
|---|
| server/SHServ/Controllers/CronController.php |
|---|
| server/SHServ/Controllers/DevicesRESTAPIController.php |
|---|
| server/SHServ/Entities/Device.php |
|---|
| server/SHServ/Entities/User.php |
|---|
| server/SHServ/EventsHandlers.php |
|---|
| server/SHServ/Middleware/Entity.php |
|---|
| server/SHServ/Models/Areas.php |
|---|
| server/SHServ/Models/Devices.php |
|---|
| server/tests/AppAuthGuardTest.php |
|---|
| server/tests/AreasRESTAPIControllerValidationTest.php |
|---|
| server/tests/CronControllerTest.php 0 → 100644 |
|---|
| server/tests/DevicesRESTAPIControllerValidationTest.php |
|---|
| server/tests/EntityCrudTest.php |
|---|
| server/tests/UserEntityTest.php 0 → 100644 |
|---|
| server/tests/bootstrap.php |
|---|