loopbackio / loopbackio/loopback-next
@loopback/cli: Controller rest generator with findOne method
@mrnetforge ci sta già lavorando.
Dal 24/5/2020.
- Lingua principale
- TypeScript
- Stelle
- 5.1k
- Fork
- 1.1k
- Merge medio
- 2g 21h
- PR unite (30g)
- 27
Descrizione
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
@get('/config/findOne', {
responses: {
'200': {
description: 'Config model instance',
content: {
'application/json': {
schema: getModelSchemaRef(Config, { includeRelations: true }),
},
},
},
},
})
async findOne(
@param.filter(Config) filter?: Filter<Config>,
): Promise<ConfigWithRelations | null> {
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.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Valutazione
Questa issue non è ancora stata valutata.