Skip to content

[Step 4] Create Snippets::UpdateRepositoryStorageService service

We need to create a service similar to Projects:UpdateRepositoryStorageService but for snippets. The project service has a lot of logic that we don't need for snippets but we can reuse some.

First, we should move the shared logic into a common Base service or into a concern. Then we can include or inherit that concern in the project and snippet service.

We need to ensure that this new service for snippets can move the repository to a different repository storage and that the move is reflected properly by calling at track_repository_storage and, therefore present in the SnippetRepository table.

We could also just call it Repositories::UpdateREpositoryStorageService and make it the default service while, in this case, Projects:UpdateRepositoryStorageService will be an extension and just an exception that we need to make for projects because they can hold different repositories.

Edited by Francisco Javier López