Closed
Description
I have two models usermodal,my_another_model
. usermodel
has a hasOne relationship with my_another_model
. Whenever I access the given endpoint I get the following error. This happens only when the my_another_model
does not have any data. The issue happens when I GET the endpoint /usermodel/me/myAnotherModel
Endpoint
/usermodel/me/myAnotherModel
usermodel
{
"name": "usermodel",
"base": "User",
"idInjection": true,
"options": {
"validateUpsert": true
},
"mixins": {
},
"properties": {
"first_name": {
"type": "string",
"required": true
},
"last_name": {
"type": "string",
"required": true
},
},
"validations": [],
"relations": {
"myAnotherModel": {
"type": "hasOne",
"model": "my_another_model",
"foreignKey": "",
"options": {
"nestRemoting": true
}
}
},
"acls": [
{
"accessType": "*",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW"
},
],
"methods": {
}
}
my_another_model
{
"name": "my_another_model",
"idInjection": true,
"options": {
"validateUpsert": true
},
"properties": {
"name": {
"type": "string",
"required": true
},
"phone": {
"type": "string"
},
"email": {
"type": "string"
}
},
"validations": [],
"relations": {
"usermodel": {
"type": "belongsTo",
"model": "usermodel",
"foreignKey": ""
}
},
"acls": [],
"methods": {}
}
Error Message
I get the following error message,
Error: Unknown "my_another_model" id "undefined".```
Any help appreciated.