Split PR #522 [3/9]: Core framework (DDD refactor)#559
Split PR #522 [3/9]: Core framework (DDD refactor)#559seanspeaks wants to merge 1 commit intonextfrom
Conversation
Split 3/9 of PR #522 (integration-router-v2). Contains: - DDD/hexagonal architecture refactor for repositories, integrations, handlers - Mongoose removal and Prisma migration for database layer - Admin-scripts repositories in core - Webhook graceful handling for deleted integrations - User authentication middleware with DDD patterns This is the foundation that other split PRs depend on.
|
There was a problem hiding this comment.
We dont use mongoose anymore, everything needs to go through Prisma.
Please remove this.
| @@ -29,7 +29,7 @@ const createHandler = (optionByName = {}) => { | |||
| // If enabled (i.e. if SECRET_ARN is set in process.env) Fetch secrets from AWS Secrets Manager, and set them as environment variables. | |||
| await secretsToEnv(); | |||
|
|
|||
| // Helps reuse the database connection. Lowers response times. | |||
| // Helps mongoose reuse the connection. Lowers response times. | |||
There was a problem hiding this comment.
mongoose is wrong here as well, keep "database"
| @@ -6,7 +6,7 @@ jest.mock('../../../database/prisma', () => ({ | |||
| })); | |||
| jest.mock('../../../database/documentdb-encryption-service'); | |||
|
|
|||
| const { ObjectId } = require('bson'); | |||
| const { ObjectId } = require('mongodb'); | |||
There was a problem hiding this comment.
We should keep using bson here instead of mongodb dependency.
| !filter.externalId && | ||
| !filter.id; | ||
|
|
||
| if (hasOnlyUserId) { |
There was a problem hiding this comment.
We should not add this kind of logic into the repositories.
Ideally we should have an additional method called findCredentialsByUserId
| !filter.externalId && | ||
| !filter.id; | ||
|
|
||
| if (hasOnlyUserId) { |
There was a problem hiding this comment.
We should not add this kind of logic into the repositories.
Ideally we should have an additional method called findCredentialsByUserId
| reverseModuleMap: {}; | ||
| }; | ||
| declare module '@friggframework/associations/model' { | ||
| import { Model } from 'mongoose'; |
There was a problem hiding this comment.
This must be removed, we don't use mongoose anymore, everything needs to go through Prisma.
Please check the whole file and revert if necessary.
| decrypt(ciphertext: string): Promise<string>; | ||
| } | ||
| declare module '@friggframework/encrypt' { | ||
| import { Schema } from 'mongoose'; |
There was a problem hiding this comment.
This must be removed, we don't use mongoose anymore, everything needs to go through Prisma.
Please check the whole file and revert if necessary.
| logs: []; | ||
| declare module '@friggframework/integrations' { | ||
| import { Delegate, IFriggDelegate } from '@friggframework/core'; | ||
| import { Model } from 'mongoose'; |
There was a problem hiding this comment.
This must be removed, we don't use mongoose anymore, everything needs to go through Prisma.
Please check the whole file and revert if necessary.
| declare module "@friggframework/syncs/manager" { | ||
| import Sync from "@friggframework/syncs/sync"; | ||
| declare module '@friggframework/syncs/model' { | ||
| import { Model } from 'mongoose'; |
There was a problem hiding this comment.
This must be removed, we don't use mongoose anymore, everything needs to go through Prisma.
Please check the whole file and revert if necessary.
| @@ -20,10 +20,11 @@ | |||
| "fs-extra": "^11.2.0", | |||
| "lodash": "4.17.21", | |||
| "lodash.get": "^4.4.2", | |||
| "bson": "^4.7.2", | |||
| "mongoose": "6.11.6", | |||
There was a problem hiding this comment.
Remove mongoose and add bson back.
Code reviewFound 10 issues (6 runtime bugs, 4 architecture violations):
frigg/packages/core/integrations/integration-router.js Lines 1715 to 1730 in 134ab7a frigg/packages/core/integrations/integration-router.js Lines 2017 to 2030 in 134ab7a
frigg/packages/core/integrations/integration-router.js Lines 1055 to 1062 in 134ab7a frigg/packages/core/integrations/utils/map-integration-dto.js Lines 28 to 39 in 134ab7a
frigg/packages/core/database/models/IndividualUser.js Lines 39 to 48 in 134ab7a
frigg/packages/core/handlers/routers/admin.js Lines 75 to 82 in 134ab7a frigg/packages/core/handlers/routers/admin.js Lines 195 to 215 in 134ab7a
frigg/packages/core/database/models/WebsocketConnection.js Lines 3 to 36 in 134ab7a
Note: This review aligns with the 29 inline comments already left by @d-klotz -- none of those appear to have been addressed yet. The v2 route bugs (issues 1, 3) and the 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |




Summary
Stack
This is PR 3 of 9 splitting #522 into reviewable chunks:
claude/split-522-01-docsclaude/split-522-02-schemasclaude/split-522-04-admin-scriptsclaude/split-522-05-ai-agentsclaude/split-522-06-ui-libclaude/split-522-07-cliclaude/split-522-08-management-uiclaude/split-522-09-e2e-and-lockfileTest plan
npm test -w packages/core)https://claude.ai/code/session_01D3qzNKrmQXgSJoV6BJkcbQ