[Step2|BE] Update Snippet Entity to return multiple files

Important: All the new functionality must be implemented behind the feature flag :snippet_multiple_files. Besides, it has to be scoped for users. Therefore, instead of checking if the feature flag is enabled or not (Feature.enabled?(:snippet_multiple_files)), we will check if the feature flag is enabled for specific users (Feature.enabled?(:snippet_multiple_files, user)).

When the new feature flag is enabled we need to make some changes to the snippet Grape entity.

When the feature flag is enabled, we will add new argument to the Snippet entity called files. This argument will return all the snippet files inside the snippet. Besides, we will remove as well the fields file_name and raw_url from the Snippet entity.

For each file within the Snippet repository, this new field will return:

  • path
  • raw_url

Once the :snippet_multiple_files feature flag is removed, we will look to remove file_name and potentially raw_url, but at the moment we are keeping them to maintain backwards compatibility.

Edited by Vijay Hawoldar