add: project order index

This commit is contained in:
vilet.yy 2021-03-17 15:47:01 +08:00
parent 1a8d9bb0ce
commit 9553740960
2 changed files with 6 additions and 1 deletions

View File

@ -15,7 +15,7 @@ class Projects::ListQuery < ApplicationQuery
scope = q
.with_project_type(params[:project_type])
.with_project_category(params[:category_id])
.with_project_language(params[:language_id])
.with_project_language(params[:language_id]).order(order_index: :desc)
sort = params[:sort_by] || "updated_on"
sort_direction = params[:sort_direction] || "desc"

View File

@ -0,0 +1,5 @@
class AddOrderIndexToProject < ActiveRecord::Migration[5.2]
def change
add_column :projects, :order_index, :integer, default: 0
end
end