Refactor: Centralize Prisma schema and restrict DB access
This commit refactors the project to use a shared Prisma schema and restricts direct database access to the API service. Key changes: - Created a new shared package `core/prisma` containing the Prisma schema, generated client, and types. - Configured the monorepo to use NPM workspaces, including `core/prisma` and all services. - Updated all services (`api`, `ui`, `mcp`, `agent`, and the background processing service) to depend on `@empresa/prisma-schema`. - The API service now imports `PrismaClient` from `@empresa/prisma-schema/client`. - Other services import only types from `@empresa/prisma-schema`. - Removed redundant Prisma configurations from `api` and the background processing service. - Updated the background processing service's `sync-empleados.js` to fetch data via an API call instead of direct database access. - Updated TypeScript configurations (`tsconfig.base.json` and service-specific ones) to support the new structure and path aliases. - Updated `README.md` to reflect the new architecture and added convenience scripts for Prisma operations. This change promotes a single source of truth for data models, reduces code duplication, and improves the overall architecture by centralizing database operations within the API service.
This commit is contained in:
14
agent/jsconfig.json
Normal file
14
agent/jsconfig.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"extends": "../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"checkJs": false,
|
||||
"resolveJsonModule": true,
|
||||
"moduleResolution": "node",
|
||||
"target": "esnext", // Or appropriate target for your Node.js version
|
||||
"module": "esnext", // Since package.json has "type": "module"
|
||||
// Paths are inherited from tsconfig.base.json
|
||||
"baseUrl": "." // baseUrl is still needed if there are other local paths
|
||||
},
|
||||
"include": ["**/*.js"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
@@ -15,6 +15,7 @@
|
||||
"@open-wa/wa-automate": "^4.34.3",
|
||||
"mime-types": "^2.1.35",
|
||||
"@modelcontextprotocol/sdk": "^1.0.0",
|
||||
"@philschmid/weather-mcp": "^1.0.0"
|
||||
"@philschmid/weather-mcp": "^1.0.0",
|
||||
"@empresa/prisma-schema": "1.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user