refactor(builder): move growth, comment automation, media library and workspace data access into business - #1098
Open
realcodesiman wants to merge 1 commit into
Open
Conversation
… workspace data access into business Removes direct db usage from reflinks, QR codes, magic links, spreadsheets, fb/ig comment and ig story automations, the media library, presigned upload, workspace members, invitations, error logs, audit logs and the session auth helper per .agents/rules/data-access.md. - new reflink and media-library-folder repositories; new magic-link, media-library and invitation services; listErrorLogs and listAuditLogs query functions - lib/auth/utils.ts uses workspaceMemberService.listByUserIdUncached so the workspace auth gate stays uncached - the public /r/[workspaceId]/[name] route only swaps its two lookups; every response branch is unchanged - validationException added to errors.ts in the same form as #1093 - fb/ig comment and ig story detail lookups now throw notFoundException (404) instead of a bare Error (500) - delete dead features/users/queries (zero callers)
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.
Summary
db.*call from reflinks, QR codes, magic links, spreadsheets, fb/ig comment and ig story automations, the media library, the presigned-upload route, workspace members, invitations, error logs, audit logs and the session auth helper, per.agents/rules/data-access.md.mainand only append to the shared barrels.Changes
reflink,media-library-folder,media-library-file(the last also exists on feat(contacts): cover full public API for MCP, move logic into business services #1093; keep one copy when merging). New services:magic-link,media-library,invitation;listErrorLogsandlistAuditLogsquery functions; methods appended toreflink,qr-code,spreadsheet,fb-comment-automation,ig-story-automation,workspace-member,userservices and thecontact-inbox/filerepositories.apps/builder/src/lib/auth/utils.ts: the membership read now goes throughworkspaceMemberService.listByUserIdUncached(the uncached variant, so the workspace auth gate keeps its immediate-revocation behavior). Nothing else in that file changes.app/r/[workspaceId]/[name]/route.ts(public): only the two lookups are swapped; every response branch and the unattributed-click warn log are unchanged.validationExceptionadded topackages/business/src/errors.tsin the same plain-factory/400 form as feat(contacts): cover full public API for MCP, move logic into business services #1093.features/users/queriesdeleted (zero callers).Notes for reviewers
getFbComment/getIgComment/getIgStorynow thrownotFoundException(404) instead of a bareError(500); same messages, and the only caller swallows the error.media-library-mutations.test.tsmocks the service inline; the real service is covered bypackages/business/__tests__/media-library.service.test.ts.db): the siblingupdate-*/delete-*actions in these features; listed in the plan as follow-ups.Test plan
pnpm --filter @chatbotx.io/database check-types && testpnpm --filter @chatbotx.io/business check-types && test(only the pre-existingads-conversion-rule.service.test.tsfailures remain, also red onmain)pnpm --filter builder check-types && testpnpm lint/r/<ws>/<name>with and without?code=→ 302; media-library upload/move/favourite/delete folder; change a member role; accept an invitation