From f1575c2fa9b77954bae52ddad547ff6dafbf2569 Mon Sep 17 00:00:00 2001 From: Mike Evstropov Date: Thu, 24 Feb 2022 18:26:34 +0300 Subject: [PATCH] docs: removes required property `itemType` from the references many relation decorator Signed-off-by: Mike Evstropov --- docs/site/ReferencesMany-relation.md | 25 ++++++------------- docs/site/decorators/Decorators_repository.md | 2 +- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/docs/site/ReferencesMany-relation.md b/docs/site/ReferencesMany-relation.md index 0b1bfb458827..fcee4d0b80f0 100644 --- a/docs/site/ReferencesMany-relation.md +++ b/docs/site/ReferencesMany-relation.md @@ -15,13 +15,11 @@ navigation APIs to deal with a graph of model instances. In addition to the traditional ones, LoopBack supports `referencesMany` relation that embeds an array of foreign keys to reference other objects. For example: -```ts +```json { - id: 1, - name: 'John Smith', - accountIds: [ - "saving-01", "checking-01", - ] + "id": 1, + "name": "John Smith", + "accountIds": ["saving-01", "checking-01"] } ``` @@ -107,7 +105,7 @@ export class Customer extends Entity { }) name: string; - @referencesMany(() => Account, {}, {itemType: 'number'}) + @referencesMany(() => Account) accountIds: number[]; // relation name will default to `accounts` constructor(data: Partial) { @@ -148,7 +146,6 @@ export class Customer extends Entity { @referencesMany( () => Account, {name: 'accounts'}, // specify the relation name if fk is customized - {itemType: 'number'}, ) account_ids: number[]; // customized foreign keys @@ -164,11 +161,7 @@ you to do so: ```ts class Customer extends Entity { // constructor, properties, etc. - @referencesMany( - () => Account, - {keyFrom: 'accountIds'}, - {name: 'account_ids', itemType: 'number'}, - ) + @referencesMany(() => Account, {keyFrom: 'accountIds'}, {name: 'account_ids'}) accountIds: number[]; } ``` @@ -180,11 +173,7 @@ key of the target model (joining two tables on non-primary attribute), the ```ts class Customer extends Entity { // constructor, properties, etc. - @referencesMany( - () => Account, - {keyTo: 'customized_target_property'}, - {itemType: 'number'}, - ) + @referencesMany(() => Account, {keyTo: 'customized_target_property'}) accountIds: number[]; } diff --git a/docs/site/decorators/Decorators_repository.md b/docs/site/decorators/Decorators_repository.md index 3bece28741d4..c44ae41af998 100644 --- a/docs/site/decorators/Decorators_repository.md +++ b/docs/site/decorators/Decorators_repository.md @@ -273,7 +273,7 @@ import {Account} from './account.model'; export class Customer extends Entity { // properties - @referencesMany(() => Account, {}, {itemType: 'number'}) + @referencesMany(() => Account) accountIds: number[]; // etc