Metadata
- Source
- SJRK-429
- Type
- Improvement
- Priority
- Major
- Status
- Open
- Resolution
- N/A
- Assignee
- N/A
- Reporter
- Gregor Moss
- Created
2020-11-24T18:35:04.322-0500 - Updated
2020-11-24T18:35:04.322-0500 - Versions
- N/A
- Fixed Versions
- N/A
- Component
-
- Storytelling Tool Server
Description
Review feedback from @@Antranig Basman on the SJRK-425 pull request suggests refactoring or removing the "updatedDocs" return value and the accompanying structure that passes them along from the data migration script(s).
Given the return values of all these functions are ignored by the caller, it seems odd to return them.
You could either axe the returns, or else turn this into a slightly more "functional" pipeline involving fluid.promise.fireTransformEvent - this seems to make sense since the yielded value from sjrk.storyUpdate.updateStoriesData is actually supplied to sjrk.storyUpdate.updateDB - the latter can then get the signature sjrk.storyUpdate.updateDB(updatedDocs, options). "responseString" then becomes the previous payload in the chain.
This would also result in some simplification of the logic in gpii.dbRequest.createResponseHandler which accepts a function returning a promise, and then accepts another promise - it could then simply return a promise for its yielded result.