# nest-request-combiner

> A simple package for nestjs to get query or param request data in body Dto or vice versa

Latest version **1.0.0** (published 2023-06-26) · ISC license · 0 weekly downloads

## Install

```sh
npm install nest-request-combiner
pnpm add nest-request-combiner
yarn add nest-request-combiner
bun add nest-request-combiner
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2023-06-26 |
| First published | 2023-06-26 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 32.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Muhammad Maaz Khan |
| Maintainers | mk2896 |
| Keywords | Request Combine, Query Params, Nestjs |

## Links

- npm: https://www.npmjs.com/package/nest-request-combiner
- Repository: https://github.com/Mk2896/nest-request-combiner
- Homepage: https://github.com/Mk2896/nest-request-combiner/blob/master/README.md
- Issues: https://github.com/Mk2896/nest-request-combiner/issues
- npm.io page: https://npm.io/package/nest-request-combiner

## Dependencies (2)

- [typescript](https://npm.io/package/typescript.md) ^5.1.3
- [@nestjs/common](https://npm.io/package/@nestjs/common.md) ^10.0.3

## Alternatives

- [gamedig](https://npm.io/package/gamedig.md) — 29.3K weekly downloads
- [join-monster](https://npm.io/package/join-monster.md) — 12.8K weekly downloads
- [masked](https://npm.io/package/masked.md) — 5.5K weekly downloads
- [@comunica/actor-query-process-explain-logical](https://npm.io/package/@comunica/actor-query-process-explain-logical.md) — 4.7K weekly downloads
- [@veracity/vui](https://npm.io/package/@veracity/vui.md) — 4.6K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2023-06-26

## README

# nest-request-combiner

A simple package for `nestjs` to get `query` or `param` request data in `body Dto` or vice versa.

### Table of Contents  
- [Installation](#installation)
- [Features](#features)
- [Explanation](#explanation)

## Installation

To install it, using npm:

```shell
npm install nest-request-combiner
```
## Usage

1. To use this just add decorator on your controller method.

``` typescript
@InjectParamToBody()
 yourControllerMethod(
  @Param('id') id: number,
  @Body() yourDto: YourDto 
 )
 ```

After this in your `Dto`
``` typescript
export class YourDto {
  
    params: any;  // Add params property inside Dto

    @ValidateIf((args) => args.object.params.id)  // Now you can access your parameters like this. 
    property: string;
}
```
If you have set `whitelist: true` in your validation pipe. Then you must add `@Allow()` on `params` property.
 ## Features
 
 The library has following decorators to combine your request data:

 ### InjectParamToBody
 ### InjectParamToQuery
 ### InjectQueryToBody
 ### InjectQueryToParam
 ### InjectBodyToParam
 ### InjectBodyToQuery <br><br>

 #### Decorators Options
 By default all decorators strip the request property that is combined. To let it be combined set `shouldStrip: false`

---
_Source: https://npm.io/package/nest-request-combiner · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
