class Api::V1::ProjectsController < Api::V1::BaseController 
  before_action :require_public_and_member_above, only: [:show, :compare, :blame, :sonar_search]

  def index 
    render_ok
  end

  def show 
    @result_object = Api::V1::Projects::GetService.call(@project, current_user.gitea_token)
  end


  def compare
    @result_object = Api::V1::Projects::CompareService.call(@project, params[:from], params[:to], current_user&.gitea_token)
  end

  def blame
    @result_object = Api::V1::Projects::BlameService.call(@project, params[:sha], params[:filepath], current_user&.gitea_token)
  end
end