Right now the relation API is inconsistent:
A) It does emit POST methods instead of PUT to corbel relation api
B) It does not allow to create custom named relations
-
Explanation of why this is bad :
corbelDriver.resources
.relation('sourceResourceName', sourceResourceId, 'destResourceName')
This is making mandatory the creation of a relation called sourceResourceName_destResourceName, but this is not the same functionality that corbel provides. Instead we should allow to use custom named relations.
I suggest this other way around for the reimplementation, let me see which are your thoughts
corbelDriver.resources.relation({
id : CAR_ID,
resource : 'cars',
relationName : 'coolPeople',
})
.add({
resource : 'people',
id : PERSON_ID
}, {
extra : 'data'
});
corbelDriver.resources.relation({
id : CAR_ID,
resource : 'cars',
relationName : 'coolPeople'
})
.add(null, {
customData: customData
});
Right now the relation API is inconsistent:
A) It does emit POST methods instead of PUT to corbel relation api
B) It does not allow to create custom named relations
Explanation of why this is bad :
This is making mandatory the creation of a relation called sourceResourceName_destResourceName, but this is not the same functionality that corbel provides. Instead we should allow to use custom named relations.
I suggest this other way around for the reimplementation, let me see which are your thoughts