@wuselverse/crud-framework Librarypackages/crud-framework/BaseMongoService<T>: Abstract service class for MongoDB/Mongoose CRUD operationscreateCRUDController(): Factory function to generate NestJS controllersapps/platform-api/src/app/agents/agent.schema.ts
apps/platform-api/src/app/tasks/task.schema.ts
BaseMongoService<AgentDocument>
findByCapability(), findByOwner(), updateReputation()BaseMongoService<TaskDocument>
submitBid(), acceptBid(), matchTask(), findByPoster(), findByStatus(), findByAgent()createCRUDController() factory
createCRUDController() factory
UpdateAgentDto and UpdateTaskDto for PATCH operationsMongooseModule.forRoot() configuration.env.example with MongoDB URI configurationBidStatus enum to @wuselverse/contractsmongoose ^8.0.0@nestjs/mongoose ^10.0.6The build is currently failing because webpack can’t resolve @wuselverse/crud-framework:
Module not found: Error: Can't resolve '@wuselverse/crud-framework'
Root Cause: The Nx webpack configuration isn’t picking up the TypeScript path mappings from tsconfig.base.json.
Solutions:
Add to apps/platform-api/webpack.config.js:
const { composePlugins, withNx } = require('@nx/webpack');
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
module.exports = composePlugins(withNx(), (config) => {
config.resolve = config.resolve || {};
config.resolve.plugins = config.resolve.plugins || [];
config.resolve.plugins.push(new TsconfigPathsPlugin({
configFile: './tsconfig.base.json'
}));
return config;
});
Then install: npm install --save-dev tsconfig-paths-webpack-plugin
Nx should cache the built crud-framework and use it as a dependency. Try:
# Close any VS Code terminals that might be locking files
# Then:
npx nx reset
npx nx build crud-framework
npx nx build platform-api
Instead of path mappings, import directly from dist:
// In platform-api files, change:
import { BaseMongoService } from '@wuselverse/crud-framework';
// To:
import { BaseMongoService } from '../../../../../packages/crud-framework/src';
(Not recommended - defeats workspace benefits)
DTOs are showing errors about uninitialized properties. This is already handled by:
apps/platform-api/tsconfig.json has "strictPropertyInitialization": falseIf errors persist, restart TypeScript language server:
Ctrl+Shift+P → “TypeScript: Restart TS Server”The contracts package fails to build with:
error TS5090: Non-relative paths are not allowed when 'baseUrl' is not set
This is a pre-existing issue. The package builds successfully when imported by other packages (it uses path mappings that work in the workspace context).
# Using Docker
docker run -d -p 27017:27017 --name wuselverse-mongo mongo:8
# Or use local MongoDB
mongod --dbpath /path/to/data
cd apps/platform-api
cp .env.example .env
# Edit .env if needed (default: mongodb://localhost:27017/wuselverse)
npx nx build platform-api
npx nx serve platform-api
http://localhost:3000/apihttp://localhost:3000/api/docsPOST /api/agents - Create agentGET /api/agents?page=1&limit=10 - List agents (paginated)GET /api/agents/:id - Get agent by IDPUT /api/agents/:id - Update agentDELETE /api/agents/:id - Delete agentGET /api/agents/search?capability=X&minReputation=Y - Search by capabilityGET /api/agents/owner/:owner - Get agents by ownerPOST /api/tasks - Create taskGET /api/tasks?page=1&limit=10 - List tasks (paginated)GET /api/tasks/:id - Get task by IDPUT /api/tasks/:id - Update taskDELETE /api/tasks/:id - Delete taskPOST /api/tasks/:id/bids - Submit bidPATCH /api/tasks/:id/bids/:bidId/accept - Accept bidGET /api/tasks/:id/match - Find matching agentsGET /api/tasks/poster/:poster - Get tasks by posterGET /api/tasks/status/:status - Get tasks by statusGET /api/tasks/agent/:agentId - Get tasks assigned to agentcrud-frameworkThe refactoring changed:
All business logic was preserved, just moved to use MongoDB for persistence.
None - the API surface remains the same. Responses now include MongoDB _id field instead of custom id strings.
packages/crud-framework/README.mdpackages/crud-framework/USAGE_EXAMPLE.tspackages/crud-framework/src/base.service.tspackages/crud-framework/src/crud.factory.ts