From 3258aa1e0b9155cafc1b3d59c98d29dfdb02dbd5 Mon Sep 17 00:00:00 2001 From: "hannah.dagemark" Date: Fri, 23 May 2025 15:43:32 +0200 Subject: [PATCH] Create users, groups, user_summary models --- app/models/group.rb | 7 +++++++ app/models/user.rb | 8 ++++++++ app/models/user_summary.rb | 7 +++++++ app/views/main/.keep | 0 test/fixtures/groups.yml | 11 +++++++++++ test/fixtures/user_summaries.yml | 11 +++++++++++ test/fixtures/users.yml | 11 +++++++++++ test/models/group_test.rb | 7 +++++++ test/models/user_summary_test.rb | 7 +++++++ test/models/user_test.rb | 7 +++++++ 10 files changed, 76 insertions(+) create mode 100644 app/models/group.rb create mode 100644 app/models/user.rb create mode 100644 app/models/user_summary.rb create mode 100644 app/views/main/.keep create mode 100644 test/fixtures/groups.yml create mode 100644 test/fixtures/user_summaries.yml create mode 100644 test/fixtures/users.yml create mode 100644 test/models/group_test.rb create mode 100644 test/models/user_summary_test.rb create mode 100644 test/models/user_test.rb diff --git a/app/models/group.rb b/app/models/group.rb new file mode 100644 index 0000000..c3e23f5 --- /dev/null +++ b/app/models/group.rb @@ -0,0 +1,7 @@ +class Group + include Mongoid::Document + include Mongoid::Timestamps + + field :group_name, type: String + embeds_many :UserSummary +end diff --git a/app/models/user.rb b/app/models/user.rb new file mode 100644 index 0000000..6a175af --- /dev/null +++ b/app/models/user.rb @@ -0,0 +1,8 @@ +class User + include Mongoid::Document + include Mongoid::Timestamps + + field :user_id, type: BSON::ObjectId + field :user_name, type: String + field :user_description, type: String +end diff --git a/app/models/user_summary.rb b/app/models/user_summary.rb new file mode 100644 index 0000000..25df1d9 --- /dev/null +++ b/app/models/user_summary.rb @@ -0,0 +1,7 @@ +class UserSummary + include Mongoid::Document + include Mongoid::Timestamps + + field :user_id, type: BSON::ObjectId + field :user_name, type: String +end diff --git a/app/views/main/.keep b/app/views/main/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/fixtures/groups.yml b/test/fixtures/groups.yml new file mode 100644 index 0000000..d7a3329 --- /dev/null +++ b/test/fixtures/groups.yml @@ -0,0 +1,11 @@ +# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +# This model initially had no columns defined. If you add columns to the +# model remove the "{}" from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: {} +# column: value +# +two: {} +# column: value diff --git a/test/fixtures/user_summaries.yml b/test/fixtures/user_summaries.yml new file mode 100644 index 0000000..d7a3329 --- /dev/null +++ b/test/fixtures/user_summaries.yml @@ -0,0 +1,11 @@ +# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +# This model initially had no columns defined. If you add columns to the +# model remove the "{}" from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: {} +# column: value +# +two: {} +# column: value diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml new file mode 100644 index 0000000..d7a3329 --- /dev/null +++ b/test/fixtures/users.yml @@ -0,0 +1,11 @@ +# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +# This model initially had no columns defined. If you add columns to the +# model remove the "{}" from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: {} +# column: value +# +two: {} +# column: value diff --git a/test/models/group_test.rb b/test/models/group_test.rb new file mode 100644 index 0000000..eddbcc8 --- /dev/null +++ b/test/models/group_test.rb @@ -0,0 +1,7 @@ +require "test_helper" + +class GroupTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/user_summary_test.rb b/test/models/user_summary_test.rb new file mode 100644 index 0000000..da4b988 --- /dev/null +++ b/test/models/user_summary_test.rb @@ -0,0 +1,7 @@ +require "test_helper" + +class UserSummaryTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/user_test.rb b/test/models/user_test.rb new file mode 100644 index 0000000..5c07f49 --- /dev/null +++ b/test/models/user_test.rb @@ -0,0 +1,7 @@ +require "test_helper" + +class UserTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end