Hi Richard, thanks for taking time to look into the issue.
I have listed the 2 models below. The relationship between users and presentation (~foo) is stored in a relational Postgres table.
I want to update numberOfPresentations every-time the relation between presentation and users is updated (users are added/removed as presenters/presentation is deleted).
Users model
{
"kind": "collectionType",
"collectionName": "users-permissions_user",
"info": {
"name": "user",
"description": ""
},
"attributes": {
"username": {
"type": "string",
},
"name": {
"type": "string"
},
"presentation": {
"via": "presenters",
"collection": "presentation"
},
"numberOfPresentations":{
"type":"integer"
}
}
}
Presentation model
{
"kind": "collectionType",
"collectionName": "presentation",
"info": {
"name": "presentation",
"description": ""
},
"attributes": {
"name": {
"type": "string",
"required": true
},
"presenters": {
"plugin": "users-permissions",
"collection": "user",
"via": "presentation",
"dominant": true
}
}
}