Notification: add timestamp to champs, pieces jusitificatives and follows
This commit is contained in:
parent
101ad54be0
commit
909ecf2142
5 changed files with 44 additions and 7 deletions
|
@ -3,4 +3,15 @@ class Follow < ActiveRecord::Base
|
|||
belongs_to :dossier
|
||||
|
||||
validates_uniqueness_of :gestionnaire_id, :scope => :dossier_id
|
||||
|
||||
before_create :set_default_date
|
||||
|
||||
private
|
||||
|
||||
def set_default_date
|
||||
self.demande_seen_at = DateTime.now
|
||||
self.annotations_privees_seen_at = DateTime.now
|
||||
self.avis_seen_at = DateTime.now
|
||||
self.messagerie_seen_at = DateTime.now
|
||||
end
|
||||
end
|
||||
|
|
6
db/migrate/20171024100606_add_time_stamp_to_champs.rb
Normal file
6
db/migrate/20171024100606_add_time_stamp_to_champs.rb
Normal file
|
@ -0,0 +1,6 @@
|
|||
class AddTimeStampToChamps < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
add_column :champs, :created_at, :datetime
|
||||
add_column :champs, :updated_at, :datetime
|
||||
end
|
||||
end
|
8
db/migrate/20171024101439_add_last_views_at_to_follow.rb
Normal file
8
db/migrate/20171024101439_add_last_views_at_to_follow.rb
Normal file
|
@ -0,0 +1,8 @@
|
|||
class AddLastViewsAtToFollow < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
add_column :follows, :demande_seen_at, :datetime
|
||||
add_column :follows, :annotations_privees_seen_at, :datetime
|
||||
add_column :follows, :avis_seen_at, :datetime
|
||||
add_column :follows, :messagerie_seen_at, :datetime
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddColumnUpdatedAtToPieceJustificative < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
add_column :pieces_justificatives, :updated_at, :datetime
|
||||
end
|
||||
end
|
21
db/schema.rb
21
db/schema.rb
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20171019113610) do
|
||||
ActiveRecord::Schema.define(version: 20171024135653) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
@ -136,10 +136,12 @@ ActiveRecord::Schema.define(version: 20171019113610) do
|
|||
end
|
||||
|
||||
create_table "champs", force: :cascade do |t|
|
||||
t.string "value"
|
||||
t.integer "type_de_champ_id"
|
||||
t.integer "dossier_id"
|
||||
t.string "type"
|
||||
t.string "value"
|
||||
t.integer "type_de_champ_id"
|
||||
t.integer "dossier_id"
|
||||
t.string "type"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.index ["dossier_id"], name: "index_champs_on_dossier_id", using: :btree
|
||||
t.index ["type_de_champ_id"], name: "index_champs_on_type_de_champ_id", using: :btree
|
||||
end
|
||||
|
@ -250,8 +252,12 @@ ActiveRecord::Schema.define(version: 20171019113610) do
|
|||
end
|
||||
|
||||
create_table "follows", force: :cascade do |t|
|
||||
t.integer "gestionnaire_id", null: false
|
||||
t.integer "dossier_id", null: false
|
||||
t.integer "gestionnaire_id", null: false
|
||||
t.integer "dossier_id", null: false
|
||||
t.datetime "demande_seen_at"
|
||||
t.datetime "annotations_privees_seen_at"
|
||||
t.datetime "avis_seen_at"
|
||||
t.datetime "messagerie_seen_at"
|
||||
t.index ["dossier_id"], name: "index_follows_on_dossier_id", using: :btree
|
||||
t.index ["gestionnaire_id", "dossier_id"], name: "index_follows_on_gestionnaire_id_and_dossier_id", unique: true, using: :btree
|
||||
t.index ["gestionnaire_id"], name: "index_follows_on_gestionnaire_id", using: :btree
|
||||
|
@ -348,6 +354,7 @@ ActiveRecord::Schema.define(version: 20171019113610) do
|
|||
t.integer "user_id"
|
||||
t.string "original_filename"
|
||||
t.string "content_secure_token"
|
||||
t.datetime "updated_at"
|
||||
t.index ["dossier_id"], name: "index_pieces_justificatives_on_dossier_id", using: :btree
|
||||
t.index ["type_de_piece_justificative_id"], name: "index_pieces_justificatives_on_type_de_piece_justificative_id", using: :btree
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue