From 220688e6f8e568c20e491cefcaf8dcb893f935b5 Mon Sep 17 00:00:00 2001 From: Daniel Chincoya Date: Wed, 11 Jan 2023 08:27:38 -0600 Subject: [PATCH 1/8] 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/8] 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/8] 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/8] 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 140fa5f751599547bf5ad546bd00201b8dda103d Mon Sep 17 00:00:00 2001 From: Daniel Chincoya Date: Wed, 11 Jan 2023 08:28:08 -0600 Subject: [PATCH 5/8] 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 00733ea993fe5b83561fa40686d40cfd1d981479 Mon Sep 17 00:00:00 2001 From: barbaraim Date: Wed, 11 Jan 2023 12:30:20 -0300 Subject: [PATCH 6/8] chore: add nickname to ignored columns on people --- app/models/person.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/person.rb b/app/models/person.rb index 211e91f..80e4f0a 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -1,7 +1,7 @@ class Person < ApplicationRecord has_many :tasks - self.ignored_columns = [:email] + self.ignored_columns = [:email, :nickname] def full_name "#{last_name}, #{first_name}" From f78b03aabdd7f7249ac1fdd1d814cdce84060799 Mon Sep 17 00:00:00 2001 From: barbaraim Date: Wed, 11 Jan 2023 12:33:38 -0300 Subject: [PATCH 7/8] chore: add nickname column to people with migration and schema --- db/migrate/20230111153146_add_nickname_to_people.rb | 6 ++++++ db/schema.rb | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20230111153146_add_nickname_to_people.rb diff --git a/db/migrate/20230111153146_add_nickname_to_people.rb b/db/migrate/20230111153146_add_nickname_to_people.rb new file mode 100644 index 0000000..a0aaabd --- /dev/null +++ b/db/migrate/20230111153146_add_nickname_to_people.rb @@ -0,0 +1,6 @@ +# Migration for adding the nickname column to People +class AddNicknameToPeople < ActiveRecord::Migration[6.1] + def change + add_column :people, :nickname, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 2518478..ff35c56 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_153146) do create_table "people", force: :cascade do |t| t.string "first_name" @@ -20,6 +20,7 @@ t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false t.string "email" + t.string "nickname" end create_table "tasks", force: :cascade do |t| From 5cab5baa98e0f399ec5d55a2c121bae009c4bc2a Mon Sep 17 00:00:00 2001 From: barbaraim Date: Wed, 11 Jan 2023 12:35:38 -0300 Subject: [PATCH 8/8] feat: add nickname field to people controller --- app/controllers/people_controller.rb | 2 +- app/models/person.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb index d03d7a0..e414a16 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, :email], + only: [:doc_number, :doc_type, :email, :nickname], methods: [:full_name], include: { tasks: { diff --git a/app/models/person.rb b/app/models/person.rb index 80e4f0a..211e91f 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -1,7 +1,7 @@ class Person < ApplicationRecord has_many :tasks - self.ignored_columns = [:email, :nickname] + self.ignored_columns = [:email] def full_name "#{last_name}, #{first_name}"