Commit graph

397 commits

Author SHA1 Message Date
e8f899d098
Don't bonk when we have no E164s 2026-05-23 01:02:47 +00:00
5b0d009353
Get text messages for a contact and the phone status
Some checks failed
/ golint (push) Failing after 10s
2026-05-23 00:48:16 +00:00
5d03ab0844
Commit DB transaction after responding 2026-05-22 23:43:49 +00:00
393836a86a
Fix notification of job happening before transaction is closed
This is kind of a wild one. Turns out that the triggers I was using
actually fire before the transaction is closed and I was primarily
getting lucky that the job was present on the other side of the
connection rather than having things built correctly.

I've fixed this by removing the trigger entirely and instead manually
triggering as part of the transaction. This makes the NOTIFY call happen
as soon as the transaction closes, just at the cost of making my
application be in charge of ensuring the NOTIFY gets called. Seems like
a win.

Part of doing this is porting the existing job creation code over to use
Jet. It's something I want to do anyway, so it's a win all around.
2026-05-22 23:34:38 +00:00
7b04822a9b
Move properties of phones to the phone, not contact_phone
This makes sense because there will naturally be cases where multiple
districts have the same phone number mapped to different contacts.
2026-05-22 20:56:22 +00:00
f957dc6982
Migrate contact_email and contact_phone to allow dupes
The key item here is that comms.phone and comms.email are meant to
represent a real global namespace, but comms.contact is meant to
represent an organization-specific namespace. This means the mapping,
comms.contact_phone and comms.contact_email can't key off the global
namespace. Otherwise the contact namespace would implicitly be global.
2026-05-22 15:13:03 +00:00
6175e1a811
Update reporter contact on report update
This is as a complicated one because it involves merging contact
information in tricky cases.

I assume that phone should override email, primarily because setting up
phones is more tightly regulated. This may be a terrible assumption.

Issue: #13
2026-05-21 23:12:36 +00:00
dcce7cda1c
Remove comms.contact_email.id column
The address is the primary key, rather than an ID.
2026-05-21 23:12:36 +00:00
e3cc1e99d1
Update storage of reporter in contact
I failed to retrieve the data correctly before as part of the changeover
to contact records.

Issue: #13
2026-05-21 23:12:36 +00:00
41ed443d54
lint: log errors when adding errors from flyover uploads 2026-05-21 13:56:48 +00:00
d120ed05f2
Emit communication updated events when reports change
Some checks failed
/ golint (push) Failing after 10s
2026-05-21 04:26:07 +00:00
5e103f46a0
Fix populating water report from ID, make ContactSimple
ContactSimple is the replacement for ContactReporter, which was the
simplified form of a contact from a report. I made the name more generic
and use it in the general report structures for consistency.
2026-05-21 03:23:10 +00:00
75d0283453
Emit communication creation event for submitting compliance reports 2026-05-20 23:55:45 +00:00
66dc3a171e
Create communication creation events for non-compliance reports 2026-05-20 23:53:52 +00:00
9d2895bd94
lint: Remove unused mailerQuery
Some checks failed
/ golint (push) Failing after 9s
2026-05-19 23:02:01 +00:00
44c0356bcc
remove log spam for getting user information
Some checks failed
/ golint (push) Failing after 10s
2026-05-19 22:07:52 +00:00
865f11bc09
Disable fieldseeker data sync
Some checks failed
/ golint (push) Failing after 9s
This is creating a large number of goroutines that are requesting a
large number of database connections, possibly contributing to the pool
getting exhausted

Issue: #3
2026-05-19 20:33:02 +00:00
81826f853e
Clean up unused import
Some checks failed
/ golint (push) Failing after 3m57s
2026-05-19 16:23:10 +00:00
0a3e70d418
lint: Avoid ending the loop on error
Some checks failed
/ golint (push) Failing after 2m47s
Caused by the lint bot, which actually produced another lint error
2026-05-19 16:06:41 +00:00
7237f5f666
Move internal references to new source hosting
Some checks failed
/ golint (push) Failing after 3m50s
2026-05-19 15:33:57 +00:00
e2bd38d665
Hide LLM responses behind a config flag
Some checks failed
/ golint (push) Has been cancelled
...that we never use. I'm just turning it off for now, but I want the
linter to think it could be live at any moment.
2026-05-19 15:11:16 +00:00
77ea99647e
Use new jet query for getting users from org ID
Some checks failed
/ golint (push) Has been cancelled
This is to try to avoid an area where we know our query pool is getting
blocked. Related to issue #3.
2026-05-19 14:43:20 +00:00
3cafca6cbd
Set contact ID when creating a report
Some checks failed
/ golint (push) Failing after 3m51s
For now we just set it to the empty contact, which is a bit weird, and
wrong until we fix the update logic.
2026-05-19 00:39:53 +00:00
15d8966971
Add context timeouts for third-party requests
Some checks failed
/ golint (push) Failing after 3m56s
Avoid hanging a goroutine for a long time.
2026-05-19 00:24:40 +00:00
e93c88003e
Avoid emitting errors on duplicate Stadia requests 2026-05-18 23:51:56 +00:00
821303d7f9
Don't show magic Nidus contact 2026-05-18 15:22:24 +00:00
6db5186318
Don't send contacts with no data
These are a result of reports that are attached to contacts with no
data.
2026-05-18 15:20:06 +00:00
1c8b13b31e
Restore accidentally removed platform mailer by ID func
Needed by the mailer resource
2026-05-16 18:12:01 +00:00
725945d95c
WIP: creating contact resource
Some checks failed
/ golint (push) Has been cancelled
2026-05-15 20:10:14 +00:00
f1fe8b4d2b
Add contacts, rework comms schema
This in a pretty huge change. At a high level we're adding the concept
of a 'contact' which is a person or organization that has zero or more
contact methods (email, phone). This ended up cascading a number of
changes, including critically to the publicreprt schema. In the end it
seemed safer to get to the point where I'm confident we aren't using any
of the old fields for storing reporter information (though I haven't
deleted the columns yet) so I removed the code for defining those
columns.

At this point I think it's not possible for me to regenerate the bob
schema due to the interdependencies between my various schemas, so the
migration is well-and-truly happening.
2026-05-15 16:58:28 +00:00
085935fa66
Get email websocket connection working 2026-05-13 16:50:31 +00:00
999d69365c
More tracing logging 2026-05-12 20:00:29 +00:00
3faf29d761
Remove debug logs on setting up related resources 2026-05-12 18:04:40 +00:00
b41839a5ee
Add missing "created" field on related record 2026-05-12 18:04:40 +00:00
e569bb32b7
Start work on populating context of communication at API layer
Remove communication stub, it's a performance enhancement.
2026-05-12 18:04:39 +00:00
b369361a43
Initial work on getting communication context
Committing now to debug build process.
2026-05-12 18:04:39 +00:00
40ffc2a3ba
lint: remove unused sync/signin, sync/sms, platform/trap, platform/arcgis code
- Delete sync/signin.go (entirely unused, no routes registered)
- Delete sync/sms.go (entirely unused, no routes registered)
- Remove toTemplateTrapData and fsToTime from platform/trap.go
- Remove 8 orphaned helper functions from platform/arcgis.go
2026-05-12 14:35:46 +00:00
fa27f79911
Implement GET on a single communication object 2026-05-11 23:26:22 +00:00
d992eee560
Emit updated events for communication resources on mark 2026-05-11 23:22:59 +00:00
93510e4b2e
Properly insert nuisance and water public reports 2026-05-11 23:22:07 +00:00
e9127466f0 lint: remove unused code from platform/label_studio, email, dashboard, sync
- Delete sync/text.go, sync/tile.go, platform/dashboard.go (entirely unused)
- Remove unused vars/funcs from platform/label_studio.go (9 items)
- Remove contentEmailInitial, contentEmailReportConfirmation,
  newContentEmailNotificationConfirmation, contentEmailBase from platform/email
