loopbackio / loopbackio/loopback-next

@loopback/cli: Controller rest generator with findOne method

オープン
#5,531 コメント 4 件 リアクション 0 件 担当者 1 名 GitHub で見る

@mrnetforge がすでに取り組んでいます。

2020年5月24日 から。

CLI developer-experience feature help wanted
主要言語
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.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。