loopbackio / loopbackio/loopback-next
@loopback/cli: Controller rest generator with findOne method
@mrnetforge がすでに取り組んでいます。
2020年5月24日 から。
- 主要言語
- TypeScript
- スター
- 5.1k
- フォーク
- 1.1k
- 平均マージ
- 2日 21時間
- マージ済み PR(30日)
- 27
説明
## Suggestion
Currently, cli generator controller doesn't provide findOne method inside file. Method findOne exists in repository that is associated with controller, so i think i should be generated. For now i must manually add this method to all my controllers
```ts
@get('/config/findOne', {
responses: {
'200': {
description: 'Config model instance',
content: {
'application/json': {
schema: getModelSchemaRef(Config, { includeRelations: true }),
},
},
},
},
})
async findOne(
@param.filter(Config) filter?: Filter,
): Promise {
return this.configRepository.findOne(filter);
}
```
## Use Cases
`lb4 controller` with REST option should create findOne inside controller (example above)
## Examples
In my scenario i have model that i need to find not by id but based on custom filter. It would be much easier when this method can be created out of the box.
## Acceptance criteria
TBD - will be filled by the team.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
評価
この issue はまだ評価されていません。