module Api::ProjectHelper
  extend ActiveSupport::Concern

  def load_project
    namespace = params[:owner]
    repo = params[:repo]

    @project, @owner = Project.find_with_namespace(namespace, repo)
    @repository = @project&.repository
    
    if @project
      logger.info "###########：project founded"
			@project
    else
			logger.info "###########：project not found"
      @project = nil
      tip_exception(404, '您访问的页面不存在或已被删除')
    end
    @project
  end
end