Dears,
I'm with an issue that I can't understand how to fix. I'm using CAP to backend development and I have the following structure that I can do a deep insert:
{
"mandatory": true,
"certificateValidityDays": 180,
"deleted": false,
"visible": true,
"description": [
{
"details": "DETAILS",
"language": "PT",
"text": "TEXT",
"url": "TESTE"
}
],
"applicationTrackTraining": [
{
"app": "#dummyapp4-Display",
"track_id": "b62a7888-853c-11ec-a8a3-0242ac120002"
},
{
"app": "#trainingmanagementui5admin-Display",
"track_id": "b62a7888-853c-11ec-a8a3-0242ac120002"
}
]
}
How you can see, the main table (Trainings) has two compositions of many descriptions and applicationTrackTraining. On deep insert, I can set the training_id on description and applicationTrackTraining.
To make a deep update, I do a PUT request to the endpoint adding the id of this entity, alredy created with deep insert.
The deep update JSON it's very simillar, just adding the ids on the respectives entitites, as you can see:
{
"mandatory": true,
"certificateValidityDays": 180,
"deleted": false,
"visible": true,
"description": [
{
"details": "details",
"language": "PT",
"text": "text",
"url": "TESTE",
"id": "5150a908-99b4-4e19-8166-36ffed360874",
"training_id": "8efbdd75-882b-4e73-be3d-f6d953be0485"
}
],
"applicationTrackTraining": [
{
"app": "#dummyapp4-Display",
"track_id": "b62a7888-853c-11ec-a8a3-0242ac120002",
"training_id": "8efbdd75-882b-4e73-be3d-f6d953be0485"
},
{
"app": "#ui5admin-Display",
"track_id": "b62a7888-853c-11ec-a8a3-0242ac120002",
"training_id": "8efbdd75-882b-4e73-be3d-f6d953be0485"
}
],
"id": "8efbdd75-882b-4e73-be3d-f6d953be0485",
"modifiedAt": "2022-02-23T20:32:19.119Z",
"modifiedBy": "anonymous",
"createdAt": "2022-02-23T20:31:15.741Z",
"createdBy": "anonymous"
}
But when this put request is made, all entities from the same endpoint are deleted. The entities from the foreign key compositions it's deleted too.
Any way to solve it?
Request clarification before answering.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.