2026-05-09 20:14:38 +00:00
10046f1edb lint: remove unused items from resource, sync, platform, db
- Remove contentUploadList/Placeholder/Detail from resource/upload.go
- Remove toImageURLs, userURI from resource/communication.go
- Remove responseListUser from resource/user.go
- Remove contentSignin/getSignin from sync/signin.go (re-add contentSignin used elsewhere)
- Delete sync/service-request.go (entirely unused)
- Remove _rowWithID from platform/signal.go
- Remove unused tag field from db/tx.go Rows struct
2026-05-09 17:19:38 +00:00
b9a68aab04 lint: remove unused code from platform/arcgis.go, platform/text, rmo
- Remove 7 unused functions from platform/arcgis.go (generateCodeChallenge,
  generateCodeVerifier, newTimestampedFilename, logResponseHeaders, saveResponse,
  saveOrUpdateDBRecords, rowmapViaQuery) plus orphaned stubs
- Delete platform/text/db.go (entirely unused)
- Remove insertTextLog from platform/text/send.go
- Delete rmo/image.go, rmo/mailer.go, rmo/scss.go, rmo/district.go, rmo/water.go
2026-05-09 17:10:03 +00:00
53a3f9816a lint: remove unused code across api, comms, h3utils, html, middleware, minio, platform, rmo
Deleted files: api/compliance.go, api/debug.go, rmo/compliance.go, rmo/email.go,
rmo/mock.go, platform/publicreport/address.go

Removed unused functions/types from: api/api.go, api/configuration.go, api/district.go,
api/publicreport.go, api/sudo.go, api/types.go, comms/text/twilio.go,
comms/text/voipms.go, h3utils/h3.go, html/embed.go, html/form.go,
middleware/terminal.go, minio/client.go, platform/csv/csv.go,
platform/csv/flyover.go, platform/file/base.go, platform/file/upload.go,
platform/geocode/address.go, platform/types/service_request.go
2026-05-09 14:47:56 +00:00
d74c24339e lint: finish errcheck — zero remaining
Fix final cW calls in middleware/recoverer.go and
sendTextCommandResponse in platform/text/text.go.
2026-05-09 14:24:33 +00:00
7270de2937 lint: fix remaining errcheck issues across multiple files
- Fix renderShim errcheck in district.go, image.go
- Fix txn.Rollback/Commit in publicreport.go, notification, review, signal, upload
- Fix addError calls in csv/flyover.go, csv/pool.go
- Fix cW/write calls in logger.go, recoverer.go, voipms.go
- Fix resendInitialText, handleWaitingTextJobs, setPhoneStatus in text/send.go, text.go
- Fix populateDistrictURI/populateReportURI in resource files
2026-05-09 03:06:56 +00:00
808e172221
lint: fix remaining errcheck for Write, Fprintf, Rollback, Commit
- Use lint.Write for unchecked w.Write in handlerJSONPost/Put, report
- Use lint.Fprintf for fmt.Fprintf in twilio handlers
- Use lint.LogOnErrRollback for deferred Rollbacks in compliance, lead, note
- Check errors from txn.Commit in lead, note
- Use lint.LogOnErrCtx for addError calls in flyover
2026-05-09 02:41:49 +00:00
679d12b48f
lint: fix errcheck for txn calls, query results, and unchecked errors
- Fix Rollback/Commit in compliance.go, csv/csv.go, csv/pool.go
- Capture and check errors from .One() insert queries in send.go, text.go
- Check errors from markFunc, PopulateURL, and hydrate functions
- Use lint.LogOnErrCtx for best-effort notification sends
2026-05-09 02:35:55 +00:00
0ec810591e
lint: fix errcheck for Close and Write calls across multiple files
Use lint.LogOnErr for deferred Body/File/Client Close calls.
Use lint.Write for unchecked w.Write calls.
Fix bug in sync/sms.go where fmt.Errorf result was discarded
(replace with proper log.Error call).
2026-05-09 02:29:07 +00:00
934fb03ca2
lint: fix errcheck for txn.Rollback/Commit and insert in platform
Use lint.LogOnErrRollback for deferred Rollbacks in arcgis.go.
Capture and check errors from txn.Commit and CommunicationLogEntryInsert.
2026-05-09 02:17:25 +00:00