Skip to content

Commit

Permalink
Merge pull request #46 from nestjsx/next
Browse files Browse the repository at this point in the history
v.3.2.0
  • Loading branch information
michaelyali committed Mar 27, 2019
2 parents 0c3b6db + bfdc885 commit a6a5f3d
Show file tree
Hide file tree
Showing 41 changed files with 709 additions and 293 deletions.
30 changes: 26 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
- [Params Options](#params-options)
- [Validation Options](#validation-options)
- [IntelliSense](#intellisense)
- [Method Override](#method-override)
- [Routes Override](#routes-override)
- [Adding Routes](#adding-routes)
- [Additional Decorators](#additional-decorators)
- [Example Project](#example-project)
- [Contribution](#contribution)
Expand Down Expand Up @@ -797,9 +798,9 @@ export class HeroesCrud {
}
```

### Method Override
### Routes Override

List of composed base methods:
List of composed base routes methods:

```typescript
getManyBase(
Expand Down Expand Up @@ -910,7 +911,28 @@ export class HeroesCrud {
}
```

**_Notice:_** new custom route decorators were created to simplify process: `@ParsedQuery()`, `@ParsedParams`, `@ParsedBody()`, and`@ParsedOptions()`. But you still can add your param decorators to any of the methods, e.g. `@Param()`, `@Session()`, etc. Or any of your own cutom route decorators.
**_Notice:_** new custom route decorators were created to simplify process: `@ParsedQuery()`, `@ParsedParams`, `@ParsedBody()`, and `@ParsedOptions()`. But you still can add your param decorators to any of the methods, e.g. `@Param()`, `@Session()`, etc. Or any of your own cutom route decorators.

### Adding Routes

Sometimes you might need to add a new route and to use `@ParsedQuery()`, `@ParsedParams`, `@ParsedOptions()` in it. You need to use `@UsePathInterceptors()` method decorator in order to do that:

```typescript
...
import { UsePathInterceptors } from '@nestjsx/crud';
...

@UsePathInterceptors()
@Get('/export/list.xlsx')
async exportSome(
@ParsedQuery() query: RestfulParamsDto,
@ParsedOptions() options: CrudOptions,
) {
// some logic
}
```

By default this decorator will parse `query` and `param`. But you can specify what you need to parse by passing the appropriate argument (`@UsePathInterceptors('query')` or `@UsePathInterceptors('param')`).

### Additional Decorators

Expand Down
30 changes: 26 additions & 4 deletions dist/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
- [Params Options](#params-options)
- [Validation Options](#validation-options)
- [IntelliSense](#intellisense)
- [Method Override](#method-override)
- [Routes Override](#routes-override)
- [Adding Routes](#adding-routes)
- [Additional Decorators](#additional-decorators)
- [Example Project](#example-project)
- [Contribution](#contribution)
Expand Down Expand Up @@ -797,9 +798,9 @@ export class HeroesCrud {
}
```

### Method Override
### Routes Override

List of composed base methods:
List of composed base routes methods:

```typescript
getManyBase(
Expand Down Expand Up @@ -910,7 +911,28 @@ export class HeroesCrud {
}
```

**_Notice:_** new custom route decorators were created to simplify process: `@ParsedQuery()`, `@ParsedParams`, `@ParsedBody()`, and`@ParsedOptions()`. But you still can add your param decorators to any of the methods, e.g. `@Param()`, `@Session()`, etc. Or any of your own cutom route decorators.
**_Notice:_** new custom route decorators were created to simplify process: `@ParsedQuery()`, `@ParsedParams`, `@ParsedBody()`, and `@ParsedOptions()`. But you still can add your param decorators to any of the methods, e.g. `@Param()`, `@Session()`, etc. Or any of your own cutom route decorators.

### Adding Routes

Sometimes you might need to add a new route and to use `@ParsedQuery()`, `@ParsedParams`, `@ParsedOptions()` in it. You need to use `@UsePathInterceptors()` method decorator in order to do that:

```typescript
...
import { UsePathInterceptors } from '@nestjsx/crud';
...

@UsePathInterceptors()
@Get('/export/list.xlsx')
async exportSome(
@ParsedQuery() query: RestfulParamsDto,
@ParsedOptions() options: CrudOptions,
) {
// some logic
}
```

By default this decorator will parse `query` and `param`. But you can specify what you need to parse by passing the appropriate argument (`@UsePathInterceptors('query')` or `@UsePathInterceptors('param')`).

### Additional Decorators

Expand Down
8 changes: 5 additions & 3 deletions dist/classes/restful-service.class.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/classes/restful-service.class.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/constants.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export declare const PARSED_QUERY_REQUEST_KEY = "NESTJSX_PARSED_QUERY_REQUEST_KE
export declare const PARSED_PARAMS_REQUEST_KEY = "NESTJSX_PARSED_PARAMS_REQUEST_KEY";
export declare const PARSED_OPTIONS_METADATA = "NESTJSX_PARSED_OPTIONS_METADATA";
export declare const PARSED_BODY_METADATA = "NESTJSX_PARSED_BODY_METADATA";
export declare const CRUD_OPTIONS_METADATA = "NESTJSX_CRUD_OPTIONS_METADATA";
export declare const CREATE_UPDATE: {
groups: string[];
};
Expand Down
1 change: 1 addition & 0 deletions dist/constants.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/constants.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 18 additions & 29 deletions dist/decorators/crud.decorator.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a6a5f3d

Please sign in to comment.