towerops/test/towerops_web/controllers
Graham McIntire edb82bcc40 feat(coverage): public REST API + KMZ export + email-on-complete
cnHeat-2.0-style automation hooks. Coverage prediction is now a
first-class API resource that Terraform / Ansible / cron can drive.

REST API (under /api/v1, Bearer-token auth scoped to one org)
- GET    /coverages              list
- POST   /coverages               create + auto-queue compute
- GET    /coverages/:id           read (includes status / progress_pct
                                  for polling-based providers)
- PATCH  /coverages/:id           update editable fields
- DELETE /coverages/:id           delete + cleanup
- POST   /coverages/:id/recompute requeue, returns 202
- GET    /coverages/:id/kmz       Google Earth bundle (KML + PNG)

Each response includes the full resource — Terraform read-after-write
reconciles cleanly; status polling hits a stable JSON shape.

Email-on-complete (Towerops.Coverages.Notifier)
- Worker fires deliver_compute_complete on both :ready and :failed
  paths. Sends a short text email to every member of the owning
  organisation with a link to the show page (or the failure
  reason). Mirrors cnHeat 2.0's per-project email alerts.
- Failures are non-fatal: a stuck SMTP relay never blocks the
  underlying coverage record from transitioning state.

KMZ export
- Builds a flat KMZ in-memory via :zip.create — doc.kml +
  overlay.png, with the LatLonBox set from the coverage's bbox.
  XML special chars are escaped. 409 if not yet ready.

Tests (11 new, all green)
- Bearer-token auth happy path + 401 missing
- index / show / create / update / delete + 404 cross-org
- create returns status:'queued' confirming the auto-enqueue
- recompute returns 202 with status:'queued'

Plus docs/terraform-coverages.md showing how to drive the new API
from a third-party restapi provider until the first-party
terraform-provider-towerops gets a coverage resource.
2026-05-06 17:15:57 -05:00
..
api feat(coverage): public REST API + KMZ export + email-on-complete 2026-05-06 17:15:57 -05:00
admin_controller_test.exs fix(tests): enable TOTP in final AdminControllerTest 2026-03-06 07:45:28 -06:00
api_docs_controller_test.exs feat: add Force10 FTOS and optical transceiver monitoring (ProCurve, Comware) 2026-02-12 08:19:12 -06:00
debug_controller_test.exs feat: add critical network switch sensor support (HP Comware, Dell PowerConnect, Dell SONiC) 2026-02-11 17:36:45 -06:00
error_html_test.exs Fix tests, credo issues, and Gaiia sync bugs 2026-02-15 11:55:49 -06:00
error_json_test.exs security: implement comprehensive security audit fixes 2026-03-05 13:08:10 -06:00
health_controller_test.exs security: implement comprehensive security audit fixes 2026-03-05 13:08:10 -06:00
invitation_controller_test.exs refactor/dry-improvements (#202) 2026-03-28 10:56:34 -05:00
page_controller_test.exs feat: add Accept: text/markdown content negotiation for agent compatibility 2026-04-17 14:14:31 -05:00
page_html_test.exs fix: resolve compilation errors, test failures, and credo issues 2026-02-14 12:23:10 -06:00
sitemap_controller_test.exs test: improve sitemap controller test coverage 2026-04-17 14:00:57 -05:00
user_confirmation_controller_test.exs test: add on-call, incident, and PagerDuty notification test coverage 2026-03-14 15:10:27 -05:00
user_registration_controller_test.exs test: add controller and LiveView test coverage for untested endpoints 2026-03-14 15:21:12 -05:00
user_reset_password_controller_test.exs test: expand coverage for devices, workers, and LiveView modules 2026-02-12 09:06:41 -06:00
user_session_controller_test.exs fix user session controller test 2026-02-03 13:42:24 -06:00
user_session_html_test.exs purge more passkey and gettext updates 2026-02-02 10:20:59 -06:00
user_settings_controller_test.exs Convert User Settings from controller to LiveView 2026-01-15 16:29:50 -06:00
user_settings_html_test.exs remove passkeys for now 2026-01-31 09:50:35 -06:00
user_sudo_controller_test.exs fix: address UserSudoController critical issues 2026-02-01 14:45:05 -06:00
well_known_controller_test.exs feat: add /.well-known discovery endpoints for agent readiness 2026-04-17 14:06:51 -05:00