Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nestjs-base-service

Package Overview
Dependencies
Maintainers
3
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nestjs-base-service

An opinionated base service for NestJS apps

  • 0.11.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

NestJS BaseService

An opinionated base service for NestJS

Test Coverage

Built with :heartpulse: at Vizzuality.

Roadmap

  • Add tutorial
  • Add tests
  • Implement transaction support
  • Implement opinionated batching
  • Add support for validation (via plugin?)
  • Add support for auditing (via plugin?)
  • Add support for pagination
  • Add support for serialization
  • Add support for batching of operations

License

(C) Copyright Vizzuality 2020-2021.

Distributed under the MIT license.

Usage

Filtering on listing GET requests

  • Add the necessary decorator to your request parsing, on your controller method, like so:
import {
  FetchSpecification,
  ProcessFetchSpecification,
} from 'nestjs-base-service';

@Controller(`/api/v1/some-model`)
@ApiTags(someModelResource.className)
export class SomeModelController {
  constructor(public readonly someModelsService: SomeModelsService) {}

  @Get()
  async findAll(
    @ProcessFetchSpecification(['status'])
      fetchSpecification: FetchSpecification,
  ): Promise<SomeModel> {
    const results = await this.someModelsService.findAllPaginated(
      fetchSpecification,
    );
    return this.someModelsService.serialize(results.data, results.metadata);
  }
}
  • Ensure your service class extends the included BaseService class.
  • On your controller decorator argument, optionally pass a whitelist of filtering parameters (recommended).

FAQs

Package last updated on 12 Apr 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc