Add column created_at on cerfa and piece_justificative
This commit is contained in:
parent
abfb6367d6
commit
26431ac528
8 changed files with 27 additions and 8 deletions
|
@ -1,5 +1,7 @@
|
|||
class CerfaSerializer < ActiveModel::Serializer
|
||||
|
||||
attributes :content_url => :url
|
||||
attributes :created_at,
|
||||
:content_url => :url
|
||||
|
||||
|
||||
end
|
|
@ -1,5 +1,6 @@
|
|||
class PieceJustificativeSerializer < ActiveModel::Serializer
|
||||
attributes :content_url => :url
|
||||
attributes :created_at,
|
||||
:content_url => :url
|
||||
|
||||
has_one :type_de_piece_justificative
|
||||
end
|
5
db/migrate/20160314160801_add_created_at_to_cerfa.rb
Normal file
5
db/migrate/20160314160801_add_created_at_to_cerfa.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class AddCreatedAtToCerfa < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :cerfas, :created_at, :datetime
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddCreatedAtToPieceJustificative < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :pieces_justificatives, :created_at, :datetime
|
||||
end
|
||||
end
|
14
db/schema.rb
14
db/schema.rb
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20160314102523) do
|
||||
ActiveRecord::Schema.define(version: 20160314161959) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
@ -68,8 +68,9 @@ ActiveRecord::Schema.define(version: 20160314102523) do
|
|||
end
|
||||
|
||||
create_table "cerfas", force: :cascade do |t|
|
||||
t.string "content"
|
||||
t.integer "dossier_id"
|
||||
t.string "content"
|
||||
t.integer "dossier_id"
|
||||
t.datetime "created_at"
|
||||
end
|
||||
|
||||
add_index "cerfas", ["dossier_id"], name: "index_cerfas_on_dossier_id", using: :btree
|
||||
|
@ -195,9 +196,10 @@ ActiveRecord::Schema.define(version: 20160314102523) do
|
|||
add_index "module_api_cartos", ["procedure_id"], name: "index_module_api_cartos_on_procedure_id", unique: true, using: :btree
|
||||
|
||||
create_table "pieces_justificatives", force: :cascade do |t|
|
||||
t.string "content"
|
||||
t.integer "dossier_id"
|
||||
t.integer "type_de_piece_justificative_id"
|
||||
t.string "content"
|
||||
t.integer "dossier_id"
|
||||
t.integer "type_de_piece_justificative_id"
|
||||
t.datetime "created_at"
|
||||
end
|
||||
|
||||
add_index "pieces_justificatives", ["type_de_piece_justificative_id"], name: "index_pieces_justificatives_on_type_de_piece_justificative_id", using: :btree
|
||||
|
|
|
@ -172,6 +172,7 @@ describe API::V1::DossiersController do
|
|||
subject { super().first }
|
||||
|
||||
it { expect(subject.keys.include?(:url)).to be_truthy }
|
||||
it { expect(subject[:created_at]).not_to be_nil }
|
||||
it { expect(subject.keys.include?(:type_de_piece_justificative)).to be_truthy }
|
||||
|
||||
describe 'type de piece justificative' do
|
||||
|
@ -242,6 +243,7 @@ describe API::V1::DossiersController do
|
|||
|
||||
subject { super()[:cerfa] }
|
||||
|
||||
it { expect(subject[:created_at]).not_to be_nil }
|
||||
it { expect(subject[:url]).to match /^http:\/\/.*downloads.*_CERFA\.pdf$/ }
|
||||
end
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ require 'spec_helper'
|
|||
describe Cerfa do
|
||||
describe 'database columns' do
|
||||
it { is_expected.to have_db_column(:content) }
|
||||
it { is_expected.to have_db_column(:created_at) }
|
||||
end
|
||||
|
||||
describe 'associations' do
|
||||
|
|
|
@ -3,6 +3,7 @@ require 'spec_helper'
|
|||
describe PieceJustificative do
|
||||
describe 'database columns' do
|
||||
it { is_expected.to have_db_column(:content) }
|
||||
it { is_expected.to have_db_column(:created_at) }
|
||||
end
|
||||
|
||||
describe 'associations' do
|
||||
|
|
Loading…
Add table
Reference in a new issue