You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7bae364
Browse filesBrowse the repository at this point in the historyBrowse files
fix(cli): support keyTo option in belongsTo relation generator
Adds keyTo support to the belongsTo relation CLI generator:
- Passes keyTo to getBelongsTo() decorator so the FK can resolve
to a non-PK field on the target model
- Resolves fktype from the target model's keyTo property type
- Reflects keyTo in the controller OpenAPI description
- Propagates keyTo from --config CLI option to artifactInfo in
the relation generator scaffold step
- Adds integration tests and snapshots for keyTo with and without
a custom relation name
Fixes#11594
Signed-off-by: Abubakar Awan <abkawan6@gmail.com>
exports[`lb4 relation generates belongsTo relation with keyTo and custom relation name generated model includes both name and keyTo in belongsTo decorator 1`]=`
451
+
import {Entity, model, property, belongsTo} from '@loopback/repository';
exports[`lb4 relation generates belongsTo relation with keyTo and custom relation name generated controller description includes resolved via reference with custom relation name 1`]=`
480
+
import {
481
+
repository,
482
+
} from '@loopback/repository';
483
+
import {
484
+
param,
485
+
get,
486
+
getModelSchemaRef,
487
+
} from '@loopback/rest';
488
+
import {
489
+
Order,
490
+
Customer,
491
+
} from '../models';
492
+
import {OrderRepository} from '../repositories';
493
+
494
+
export class OrderCustomerController {
495
+
constructor(
496
+
@repository(OrderRepository)
497
+
public orderRepository: OrderRepository,
498
+
) { }
499
+
500
+
@get('/orders/{id}/customer', {
501
+
responses: {
502
+
'200': {
503
+
description: 'Customer belonging to Order (resolved via Customer.name)',
0 commit comments