Create users, groups, user_summary models

This commit is contained in:
hannah.dagemark 2025-05-23 15:43:32 +02:00
commit 3258aa1e0b
10 changed files with 76 additions and 0 deletions

7
app/models/group.rb Normal file
View file

@ -0,0 +1,7 @@
class Group
include Mongoid::Document
include Mongoid::Timestamps
field :group_name, type: String
embeds_many :UserSummary
end

8
app/models/user.rb Normal file
View file

@ -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

View file

@ -0,0 +1,7 @@
class UserSummary
include Mongoid::Document
include Mongoid::Timestamps
field :user_id, type: BSON::ObjectId
field :user_name, type: String
end

0
app/views/main/.keep Normal file
View file

11
test/fixtures/groups.yml vendored Normal file
View file

@ -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

11
test/fixtures/user_summaries.yml vendored Normal file
View file

@ -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

11
test/fixtures/users.yml vendored Normal file
View file

@ -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

View file

@ -0,0 +1,7 @@
require "test_helper"
class GroupTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

View file

@ -0,0 +1,7 @@
require "test_helper"
class UserSummaryTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

7
test/models/user_test.rb Normal file
View file

@ -0,0 +1,7 @@
require "test_helper"
class UserTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end