Commit graph

226 commits

Author SHA1 Message Date
d92b579efa
Don't require the ID to be set when inserting contact_phone entries
Some checks failed
/ golint (push) Failing after 9s
Issue: #27
2026-05-24 21:38:59 +00:00
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
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
74ef9a8b3a
Return text log data on insert
So we can show log messages and stuff.
2026-05-21 23:12:37 +00:00
3cfd3182e9
Drop the unnecessary contact_email column
Issue: #13
2026-05-21 23:12:37 +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
d120ed05f2
Emit communication updated events when reports change
Some checks failed
/ golint (push) Failing after 10s
2026-05-21 04:26:07 +00:00
594bf33b0a
Fix updating contact by ID 2026-05-21 04:25:36 +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
72eef554ea
Fix creation of nuisance reports
Some checks failed
/ golint (push) Failing after 9s
Issue: #9
2026-05-20 23:17:57 +00:00
4ead6ba31b
Increase DB connections to 10
Seeing if it helps sort out the DB pool getting exhausted

Issue: #3
2026-05-19 20:32:35 +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
1f7b4cede2
lint: remove embedded field that's unnecessary 2026-05-19 15:24:56 +00:00
12e9599c15
lint: don't capitalize error messages 2026-05-19 15:24:44 +00:00
14e95a2fe0
Remove unused stored procedure function 2026-05-19 15:14:06 +00:00
71463433e7
Add missing user query file
Some checks failed
/ golint (push) Failing after 3m52s
2026-05-19 15:04:25 +00:00
47aebd0237
Remove unused db/prepared functions
Some checks failed
/ golint (push) Failing after 2m50s
Fixes some lint
2026-05-19 14:45:52 +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
2093ea74c4
Pass pool management on to pgxpool
Some checks failed
/ golint (push) Failing after 3m56s
Rather than letting Bob create a pool-on-pool.
2026-05-19 00:02:13 +00:00
1c8b13b31e
Restore accidentally removed platform mailer by ID func
Needed by the mailer resource
2026-05-16 18:12:01 +00:00
feff03428f
Actually allocate result arrays 2026-05-16 18:11:44 +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
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
8e0ac790f1
Return all communications from the DB
We'll filter on the frontend
2026-05-11 23:23:01 +00:00
3a3cd78cac
Only show communications that are 'new' or 'opened' 2026-05-11 23:22:43 +00:00
27596aff20
Fix insertion of communication log entries when marking 2026-05-11 23:22:41 +00:00
57eea3a08a
Fix reference to enum value in SQL
Without this we get a runtime crash querying the DB :(
2026-05-11 23:22:09 +00:00
d1935d31af
Sort communication by recency 2026-05-11 23:22:09 +00:00
93510e4b2e
Properly insert nuisance and water public reports 2026-05-11 23:22:07 +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
4008b9aa25
lint: fix errcheck for txn.Rollback/Commit and r.Close
Use lint.LogOnErrRollback for deferred Rollback in test-jet.
Use lint.LogOnErrCtx for Commit in test-jet.
Use lint.LogOnErr for r.Close in ExecuteNoneTxBob.
2026-05-09 02:14:47 +00:00
970cd568dc
Add generated jet tables and models
These will change with schema changes
2026-05-09 01:54:12 +00:00
935800e334
Switch to using the Gleipnir fork of jet
Because we need those sweet, sweet geometry columns
2026-05-09 01:48:56 +00:00
24a3610c4c
Correctly build updaters with New
Otherwise we have nil columns
2026-05-08 22:22:52 +00:00
7da653efc6
Avoid a DB query if there are no address IDs 2026-05-08 22:21:56 +00:00
735a9dc1d2
Properly close rows on empty results
I we don't do this we get "conn busy" errors.
2026-05-08 22:21:27 +00:00
f2585c569c
Woops, actually set all columns on compliance because it doesn't have a serial key 2026-05-08 01:08:06 +00:00
0fc46d5916
Only set mutable columns on insert
Because we don't want to set ID and other primary keys
2026-05-08 00:56:55 +00:00
61ad3fbe45
Remove string-based queries for public report data
Use the new jet hotness
2026-05-07 23:22:50 +00:00
12213fb31b
Remove string-only references to location_* generated columns 2026-05-07 17:01:54 +00:00
7a361a330d
Remove now-extraneous latitude/longitude generated columns
Now that we can pull out the geometry directly into a go object we don't
need these and they complicate our insertions
2026-05-07 16:38:42 +00:00
fcd95f1a25
Get back to compiling, but using new jet for publicreport
This was an epically long change, and a terrible idea, but it compiles.
This was essentially a cascade that came about because I can't blend jet
and bob in the same transaction. In for a penny, I guess...
2026-05-07 10:39:17 +00:00
a95e44cf42
Use transactions to set the communication status changes
Not doing it yet, but soon we'll do log entries for them.
2026-05-04 20:57:50 +00:00