Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/custom decorators #48

Merged
merged 4 commits into from
Mar 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ Next, let's create a [Repository Service](#repository-service) for it:
```typescript
import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { RepositoryService } from '@nestjsx/crud/typeorm';
import { forTypeORM } from '@nestjsx/crud';
import RepositoryService = forTypeORM.RepositoryService;

import { Hero } from './hero.entity';

Expand Down Expand Up @@ -612,32 +613,41 @@ Also, routes options object may have some options for each particular route:
routes: {
getManyBase: {
interceptors: [],
decorators: [],
},
getOneBase: {
interceptors: [],
decorators: [],
},
createOneBase: {
interceptors: [],
decorators: [],
},
createManyBase: {
interceptors: [],
decorators: [],
},
updateOneBase: {
interceptors: [],
decorators: [],
allowParamsOverride: true
},
deleteOneBase: {
interceptors: [],
decorators: [],
returnDeleted: true
},
}
}
```

`interceptors` - an array of your custom interceptors
`decorators` - an array of your custom decorators
`allowParamsOverride` - whether or not to allow body data be overriten by the URL params on PATH request. Default: `false`
`returnDeleted` - whether or not an entity object should be returned in the response body on DELETE request. Default: `false`

**_Notice:_** `decorators` will not move from original ones to override ones

### Params Options

`CrudOptions` object may have `params` parameter that will be used for validation sake of you URL params and for defining a slug param (if it differs from `id` that is used by default).
Expand Down
41 changes: 30 additions & 11 deletions integration/typeorm/package-lock.json

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

Loading