diff --git a/app/controllers/statement_of_works_controller.rb b/app/controllers/statement_of_works_controller.rb index cd107c2..1ffb710 100644 --- a/app/controllers/statement_of_works_controller.rb +++ b/app/controllers/statement_of_works_controller.rb @@ -45,6 +45,6 @@ def set_statement_of_work def statement_of_work_params params.require(:statement_of_work).permit(:model, :hourly_revenue, :total_revenue, :total_hours, :hour_delivery_schedule, :limit_by_delivery_schedule, - :start_date, :end_date) + :start_date, :end_date, :name) end end diff --git a/app/models/project.rb b/app/models/project.rb index 4ce8f5a..d4db78b 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -11,8 +11,8 @@ # name :string # slack_channel :string # slug :string -# sync_source_control :boolean default(FALSE) -# sync_ticket_tracking_system :boolean default(FALSE) +# sync_source_control :boolean default(FALSE), not null +# sync_ticket_tracking_system :boolean default(FALSE), not null # created_at :datetime not null # updated_at :datetime not null # customer_id :bigint not null diff --git a/app/models/statement_of_work.rb b/app/models/statement_of_work.rb index 27d3e9a..1bb9ef1 100644 --- a/app/models/statement_of_work.rb +++ b/app/models/statement_of_work.rb @@ -10,6 +10,7 @@ # hourly_revenue :float # limit_by_delivery_schedule :boolean default(TRUE), not null # model :string +# name :string # start_date :datetime # total_hours :float # total_revenue :float diff --git a/app/views/statement_of_works/_statement_of_work.json.jbuilder b/app/views/statement_of_works/_statement_of_work.json.jbuilder index 8df53ce..3177ff1 100644 --- a/app/views/statement_of_works/_statement_of_work.json.jbuilder +++ b/app/views/statement_of_works/_statement_of_work.json.jbuilder @@ -1,4 +1,4 @@ # frozen_string_literal: true json.extract! statement_of_work, :id, :model, :hourly_revenue, :total_revenue, :total_hours, :hour_delivery_schedule, - :limit_by_delivery_schedule, :start_date, :end_date, :project_id, :created_at, :updated_at + :limit_by_delivery_schedule, :start_date, :end_date, :project_id, :created_at, :updated_at, :name diff --git a/db/migrate/20231127193434_add_name_to_statement_of_work.rb b/db/migrate/20231127193434_add_name_to_statement_of_work.rb new file mode 100644 index 0000000..0eb69c9 --- /dev/null +++ b/db/migrate/20231127193434_add_name_to_statement_of_work.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddNameToStatementOfWork < ActiveRecord::Migration[7.0] + def change + add_column :statement_of_works, :name, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 3e201a4..1ab0c96 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2023_11_22_194613) do +ActiveRecord::Schema[7.0].define(version: 2023_11_27_193434) do # These are extensions that must be enabled in order to support this database enable_extension "pg_stat_statements" enable_extension "plpgsql" @@ -106,8 +106,8 @@ t.json "metadata" t.string "slug" t.string "logo_url" - t.boolean "sync_ticket_tracking_system", default: false - t.boolean "sync_source_control", default: false + t.boolean "sync_ticket_tracking_system", default: false, null: false + t.boolean "sync_source_control", default: false, null: false t.index ["customer_id"], name: "index_projects_on_customer_id" t.index ["slug"], name: "index_projects_on_slug", unique: true end @@ -151,6 +151,7 @@ t.bigint "project_id", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.string "name" t.index ["project_id"], name: "index_statement_of_works_on_project_id" end diff --git a/spec/factories/projects.rb b/spec/factories/projects.rb index 4f18e17..096caac 100644 --- a/spec/factories/projects.rb +++ b/spec/factories/projects.rb @@ -11,8 +11,8 @@ # name :string # slack_channel :string # slug :string -# sync_source_control :boolean default(FALSE) -# sync_ticket_tracking_system :boolean default(FALSE) +# sync_source_control :boolean default(FALSE), not null +# sync_ticket_tracking_system :boolean default(FALSE), not null # created_at :datetime not null # updated_at :datetime not null # customer_id :bigint not null diff --git a/spec/factories/statement_of_works.rb b/spec/factories/statement_of_works.rb index 15eaa93..3ae1896 100644 --- a/spec/factories/statement_of_works.rb +++ b/spec/factories/statement_of_works.rb @@ -10,6 +10,7 @@ # hourly_revenue :float # limit_by_delivery_schedule :boolean default(TRUE), not null # model :string +# name :string # start_date :datetime # total_hours :float # total_revenue :float @@ -30,6 +31,7 @@ project start_date { Time.zone.today - 6.months } end_date { Time.zone.today + 6.months } + name { FFaker::Lorem.sentence } trait :with_maintenance do model { 'maintenance' } diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 8c80c5d..e9f4f16 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -11,8 +11,8 @@ # name :string # slack_channel :string # slug :string -# sync_source_control :boolean default(FALSE) -# sync_ticket_tracking_system :boolean default(FALSE) +# sync_source_control :boolean default(FALSE), not null +# sync_ticket_tracking_system :boolean default(FALSE), not null # created_at :datetime not null # updated_at :datetime not null # customer_id :bigint not null diff --git a/spec/models/statement_of_work_spec.rb b/spec/models/statement_of_work_spec.rb index 3ab5725..9f177ca 100644 --- a/spec/models/statement_of_work_spec.rb +++ b/spec/models/statement_of_work_spec.rb @@ -10,6 +10,7 @@ # hourly_revenue :float # limit_by_delivery_schedule :boolean default(TRUE), not null # model :string +# name :string # start_date :datetime # total_hours :float # total_revenue :float