From 22bc905f5ef7462941a45b29c3909ec74520306b Mon Sep 17 00:00:00 2001 From: stephanie-warmenhoven Date: Thu, 7 May 2020 17:19:37 -0700 Subject: [PATCH] [#1737] Updated schema and seed file --- app/models/category.rb | 2 +- app/models/medication.rb | 1 - app/models/moment.rb | 30 +++++++++++++++--------------- app/models/mood.rb | 2 +- app/models/strategy.rb | 4 ++-- db/seeds.rb | 4 ++-- spec/models/category_spec.rb | 1 + spec/models/moment_spec.rb | 28 +++++++++++++++------------- spec/models/mood_spec.rb | 1 + spec/models/strategy_spec.rb | 3 ++- 10 files changed, 40 insertions(+), 36 deletions(-) diff --git a/app/models/category.rb b/app/models/category.rb index f3de60c5aa..02a520ba33 100644 --- a/app/models/category.rb +++ b/app/models/category.rb @@ -10,7 +10,7 @@ # updated_at :datetime # user_id :integer # slug :string -# visible :boolean +# visible :boolean default(TRUE) # class Category < ApplicationRecord diff --git a/app/models/medication.rb b/app/models/medication.rb index 2c4055081d..161e26f632 100644 --- a/app/models/medication.rb +++ b/app/models/medication.rb @@ -20,7 +20,6 @@ # add_to_google_cal :boolean default(FALSE) # weekly_dosage :integer # default(["0", "1", "2", "3", "4", "5", "6"]), is an Array -# class Medication < ApplicationRecord # dosage: amount of medication taken at one time diff --git a/app/models/moment.rb b/app/models/moment.rb index 04df3f41ae..f630c67490 100644 --- a/app/models/moment.rb +++ b/app/models/moment.rb @@ -3,21 +3,21 @@ # # Table name: moments # -# id :bigint not null, primary key -# name :string -# why :text -# fix :text -# created_at :datetime -# updated_at :datetime -# user_id :integer -# viewers :text -# comment :boolean -# slug :string -# secret_share_identifier :uuid -# secret_share_expires_at :datetime -# published_at :datetime -# bookmarked :boolean -# resource_recommendations :boolean +# id :bigint not null, primary key +# name :string +# why :text +# fix :text +# created_at :datetime +# updated_at :datetime +# user_id :integer +# viewers :text +# comment :boolean +# slug :string +# secret_share_identifier :uuid +# secret_share_expires_at :datetime +# published_at :datetime +# bookmarked :boolean default(FALSE) +# resource_recommendations :boolean default(TRUE) # class Moment < ApplicationRecord diff --git a/app/models/mood.rb b/app/models/mood.rb index 38e0f3d3d7..5ffb829025 100644 --- a/app/models/mood.rb +++ b/app/models/mood.rb @@ -10,7 +10,7 @@ # updated_at :datetime # user_id :integer # slug :string -# visible :boolean +# visible :boolean default(TRUE) # class Mood < ApplicationRecord diff --git a/app/models/strategy.rb b/app/models/strategy.rb index 5d03249adb..03d35ab023 100644 --- a/app/models/strategy.rb +++ b/app/models/strategy.rb @@ -13,8 +13,8 @@ # name :string # slug :string # published_at :datetime -# visible :boolean -# bookmarked :boolean +# visible :boolean default(TRUE) +# bookmarked :boolean default(FALSE) # class Strategy < ApplicationRecord diff --git a/db/seeds.rb b/db/seeds.rb index 309256db68..93a128592c 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -23,7 +23,7 @@ user1_category1 = Category.create(user_id: user1.id, name: 'Public Speaking', description: 'Speaking in front of an audience at school') user1_mood1 = Mood.create(user_id: user1.id, name: 'Anxious', description: 'Sweaty palms, increased heart rate') user1_mood2 = Mood.create(user_id: user1.id, name: 'Shy', description: 'I swallow my words and start speaking fast') -user1_moment1 = Moment.create(user_id: user1.id, category: Array.new(1, user1_category1.id), mood: [user1_mood1.id, user1_mood2.id], name: 'Presentation for ENGL 101', why: 'I am presenting in front of my classmates and I am worried I will make a fool out of myself', viewers: [user2.id, user3.id], comment: true) +user1_moment1 = Moment.create(user_id: user1.id, category: Array.new(1, user1_category1.id), mood: [user1_mood1.id, user1_mood2.id], name: 'Presentation for ENGL 101', why: 'I am presenting in front of my classmates and I am worried I will make a fool out of myself', viewers: [user2.id, user3.id], comment: true, resource_reccomedations: true) user1_moment1_comment = Comment.create(commentable_type: 'moment', commentable_id: user1_moment1.id, comment_by: user2.id, comment: "Good luck on the presentation! Just pretend everyone is in underpants :)", visibility: 'private') user1_group1 = Group.create(name: 'Students with Anxiety', description: 'A support group for students to discuss anxiety weekly') user1_group1_member1 = GroupMember.create(group_id: user1_group1.id, user_id: user1.id, leader: true) @@ -38,6 +38,6 @@ user2_category1 = Category.create(user_id: user2.id, name: 'Brother', description: 'We have a strained relationship') user2_mood1 = Mood.create(user_id: user2.id, name: 'Angry', description: 'I become violent and act irrationally') user2_mood2 = Mood.create(user_id: user2.id, name: 'Exhausted', description: 'No motivation to do anything') -user2_moment1 = Moment.create(user_id: user2.id, category: Array.new(1, user2_category1.id), mood: Array.new(1, user2_mood1.id), name: 'Thanksgiving Dinner', why: 'He kept asserting to everyone that I was immature and he always did everything for me.', viewers: Array.new(1, user1.id), comment: false) +user2_moment1 = Moment.create(user_id: user2.id, category: Array.new(1, user2_category1.id), mood: Array.new(1, user2_mood1.id), name: 'Thanksgiving Dinner', why: 'He kept asserting to everyone that I was immature and he always did everything for me.', viewers: Array.new(1, user1.id), comment: false, resource_reccomedations: true) user2_moment1_comment = Comment.create(commentable_type: 'moment', commentable_id: user2_moment1.id, comment_by: user1.id, comment: "You should talk to him one-on-one and tell him how you feel!", visibility: 'all') user1_group1_member2 = GroupMember.create(group_id: user1_group1.id, user_id: user2.id, leader: true) diff --git a/spec/models/category_spec.rb b/spec/models/category_spec.rb index 135043fdb5..ad9744b13a 100644 --- a/spec/models/category_spec.rb +++ b/spec/models/category_spec.rb @@ -10,6 +10,7 @@ # updated_at :datetime # user_id :integer # slug :string +# visible :boolean default(TRUE) # describe Category do diff --git a/spec/models/moment_spec.rb b/spec/models/moment_spec.rb index c8ab6f88b2..20fc19d1fd 100644 --- a/spec/models/moment_spec.rb +++ b/spec/models/moment_spec.rb @@ -3,19 +3,21 @@ # # Table name: moments # -# id :bigint not null, primary key -# name :string -# why :text -# fix :text -# created_at :datetime -# updated_at :datetime -# user_id :integer -# viewers :text -# comment :boolean -# slug :string -# secret_share_identifier :uuid -# secret_share_expires_at :datetime -# published_at :datetime +# id :bigint not null, primary key +# name :string +# why :text +# fix :text +# created_at :datetime +# updated_at :datetime +# user_id :integer +# viewers :text +# comment :boolean +# slug :string +# secret_share_identifier :uuid +# secret_share_expires_at :datetime +# published_at :datetime +# bookmarked :boolean default(FALSE) +# resource_recommendations :boolean default(TRUE) # describe Moment do diff --git a/spec/models/mood_spec.rb b/spec/models/mood_spec.rb index 3d50335d03..568a4d3fc3 100644 --- a/spec/models/mood_spec.rb +++ b/spec/models/mood_spec.rb @@ -10,6 +10,7 @@ # updated_at :datetime # user_id :integer # slug :string +# visible :boolean default(TRUE) # describe Mood do diff --git a/spec/models/strategy_spec.rb b/spec/models/strategy_spec.rb index 6918f14f2b..6b55d43bd1 100644 --- a/spec/models/strategy_spec.rb +++ b/spec/models/strategy_spec.rb @@ -5,7 +5,6 @@ # # id :bigint not null, primary key # user_id :integer -# category :text # description :text # viewers :text # comment :boolean @@ -14,6 +13,8 @@ # name :string # slug :string # published_at :datetime +# visible :boolean default(TRUE) +# bookmarked :boolean default(FALSE) # describe Strategy do