Update "hasMany" example
This commit is contained in:
parent
30df6cb597
commit
e822e822cf
28
docs/api.md
28
docs/api.md
|
@ -48,14 +48,16 @@ The following is an example of an object containing two `Model` definitions: "lo
|
||||||
|
|
||||||
```js
|
```js
|
||||||
{
|
{
|
||||||
"location": {
|
"dealership": {
|
||||||
// a reference, by name, to a dataSource definition
|
// a reference, by name, to a dataSource definition
|
||||||
"dataSource": "my-db",
|
"dataSource": "my-db",
|
||||||
// the options passed to Model.extend(name, properties, options)
|
// the options passed to Model.extend(name, properties, options)
|
||||||
"options": {
|
"options": {
|
||||||
"relationships": {
|
"relationships": {
|
||||||
"hasMany": {
|
"cars": {
|
||||||
"model": "Inventory", "foreignKey": "locationId", "as": "inventory"
|
"type": "hasMany",
|
||||||
|
"model": "Car",
|
||||||
|
"foreignKey": "dealerId"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"remoteMethods": {
|
"remoteMethods": {
|
||||||
|
@ -76,25 +78,21 @@ The following is an example of an object containing two `Model` definitions: "lo
|
||||||
"address": "String"
|
"address": "String"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"inventory": {
|
"car": {
|
||||||
"dataSource": "my-db"
|
"dataSource": "my-db"
|
||||||
"options": {
|
|
||||||
"plural": "inventory"
|
|
||||||
},
|
|
||||||
"properties": {
|
"properties": {
|
||||||
"id": {
|
"id": {
|
||||||
"type": "String",
|
"type": "String",
|
||||||
"required": true,
|
"required": true,
|
||||||
"id": true,
|
"id": true
|
||||||
"length": 20
|
|
||||||
},
|
},
|
||||||
"available": {
|
"make": {
|
||||||
"type": "Number",
|
"type": "String",
|
||||||
"required": false
|
"required": true
|
||||||
},
|
},
|
||||||
"total": {
|
"model": {
|
||||||
"type": "Number",
|
"type": "String",
|
||||||
"required": false
|
"required": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue