Repository navigation
refactor: move notification and staff tables into their modules - #177
Merged
axelhamil merged 2 commits intoNov 10, 2026
Merged
Conversation
The notification tables now live in modules/notifications/schemas and the staff tables in modules/admin/schemas, importing the kit tables through the @packages/drizzle sub-paths. packages/drizzle stops re-exporting them and no longer depends on @packages/events, so its schema folder holds kit tables only. The notification fan-out read the staff tables of the admin module. It now asks for its staff audience through IStaffRecipientsReader, a port the notifications module declares, served by a host query in apps/api/src/queries and bound in the container. The query keeps the same SQL and runs in the fan-out's unit of work, so the audience is read in the transaction that inserts the notifications. Owners import their schema relatively; host services, routes, seeds and check scripts go through the module schemas export. The database is untouched, db:generate finds no change and db:push yields the same schema as develop. Closes #173
The fan-out bound one parameter per staff recipient, so an audience past the 65,535 parameters of a Postgres bind message failed every delivery, where develop read it in a subquery. The ids now travel as a single text array, which also keeps the statement text stable whatever the audience size; an empty list still yields no row. A failed staff read was captured twice, once by the host query that owns the I/O and once by the subscriber when the failure came back as an AppErrorException. The subscriber now only propagates that typed failure and still captures every other error. The IStaffRecipientsReader binding moves from container.ts to composition/sources/notifications.ts, where the host binds the ports a module declares.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
notification.tsmoves tomodules/notifications/schemas/,staff.tstomodules/admin/schemas/, kit tables imported through@packages/drizzle/schema/*packages/drizzlere-exports no business table and drops its@packages/eventsdependency:src/schema/now holds kit tables onlyIStaffRecipientsReader, declared by notifications, served by the host queryapps/api/src/queries/staff-recipients.query.ts(same SQL, same unit of work)@modules/<owner>/schemas/<file>db:generateempty,pg_dump --schema-onlyidentical to develop, a probe column was detected by the negative testdb:seedincluded), api image buildsCloses #173