diff --git a/app/models/procedure_presentation.rb b/app/models/procedure_presentation.rb index 7cd4e0f48..5939f68cf 100644 --- a/app/models/procedure_presentation.rb +++ b/app/models/procedure_presentation.rb @@ -29,6 +29,17 @@ class ProcedurePresentation < ApplicationRecord validate :check_filters_max_length validate :check_filters_max_integer + attribute :sorted_column, :jsonb + + attribute :a_suivre_filters, :jsonb, array: true + attribute :suivis_filters, :jsonb, array: true + attribute :traites_filters, :jsonb, array: true + attribute :tous_filters, :jsonb, array: true + attribute :supprimes_filters, :jsonb, array: true + attribute :supprimes_recemment_filters, :jsonb, array: true + attribute :expirant_filters, :jsonb, array: true + attribute :archives_filters, :jsonb, array: true + def displayed_fields_for_headers [ Column.new(procedure_id: procedure.id, table: 'self', column: 'id', classname: 'number-col'), diff --git a/db/migrate/20240920090848_add_column_ids_to_procedure_presentations.rb b/db/migrate/20240920090848_add_column_ids_to_procedure_presentations.rb new file mode 100644 index 000000000..dd2a98142 --- /dev/null +++ b/db/migrate/20240920090848_add_column_ids_to_procedure_presentations.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class AddColumnIdsToProcedurePresentations < ActiveRecord::Migration[7.0] + def change + add_column :procedure_presentations, :displayed_columns, :jsonb, array: true, default: [], null: false + add_column :procedure_presentations, :tous_filters, :jsonb, array: true, default: [], null: false + add_column :procedure_presentations, :suivis_filters, :jsonb, array: true, default: [], null: false + add_column :procedure_presentations, :traites_filters, :jsonb, array: true, default: [], null: false + add_column :procedure_presentations, :a_suivre_filters, :jsonb, array: true, default: [], null: false + add_column :procedure_presentations, :archives_filters, :jsonb, array: true, default: [], null: false + add_column :procedure_presentations, :expirant_filters, :jsonb, array: true, default: [], null: false + add_column :procedure_presentations, :supprimes_filters, :jsonb, array: true, default: [], null: false + add_column :procedure_presentations, :supprimes_recemment_filters, :jsonb, array: true, default: [], null: false + add_column :procedure_presentations, :sorted_column, :jsonb + end +end diff --git a/db/schema.rb b/db/schema.rb index 6998464ea..a628a89ea 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -866,11 +866,21 @@ ActiveRecord::Schema[7.0].define(version: 2024_09_23_125619) do end create_table "procedure_presentations", id: :serial, force: :cascade do |t| + t.jsonb "a_suivre_filters", default: [], null: false, array: true + t.jsonb "archives_filters", default: [], null: false, array: true t.integer "assign_to_id" t.datetime "created_at", precision: nil + t.jsonb "displayed_columns", default: [], null: false, array: true t.jsonb "displayed_fields", default: [{"label"=>"Demandeur", "table"=>"user", "column"=>"email"}], null: false + t.jsonb "expirant_filters", default: [], null: false, array: true t.jsonb "filters", default: {"tous"=>[], "suivis"=>[], "traites"=>[], "a-suivre"=>[], "archives"=>[], "expirant"=>[], "supprimes"=>[]}, null: false t.jsonb "sort", default: {"order"=>"desc", "table"=>"notifications", "column"=>"notifications"}, null: false + t.jsonb "sorted_column" + t.jsonb "suivis_filters", default: [], null: false, array: true + t.jsonb "supprimes_filters", default: [], null: false, array: true + t.jsonb "supprimes_recemment_filters", default: [], null: false, array: true + t.jsonb "tous_filters", default: [], null: false, array: true + t.jsonb "traites_filters", default: [], null: false, array: true t.datetime "updated_at", precision: nil t.index ["assign_to_id"], name: "index_procedure_presentations_on_assign_to_id", unique: true end