added 260907 version of worker toolkit

This commit is contained in:
2026-09-08 20:30:51 -04:00
parent cbd3f0f8ca
commit 97aca37663
1283 changed files with 142951 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
FactoryBot.define do
factory :checkin_condition, class: Checkin::Condition do
transient do
values { [(0..4).to_a + [nil]] }
end
condition_id { FactoryBot.create(:condition).id }
value { values.sample }
end
end

View File

@@ -0,0 +1,9 @@
FactoryBot.define do
factory :checkin_symptom, class: Checkin::Symptom do
transient do
values { [(0..4).to_a + [nil]] }
end
symptom_id { FactoryBot.create(:symptom).id }
value { values.sample }
end
end

View File

@@ -0,0 +1,10 @@
FactoryBot.define do
factory :checkin_treatment, class: Checkin::Treatment do
transient do
values { ["20 mg", "2 ml", "3 x 1 cap", "2 x 10 mg", nil, "3 x 4 ml", "1 cap", "5 ml", "2 x 2 cap"] }
end
treatment_id { FactoryBot.create(:treatment).id }
value { values.sample }
is_taken { value.present? ? true : [true, false].sample }
end
end

View File

@@ -0,0 +1,8 @@
FactoryBot.define do
factory :checkin do
user_id { FactoryBot.create(:user).id }
sequence(:date) { |n| Time.zone.now - n.days }
note { FFaker::Lorem.sentence }
tag_ids { FactoryBot.create_list(:tag, 2).map(&:id) }
end
end

View File

@@ -0,0 +1,7 @@
FactoryBot.define do
factory :comment do
body { "This is a comment." }
encrypted_user_id { create(:user).encrypted_id }
post_id { create(:post).id }
end
end

View File

@@ -0,0 +1,20 @@
# == Schema Information
#
# Table name: conditions
#
# id :integer not null, primary key
# global :boolean default(TRUE)
# created_at :datetime not null
# updated_at :datetime not null
# trackable_usages_count :integer default(0)
#
FactoryBot.define do
factory :condition do
sequence(:name) { |n| "Condition#{n}" }
trait :personal do
global { false }
end
end
end

View File

@@ -0,0 +1,14 @@
FactoryBot.define do
factory :food do
sequence(:ndb_no) { |n| "id#{n}" }
comname { FFaker::Lorem.sentence }
long_desc { FFaker::Lorem.sentence }
sciname { FFaker::Lorem.sentence }
shrt_desc { FFaker::Lorem.sentence }
trait :personal do
global { false }
end
end
end

View File

@@ -0,0 +1,11 @@
FactoryBot.define do
factory :notification do
kind { "reaction" }
notificateable { create(:post) }
encrypted_user_id { create(:user).encrypted_id }
encrypted_notify_user_id { create(:user).encrypted_id }
initialize_with { new(attributes) }
end
end

View File

@@ -0,0 +1,8 @@
FactoryBot.define do
factory :pattern do
encrypted_user_id { create(:user).encrypted_id }
start_at { Time.zone.now }
end_at { 2.days.from_now }
name { "Chuck Norris" }
end
end

View File

@@ -0,0 +1,8 @@
FactoryBot.define do
factory :post do
title { "Frustrating day" }
body { "Today was really hard with my symptoms" }
encrypted_user_id { "abcd1234" }
symptom_ids { [create(:symptom).id] }
end
end

View File

@@ -0,0 +1,30 @@
# == Schema Information
#
# Table name: profiles
#
# id :integer not null, primary key
# user_id :integer
# country_id :string
# birth_date :date
# sex_id :string
# onboarding_step_id :string
# created_at :datetime not null
# updated_at :datetime not null
# ethnicity_ids_string :string
# day_habit_id :string
# education_level_id :string
# day_walking_hours :integer
# most_recent_doses :hstore
# screen_name :string
# most_recent_conditions_positions :hstore
# most_recent_symptoms_positions :hstore
# most_recent_treatments_positions :hstore
#
FactoryBot.define do
factory :profile do
birth_date { (25..55).to_a.sample.years.ago }
country_id { FFaker::Address.country_code }
sex_id { Sex.all_ids.sample }
end
end

View File

@@ -0,0 +1,7 @@
FactoryBot.define do
factory :promotion_rate do
user_id { FactoryBot.create(:user).id }
sequence(:date) { |n| Time.zone.now - n.days }
score { rand(1..10) }
end
end

View File

@@ -0,0 +1,7 @@
FactoryBot.define do
factory :reaction do
value { ":smile:" }
encrypted_user_id { create(:user).encrypted_id }
reactable { create(:post) }
end
end

View File

