0.1.7 • Published 12 months ago
nestjs-mongoose-schematics v0.1.7
nestjs-mongoose-schematics
🚧 Work in progress 🦺
This is an opinionated NestJS schematics for generating Mongoose models, DTOs, controllers, services, and repositories.
Usage
# Install the schematics
npm i --save-dev nestjs-mongoose-schematics
# Generate a new resource (controller + service + repository)
nest g -c nestjs-mongoose-schematics resource
Todo list for the alpha release
- Basic entity with Mongoose Schema
- Basic DTO with class validators annotations
- Better controllers and services
- Install NPM dependencies
- Configure Mongoose module
- Configure Mongoose feature
- Use id instead of _id in responses
- Create repository class
- Swagger annotations
- Install global pipe ValidationPipe in
main.ts
- Install Swagger UI in
main.ts
- Unit tests with automock
- Unit test factories with Fishery
Todo list for the beta release
- Support nested objects
- Support references (relations)
- Support soft deletes
Development
Create a new NestJS project, which will be ignored by the .gitignore
file.
# Link the local development build of the schematics
cd nestjs-mongoose-schematics
npm install
npm build
npm link
# Create new example application inside the current directory
nest new example -p npm
cd example
npm i @nestjs/mongoose mongoose
npm link nestjs-mongoose-schematics
Run the schematics:
nest g -c nestjs-mongoose-schematics resource --debug