
Research
NPM targeted by malware campaign mimicking familiar library names
Socket uncovered npm malware campaign mimicking popular Node.js libraries and packages from other ecosystems; packages steal data and execute remote code.
@nestjsbase/mongoose
Advanced tools
This is a library includes inheritable classes that can help you to save your time when create CRUD module in NestJS. This classes are supporting for mongoose. If you want to use typeorm instead, you can go [here](https://www.npmjs.com/package/@nestjsbase
This is a library includes inheritable classes that can help you to save your time when create CRUD module in NestJS. This classes are supporting for mongoose. If you want to use typeorm instead, you can go here
npm install @nestjsbase/mongoose
First, you have create your own entity class and inherit BaseModel of @nestjsbase/mongoose
import { Schema, Prop } from '@nestjs/mongoose';
import { BaseModel } from '@nestjsbase/mongoose';
@Schema({ timestamp: true })
export class UserModel extends BaseModel {
@Prop()
name!: string;
}
You have to enable timestamp if you want to use createdAt and updatedAt
This is BaseModel actually do in background
export class BaseModel {
@Prop({ type: Date })
createdAt!: Date;
@Prop({ type: Date })
updatedAt!: Date;
@Prop({ type: Date })
deletedAt!: Date;
}
Now, make your service inherit BaseService
import { Model } from 'mongoose';
import { BaseService } from '@nestjsbase/mongoose';
import { Injectable } from '@nestjs/common';
import { InjectModel } from '@nestjs/mongoose';
import { UserModel } from '../user.model';
@Injectable()
export class UserService extends BaseService {
constructor(@InjectModel(UserModel.name) private userModel: Model<UserModel>){
super(userModel);
}
}
This BaseService already have methods:
export class IBaseService {
create(...);
createMany(...);
getOne(...);
getOneOrFail(...);
getOneById(...);
getOneByIdOrFail(...);
getAll(...);
getAllWithPagination(...);
update(...);
updateById(...);
remove(...);
removeById(...);
softRemove(...);
softRemoveById(...);
}
export interface IPagination<T> {
data: T[];
pagination: {
limit: number;
page: number;
total: number;
};
}
FAQs
This is a library includes inheritable classes that can help you to save your time when create CRUD module in NestJS. This classes are supporting for mongoose. If you want to use typeorm instead, you can go [here](https://www.npmjs.com/package/@nestjsbase
We found that @nestjsbase/mongoose demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket uncovered npm malware campaign mimicking popular Node.js libraries and packages from other ecosystems; packages steal data and execute remote code.
Research
Socket's research uncovers three dangerous Go modules that contain obfuscated disk-wiping malware, threatening complete data loss.
Research
Socket uncovers malicious packages on PyPI using Gmail's SMTP protocol for command and control (C2) to exfiltrate data and execute commands.