@@ -0,0 +1,20 @@
# == Schema Information
#
# Table name: symptoms
#
# id :integer not null, primary key
# global :boolean default(TRUE)
# created_at :datetime not null
# updated_at :datetime not null
# trackable_usages_count :integer default(0)
#
FactoryBot.define do
factory :symptom do
sequence(:name) { |n| "Symptom#{n}" }
trait :personal do
global { false }
end
end
end

View File

@@ -0,0 +1,18 @@
# == Schema Information
#
# Table name: tags
#
# id :integer not null, primary key
# created_at :datetime not null
# updated_at :datetime not null
#
FactoryBot.define do
factory :tag do
sequence(:name) { |n| "Tag#{n}" }
trait :personal do
global { false }
end
end
end

View File

@@ -0,0 +1,4 @@
FactoryBot.define do
factory :topic_following do
end
end

View File

@@ -0,0 +1,19 @@
# == Schema Information
#
# Table name: trackable_usages
#
# id :integer not null, primary key
# user_id :integer
# trackable_id :integer
# trackable_type :string
# count :integer default(1)
# created_at :datetime not null
# updated_at :datetime not null
#
FactoryBot.define do
factory :trackable_usage do
user
association :trackable, factory: :condition
end
end

View File

@@ -0,0 +1,41 @@
# == Schema Information
#
# Table name: trackings
#
# id :integer not null, primary key
# user_id :integer
# trackable_id :integer
# trackable_type :string
# start_at :date
# end_at :date
# color_id :integer
# created_at :datetime not null
# updated_at :datetime not null
#
FactoryBot.define do
factory :tracking do
user
trait :for_condition do
association :trackable, factory: :condition
end
trait :for_symptom do
association :trackable, factory: :symptom
end
trait :for_treatment do
association :trackable, factory: :treatment
end
trait :active do
start_at { Time.zone.today }
end
trait :inactive do
start_at { Time.zone.today - 7.days }
end_at { Date.yesterday }
end
end
end

View File

@@ -0,0 +1,20 @@
# == Schema Information
#
# Table name: treatments
#
# id :integer not null, primary key
# global :boolean default(TRUE)
# created_at :datetime not null
# updated_at :datetime not null
# trackable_usages_count :integer default(0)
#
FactoryBot.define do
factory :treatment do
sequence(:name) { |n| "Treatment#{n}" }
trait :personal do
global { false }
end
end
end

View File

@@ -0,0 +1,17 @@
# == Schema Information
#
# Table name: user_conditions
#
# id :integer not null, primary key
# user_id :integer
# condition_id :integer
# created_at :datetime not null
# updated_at :datetime not null
#
FactoryBot.define do
factory :user_condition do
user
association :condition, :personal
end
end

View File

@@ -0,0 +1,6 @@
FactoryBot.define do
factory :user_food do
user
association :food, :personal
end
end

View File

@@ -0,0 +1,17 @@
# == Schema Information
#
# Table name: user_symptoms
#
# id :integer not null, primary key
# user_id :integer
# symptom_id :integer
# created_at :datetime not null
# updated_at :datetime not null
#
FactoryBot.define do
factory :user_symptom do
user
association :symptom, :personal
end
end

View File

@@ -0,0 +1,6 @@
FactoryBot.define do
factory :user_tag do
user
association :tag, :personal
end
end

View File

@@ -0,0 +1,17 @@
# == Schema Information
#
# Table name: user_treatments
#
# id :integer not null, primary key
# user_id :integer
# treatment_id :integer
# created_at :datetime not null
# updated_at :datetime not null
#
FactoryBot.define do
factory :user_treatment do
user
association :treatment, :personal
end
end

View File

@@ -0,0 +1,34 @@
# == Schema Information
#
# Table name: users
#
# id :integer not null, primary key
# email :string default(""), not null
# encrypted_password :string default(""), not null
# reset_password_token :string
# reset_password_sent_at :datetime
# remember_created_at :datetime
# sign_in_count :integer default(0), not null
# current_sign_in_at :datetime
# last_sign_in_at :datetime
# current_sign_in_ip :string
# last_sign_in_ip :string
# authentication_token :string not null
# invitation_token :string
# invitation_created_at :datetime
# invitation_sent_at :datetime
# invitation_accepted_at :datetime
# invitation_limit :integer
# invited_by_id :integer
# invited_by_type :string
# created_at :datetime not null
# updated_at :datetime not null
#
FactoryBot.define do
factory :user do
sequence(:email) { |number| "user#{number}@example.com" }
password { "password123" }
password_confirmation { "password123" }
end
end

View File

@@ -0,0 +1,12 @@
FactoryBot.define do
factory :weather do
date { "MyString" }
postal_code { "MyString" }
icon { "MyString" }
temperature_min { 1.5 }
temperature_max { 1.5 }
precip_intensity { 1.5 }
pressure { 1.5 }
humidity { 1.5 }
end
end