<commit_before>require 'sidekiq/web'

Rails.application.routes.draw do
  concern :paginatable do
    get '(page/:page)', :action => :index, :on => :collection, :as => ''
  end

  constraints(AuthHostConstraint.new) do
    devise_for :users, path: 'auth/user',
                       controllers: { registrations: 'users/registrations'}
  end

  constraints(BareHostConstraint.new) do
    authenticate :user, lambda { |u| u.admin? } do
      mount Sidekiq::Web => '/sidekiq'
    end

    if ResumisConfig.multi_tenant?
      if ResumisConfig.listing_enabled?
        get '/' => 'page#bare_domain'
      end

      # Redirect other requests to the site at www.
      match '*path', to: redirect { |path_params, req| "#{req.protocol}www.#{req.domain}#{req.fullpath}" }, via: :get
    end
  end

  constraints(TenantHostConstraint.new) do
    namespace :api do
      scope module: :v1, constraints: ApiVersionConstraint.new(version: 'v1') do
        resources :projects, only: [:index, :show, :update, :delete]
        resources :resumes, only: [:index, :show, :update, :delete]
        resources :users, only: [:show]
      end

      scope module: :json_resume, constraints: JsonResumeConstraint.new do
        resources :resumes, only: [:show]
      end
    end

    resources :posts, path: 'blog/posts', only: [:index, :show], concerns: :paginatable
    resources :post_categories, path: 'blog/categories', only: [:index, :show], concerns: :paginatable
    resources :resumes, only: [:show]
    resources :projects, only: [:index, :show], concerns: :paginatable

    namespace :manage do
      resources :resumes, concerns: :paginatable<commit_msg>Add create routes to v1 JSON-API routes<commit_after>require 'sidekiq/web'

Rails.application.routes.draw do
  concern :paginatable do
    get '(page/:page)', :action => :index, :on => :collection, :as => ''
  end

  constraints(AuthHostConstraint.new) do
    devise_for :users, path: 'auth/user',
                       controllers: { registrations: 'users/registrations'}
  end

  constraints(BareHostConstraint.new) do
    authenticate :user, lambda { |u| u.admin? } do
      mount Sidekiq::Web => '/sidekiq'
    end

    if ResumisConfig.multi_tenant?
      if ResumisConfig.listing_enabled?
        get '/' => 'page#bare_domain'
      end

      # Redirect other requests to the site at www.
      match '*path', to: redirect { |path_params, req| "#{req.protocol}www.#{req.domain}#{req.fullpath}" }, via: :get
    end
  end

  constraints(TenantHostConstraint.new) do
    namespace :api do
      scope module: :v1, constraints: ApiVersionConstraint.new(version: 'v1') do
        resources :projects, only: [:index, :create, :show, :update, :delete]
        resources :resumes, only: [:index, :create, :show, :update, :delete]
        resources :users, only: [:show]
      end

      scope module: :json_resume, constraints: JsonResumeConstraint.new do
        resources :resumes, only: [:show]
      end
    end

    resources :posts, path: 'blog/posts', only: [:index, :show], concerns: :paginatable
    resources :post_categories, path: 'blog/categories', only: [:index, :show], concerns: :paginatable
    resources :resumes, only: [:show]
    resources :projects, only: [:index, :show], concerns: :paginatable

    namespace :manage do
      resources :resumes, concerns: :paginatable
{'fraction_non_alphanumeric': 0.13203592814371257, 'fraction_numerical': 0.0014970059880239522, 'mean_word_length': 3.384514435695538, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '181151', 'n_tokens_mistral': 1054, 'n_tokens_neox': 1047, 'n_words': 291}