I wanted to move this logic out of the Repository and RepositoryHost classes. It felt complicated enough where it warranted being separated so it could be easier to test. There is also some dependency in between Repository and RepositoryHost that made it hard to follow the code path and I thought separating this out would be helpful in reducing that complexity. The interface to this logic still comes through the same methods and parameters, but a further refactor could be changing how callers to these functions are interacting with this create or update logic. There were no specs checking this section of the code so I have added some based on how I read the code but if it looks incorrect please call that out. Let me know if you think this refactor is worth the possible troubles that come with touching this portion of the code base.
I wanted to move this logic out of the
Repository
andRepositoryHost
classes. It felt complicated enough where it warranted being separated so it could be easier to test. There is also some dependency in between Repository and RepositoryHost that made it hard to follow the code path and I thought separating this out would be helpful in reducing that complexity. The interface to this logic still comes through the same methods and parameters, but a further refactor could be changing how callers to these functions are interacting with this create or update logic. There were no specs checking this section of the code so I have added some based on how I read the code but if it looks incorrect please call that out. Let me know if you think this refactor is worth the possible troubles that come with touching this portion of the code base.