I have a document collection "Projects", a document collection "Sheets" and a edge collection "ProjectToSheets".
When posting a new sheet I want to insert the sheet in the sheet collection and add an edge between the (existing) project and the new sheet in the ProjectToSheet collection.
In the post route of the sheet service I could copy paste the code of the projectToSheet route like this (simplyfied):
router.post(function (req, res) {
const sheet = req.body;
let meta;
try {
meta = Sheets.save(sheet);
//Copy&Paste code. Bad :-(
meta = ProjectToSheets.save(projectToSheet._from, projectToSheet._to, projectToSheet);
...
But I'm pretty sure there must be a better way to do this and avoid copy&paste.