Cybersecurity-Projects/PROJECTS/beginner/canary-token-generator/backend/internal/event
CarterPerez-dev b3fd75b680 feat(canary): Event.AttachGeoIP + event.Service geo enrichment
- entity: (*Event).AttachGeoIP(geoip.Lookup) sets Geo* nullable
  pointer fields with overwrite semantics (empty/zero collapses to
  nil so DB column stays NULL). Single-arg signature matches the
  call shape in design spec §9 (line 1437) and keeps the helper
  symmetric with the geoip.Lookup value type.
- service: ServiceConfig.GeoIP geoip.Lookuper plumbed through to
  the Service.geo field. Record now calls enrichGeo(evt) BEFORE
  s.repo.Insert so geo_country/region/city/asn/asn_org persist in
  the same row. enrichGeo is nil-safe on three axes (geo, evt,
  evt.SourceIP) — geo enrichment is best-effort, never an error
  path.
- service_test: fakeLookuper + newSvcWithGeo helper; five new
  tests (enriches-before-insert, no-geo-leaves-nil, empty-IP-
  skips-lookup, NopService-leaves-nil, best-effort-when-insert-
  fails). All pre-existing tests pass unchanged because GeoIP
  defaults to nil.
- entity_test: seven AttachGeoIP unit tests covering populate-all,
  empty Lookup, partial fields, zero/negative ASN guards, overwrite
  semantics, and ASN-pointer independence from the input value.
- integration_test: two real-Postgres tests (stub Lookuper writes
  populated geo_* columns; NopService leaves them NULL) verify
  the wiring round-trips through the Insert SQL.
2026-05-17 05:24:17 -04:00
..
contract.go feat(canary): event + notify domain — contracts, senders, services 2026-05-14 00:30:42 -04:00
dto.go feat(canary): Phase 1 — Postgres schema + token & event repositories 2026-05-10 05:47:24 -04:00
entity.go feat(canary): Event.AttachGeoIP + event.Service geo enrichment 2026-05-17 05:24:17 -04:00
entity_test.go feat(canary): Event.AttachGeoIP + event.Service geo enrichment 2026-05-17 05:24:17 -04:00
integration_test.go feat(canary): Event.AttachGeoIP + event.Service geo enrichment 2026-05-17 05:24:17 -04:00
repository.go feat(canary): admin handler (stats + tokens list + disable) + repo methods 2026-05-14 06:57:28 -04:00
repository_test.go feat(canary): admin handler (stats + tokens list + disable) + repo methods 2026-05-14 06:57:28 -04:00
service.go feat(canary): Event.AttachGeoIP + event.Service geo enrichment 2026-05-17 05:24:17 -04:00
service_test.go feat(canary): Event.AttachGeoIP + event.Service geo enrichment 2026-05-17 05:24:17 -04:00