From 220688e6f8e568c20e491cefcaf8dcb893f935b5 Mon Sep 17 00:00:00 2001 From: Daniel Chincoya Date: Wed, 11 Jan 2023 08:27:38 -0600 Subject: [PATCH 1/5] chore: add email to ignored columns on people --- app/models/person.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/models/person.rb b/app/models/person.rb index fb684ea..211e91f 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -1,6 +1,8 @@ class Person < ApplicationRecord has_many :tasks + self.ignored_columns = [:email] + def full_name "#{last_name}, #{first_name}" end From 8b4b2c0269818c3ba81bfb3ea09be674bc3a650c Mon Sep 17 00:00:00 2001 From: Daniel Chincoya Date: Wed, 11 Jan 2023 08:28:08 -0600 Subject: [PATCH 2/5] chore: add email column to people --- db/migrate/20230111142035_add_email_to_person.rb | 5 +++++ db/schema.rb | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20230111142035_add_email_to_person.rb diff --git a/db/migrate/20230111142035_add_email_to_person.rb b/db/migrate/20230111142035_add_email_to_person.rb new file mode 100644 index 0000000..b7f8327 --- /dev/null +++ b/db/migrate/20230111142035_add_email_to_person.rb @@ -0,0 +1,5 @@ +class AddEmailToPerson < ActiveRecord::Migration[6.1] + def change + add_column :people, :email, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index fa3907b..2518478 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.define(version: 2023_01_11_061901) do +ActiveRecord::Schema.define(version: 2023_01_11_142035) do create_table "people", force: :cascade do |t| t.string "first_name" @@ -19,6 +19,7 @@ t.string "doc_type" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false + t.string "email" end create_table "tasks", force: :cascade do |t| From e8af58fb345f5460dcbe023ef2821f0e2c527e6c Mon Sep 17 00:00:00 2001 From: Daniel Chincoya Date: Wed, 11 Jan 2023 08:30:34 -0600 Subject: [PATCH 3/5] feat: add email field to people --- app/controllers/people_controller.rb | 2 +- app/models/person.rb | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb index 08cb35e..d03d7a0 100644 --- a/app/controllers/people_controller.rb +++ b/app/controllers/people_controller.rb @@ -11,7 +11,7 @@ def show def json_attributes { - only: [:doc_number, :doc_type], + only: [:doc_number, :doc_type, :email], methods: [:full_name], include: { tasks: { diff --git a/app/models/person.rb b/app/models/person.rb index 211e91f..fb684ea 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -1,8 +1,6 @@ class Person < ApplicationRecord has_many :tasks - self.ignored_columns = [:email] - def full_name "#{last_name}, #{first_name}" end From bd61ddb25f84f597916c6d2e092548dc2377e216 Mon Sep 17 00:00:00 2001 From: Daniel Chincoya Date: Wed, 11 Jan 2023 08:27:38 -0600 Subject: [PATCH 4/5] chore: add email to ignored columns on people --- app/models/person.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/models/person.rb b/app/models/person.rb index fb684ea..211e91f 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -1,6 +1,8 @@ class Person < ApplicationRecord has_many :tasks + self.ignored_columns = [:email] + def full_name "#{last_name}, #{first_name}" end From 2d0c42c443e048ecc86dcae16f06a7cbc5cc0320 Mon Sep 17 00:00:00 2001 From: amparostevens Date: Wed, 11 Jan 2023 12:59:57 -0300 Subject: [PATCH 5/5] chore: add new column duration to tasks --- db/migrate/20230111154617_add_duration_to_task.rb | 5 +++++ db/schema.rb | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20230111154617_add_duration_to_task.rb diff --git a/db/migrate/20230111154617_add_duration_to_task.rb b/db/migrate/20230111154617_add_duration_to_task.rb new file mode 100644 index 0000000..23eb384 --- /dev/null +++ b/db/migrate/20230111154617_add_duration_to_task.rb @@ -0,0 +1,5 @@ +class AddDurationToTask < ActiveRecord::Migration[6.1] + def change + add_column :tasks, :duration, :integer + end +end diff --git a/db/schema.rb b/db/schema.rb index 2518478..ec19a35 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.define(version: 2023_01_11_142035) do +ActiveRecord::Schema.define(version: 2023_01_11_154617) do create_table "people", force: :cascade do |t| t.string "first_name" @@ -28,6 +28,7 @@ t.integer "person_id", null: false t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false + t.integer "duration" t.index ["person_id"], name: "index_tasks_on_person_id" end