I want to specify the relationship betweet 2 mssql tables. Paymentcategory and Payout. paymentcategory.id joins on the payout.category column.
in payout.json model I specified as foreignKey: id,
"relations": {
"paymentcategories": {
"type": "hasOne",
"model": "Paymentcategory",
"foreignKey": "id"
}
but loopback looks by default for the id field as primaryKey
Is there a way to specify the join on the category field. Preferably in the common/models/payout.json file?
"relations": {
"paymentcategories": {
"type": "hasOne",
"model": "Paymentcategory",
"foreignKey": "id",
"primaryKey": "category" ??????????????????
}
Now I get this error:
"error": {
"name": "Error",
"status": 400,
"message": "Key mismatch: Paymentpayout.id: undefined, Paymentcategory.id: 1",
"statusCode": 400,