ecom_model 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +28 -0
  4. data/Rakefile +24 -0
  5. data/app/controllers/ecom_model/application_controller.rb +5 -0
  6. data/app/models/ecom/model/application_module.rb +7 -0
  7. data/app/models/ecom/model/application_record.rb +7 -0
  8. data/app/models/ecom/model/crew.rb +14 -0
  9. data/app/models/ecom/model/crew_time.rb +7 -0
  10. data/app/models/ecom/model/crew_type.rb +6 -0
  11. data/app/models/ecom/model/currency.rb +7 -0
  12. data/app/models/ecom/model/equipment_type.rb +6 -0
  13. data/app/models/ecom/model/material_type.rb +6 -0
  14. data/app/models/ecom/model/menu.rb +10 -0
  15. data/app/models/ecom/model/product_type.rb +10 -0
  16. data/app/models/ecom/model/project.rb +15 -0
  17. data/app/models/ecom/model/resource_type.rb +9 -0
  18. data/app/models/ecom/model/stakeholder.rb +11 -0
  19. data/app/models/ecom/model/stakeholder_type.rb +7 -0
  20. data/app/models/ecom/model/task.rb +10 -0
  21. data/app/models/ecom/model/task_template.rb +34 -0
  22. data/app/models/ecom/model/task_template_type.rb +7 -0
  23. data/app/models/ecom/model/user.rb +18 -0
  24. data/app/models/ecom/model/user_role.rb +12 -0
  25. data/app/models/ecom/model/work_component.rb +14 -0
  26. data/app/models/ecom/model/work_component_template.rb +11 -0
  27. data/app/models/ecom/model/work_product.rb +70 -0
  28. data/app/models/ecom/model/work_product_template.rb +14 -0
  29. data/config/database.ci.yml +12 -0
  30. data/config/routes.rb +2 -0
  31. data/db/migrate/20191119010518_create_ecom_model_task_template_types.rb +13 -0
  32. data/db/migrate/20191119012030_create_ecom_model_task_templates.rb +15 -0
  33. data/db/migrate/20191119013236_create_ecom_model_work_product_templates.rb +15 -0
  34. data/db/migrate/20191119144141_create_ecom_model_stakeholder_types.rb +10 -0
  35. data/db/migrate/20191119144618_create_ecom_model_stakeholders.rb +19 -0
  36. data/db/migrate/20191119145711_create_ecom_model_resource_types.rb +15 -0
  37. data/db/migrate/20191201131341_create_ecom_model_product_types.rb +14 -0
  38. data/db/migrate/20191201134420_create_ecom_model_work_component_templates.rb +23 -0
  39. data/db/migrate/20191201145816_create_ecom_model_currencies.rb +10 -0
  40. data/db/migrate/20191201145848_create_ecom_model_projects.rb +34 -0
  41. data/db/migrate/20191202103735_create_ecom_model_tasks.rb +17 -0
  42. data/db/migrate/20191202105355_create_task_templates_resource_types.rb +16 -0
  43. data/db/migrate/20191202220752_create_ecom_model_application_modules.rb +10 -0
  44. data/db/migrate/20191202220832_create_ecom_model_users.rb +24 -0
  45. data/db/migrate/20191202220953_create_ecom_model_user_roles.rb +22 -0
  46. data/db/migrate/20191202221423_create_ecom_model_menus.rb +25 -0
  47. data/db/migrate/20191202235434_create_ecom_model_work_products.rb +35 -0
  48. data/db/migrate/20191206104247_create_ecom_model_work_components.rb +30 -0
  49. data/db/migrate/20191225100054_create_ecom_model_crews.rb +17 -0
  50. data/db/migrate/20191225211712_create_ecom_model_crew_times.rb +15 -0
  51. data/lib/ecom/model/engine.rb +19 -0
  52. data/lib/ecom/model/version.rb +5 -0
  53. data/lib/ecom/model.rb +4 -0
  54. data/lib/ecom_model.rb +4 -0
  55. data/lib/tasks/ecom_model_tasks.rake +4 -0
  56. data/spec/factories/ecom/model/application_modules.rb +6 -0
  57. data/spec/factories/ecom/model/crew_times.rb +9 -0
  58. data/spec/factories/ecom/model/crew_types.rb +5 -0
  59. data/spec/factories/ecom/model/crews.rb +12 -0
  60. data/spec/factories/ecom/model/currencies.rb +6 -0
  61. data/spec/factories/ecom/model/equipment_types.rb +5 -0
  62. data/spec/factories/ecom/model/material_types.rb +5 -0
  63. data/spec/factories/ecom/model/menus.rb +9 -0
  64. data/spec/factories/ecom/model/product_types.rb +7 -0
  65. data/spec/factories/ecom/model/projects.rb +23 -0
  66. data/spec/factories/ecom/model/resource_types.rb +8 -0
  67. data/spec/factories/ecom/model/stakeholder_types.rb +5 -0
  68. data/spec/factories/ecom/model/stakeholders.rb +13 -0
  69. data/spec/factories/ecom/model/task_template_types.rb +6 -0
  70. data/spec/factories/ecom/model/task_templates.rb +15 -0
  71. data/spec/factories/ecom/model/tasks.rb +10 -0
  72. data/spec/factories/ecom/model/user_roles.rb +6 -0
  73. data/spec/factories/ecom/model/users.rb +9 -0
  74. data/spec/factories/ecom/model/work_component_templates.rb +11 -0
  75. data/spec/factories/ecom/model/work_components.rb +18 -0
  76. data/spec/factories/ecom/model/work_product_templates.rb +9 -0
  77. data/spec/factories/ecom/model/work_products.rb +22 -0
  78. metadata +260 -0
@@ -0,0 +1,16 @@
1
+ class CreateTaskTemplatesResourceTypes < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :ecom_model_task_templates_resource_types, id: false do |t|
4
+ t.references :task_template, index: false
5
+ t.references :resource_type, index: false
6
+ end
7
+
8
+ add_index :ecom_model_task_templates_resource_types, %i[task_template_id resource_type_id],
9
+ unique: true, name: 'ttr_on_tt_rt_indx'
10
+
11
+ add_foreign_key :ecom_model_task_templates_resource_types, :ecom_model_task_templates,
12
+ column: :task_template_id
13
+ add_foreign_key :ecom_model_task_templates_resource_types, :ecom_model_resource_types,
14
+ column: :resource_type_id
15
+ end
16
+ end
@@ -0,0 +1,10 @@
1
+ class CreateEcomModelApplicationModules < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :ecom_model_application_modules do |t|
4
+ t.string :code, unique: true
5
+ t.string :name, unique: true
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,24 @@
1
+ class CreateEcomModelUsers < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :ecom_model_users do |t|
4
+ t.string :first_name, null: false
5
+ t.string :last_name, null: false
6
+ t.string :email, null: false
7
+ t.boolean :active, null: false, default: true
8
+ t.string :password_digest
9
+
10
+ t.timestamps
11
+ end
12
+
13
+ create_table :ecom_model_application_modules_users, id: false do |t|
14
+ t.references :user, index: false
15
+ t.references :application_module, index: false
16
+ end
17
+
18
+ add_index :ecom_model_application_modules_users, %i[user_id application_module_id], name: 'am_on_users_indx'
19
+
20
+ add_foreign_key :ecom_model_application_modules_users, :ecom_model_users, column: :user_id
21
+ add_foreign_key :ecom_model_application_modules_users, :ecom_model_application_modules,
22
+ column: :application_module_id
23
+ end
24
+ end
@@ -0,0 +1,22 @@
1
+ class CreateEcomModelUserRoles < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :ecom_model_user_roles do |t|
4
+ t.string :name, index: false
5
+ t.references :application_module, index: { name: 'ur_on_am_indx' }
6
+
7
+ t.timestamps
8
+ end
9
+ add_index :ecom_model_user_roles, %i[name application_module_id], unique: true, name: 'am_name_indx'
10
+ add_foreign_key :ecom_model_user_roles, :ecom_model_application_modules,
11
+ column: :application_module_id
12
+
13
+ create_table :ecom_model_users_user_roles, id: false do |t|
14
+ t.references :user, index: false
15
+ t.references :user_role, index: false
16
+ end
17
+
18
+ add_index :ecom_model_users_user_roles, %i[user_id user_role_id], unique: true, name: 'users_user_roles_indx'
19
+ add_foreign_key :ecom_model_users_user_roles, :ecom_model_users, column: :user_id
20
+ add_foreign_key :ecom_model_users_user_roles, :ecom_model_user_roles, column: :user_role_id
21
+ end
22
+ end
@@ -0,0 +1,25 @@
1
+ class CreateEcomModelMenus < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :ecom_model_menus do |t|
4
+ t.string :label, null: false
5
+ t.string :icon
6
+ t.string :route, null: false
7
+ t.references :parent, index: { name: 'menus_on_menus_indx' }
8
+ t.references :application_module, index: { name: 'menus_on_am_indx' }
9
+
10
+ t.timestamps
11
+ end
12
+
13
+ add_foreign_key :ecom_model_menus, :ecom_model_menus, column: :parent_id
14
+ add_foreign_key :ecom_model_menus, :ecom_model_application_modules, column: :application_module_id
15
+
16
+ create_table :ecom_model_menus_user_roles, id: false do |t|
17
+ t.references :menu, index: false
18
+ t.references :user_role, index: false
19
+ end
20
+
21
+ add_index :ecom_model_menus_user_roles, %i[menu_id user_role_id], unique: true, name: 'menus_user_roles_indx'
22
+ add_foreign_key :ecom_model_menus_user_roles, :ecom_model_menus, column: :menu_id
23
+ add_foreign_key :ecom_model_menus_user_roles, :ecom_model_user_roles, column: :user_role_id
24
+ end
25
+ end
@@ -0,0 +1,35 @@
1
+ class CreateEcomModelWorkProducts < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :ecom_model_work_products do |t|
4
+ t.string :code, null: false
5
+ t.string :name, null: false
6
+ t.string :description
7
+ t.string :design_reference_no, unique: true
8
+ t.json :dimension
9
+ t.references :task, index: { name: 'task_on_wp_indx' }
10
+ t.references :work_product_template, index: { name: 'wpt_on_wp_indx' }
11
+ t.references :project, index: { name: 'projects_on_wp_indx' }
12
+ t.string :assignment_status, default: 'UNASSIGNED'
13
+ t.string :task_status, default: 'NEW'
14
+ t.integer :percent_completed
15
+ t.string :remark
16
+ t.references :performer, index: { name: 'pr_on_work_product_indx' }
17
+ t.references :approver, index: { name: 'app_on_work_product_indx' }
18
+ t.references :supervisor, index: { name: 'sup_on_work_product_indx' }
19
+ t.references :quality_controller, index: { name: 'qut_ctr_on_work_product_indx' }
20
+ t.datetime :start_date
21
+ t.datetime :completion_date
22
+
23
+ t.timestamps
24
+ end
25
+ add_index :ecom_model_work_products, %i[code project_id], unique: true
26
+ add_foreign_key :ecom_model_work_products, :ecom_model_tasks, column: :task_id
27
+ add_foreign_key :ecom_model_work_products, :ecom_model_work_product_templates,
28
+ column: :work_product_template_id
29
+ add_foreign_key :ecom_model_work_products, :ecom_model_projects, column: :project_id
30
+ add_foreign_key :ecom_model_work_products, :ecom_model_users, column: :performer_id
31
+ add_foreign_key :ecom_model_work_products, :ecom_model_users, column: :approver_id
32
+ add_foreign_key :ecom_model_work_products, :ecom_model_users, column: :supervisor_id
33
+ add_foreign_key :ecom_model_work_products, :ecom_model_users, column: :quality_controller_id
34
+ end
35
+ end
@@ -0,0 +1,30 @@
1
+ class CreateEcomModelWorkComponents < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :ecom_model_work_components do |t|
4
+ t.string :name, null: false
5
+ t.json :dimension
6
+ t.string :assignment_status, null: false, default: :unassigned
7
+ t.string :task_status, null: false, default: :new
8
+ t.integer :percent_completed, null: false, default: 0
9
+ t.string :remark
10
+ t.references :performer, index: { name: 'wc_on_performer_indx' }
11
+ t.references :approver, index: { name: 'wc_on_approver_indx' }
12
+ t.references :supervisor, index: { name: 'wc_on_supervisor_indx' }
13
+ t.references :quality_controller, index: { name: 'wc_on_qc_indx' }
14
+ t.date :start_date
15
+ t.date :completion_date
16
+ t.references :work_component_template, index: { name: 'wct_on_wc_indx' }
17
+ t.references :work_product, index: { name: 'wp_on_wc_indx' }
18
+
19
+ t.timestamps
20
+ end
21
+
22
+ add_foreign_key :ecom_model_work_components, :ecom_model_users, column: :performer_id
23
+ add_foreign_key :ecom_model_work_components, :ecom_model_users, column: :approver_id
24
+ add_foreign_key :ecom_model_work_components, :ecom_model_users, column: :supervisor_id
25
+ add_foreign_key :ecom_model_work_components, :ecom_model_users, column: :quality_controller_id
26
+ add_foreign_key :ecom_model_work_components, :ecom_model_work_component_templates,
27
+ column: :work_component_template_id
28
+ add_foreign_key :ecom_model_work_components, :ecom_model_work_products, column: :work_product_id
29
+ end
30
+ end
@@ -0,0 +1,17 @@
1
+ class CreateEcomModelCrews < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :ecom_model_crews do |t|
4
+ t.string :name, null: false
5
+ t.string :phone
6
+ t.string :email
7
+ t.string :qualification, null: false
8
+ t.string :employment, null: false
9
+ t.float :wage
10
+ t.references :crew_type, index: { name: 'crew_on_ct_indx' }
11
+
12
+ t.timestamps
13
+ end
14
+
15
+ add_foreign_key :ecom_model_crews, :ecom_model_resource_types, column: :crew_type_id
16
+ end
17
+ end
@@ -0,0 +1,15 @@
1
+ class CreateEcomModelCrewTimes < ActiveRecord::Migration[6.0]
2
+ def change
3
+ create_table :ecom_model_crew_times do |t|
4
+ t.datetime :checkin_time
5
+ t.datetime :checkout_time
6
+ t.references :crew, index: { name: 'ct_on_crew_indx' }
7
+ t.string :remark
8
+ t.boolean :overtime, null: false, default: false
9
+
10
+ t.timestamps
11
+ end
12
+
13
+ add_foreign_key :ecom_model_crew_times, :ecom_model_crews, column: :crew_id
14
+ end
15
+ end
@@ -0,0 +1,19 @@
1
+ module Ecom
2
+ module Model
3
+ class Engine < ::Rails::Engine
4
+ isolate_namespace Ecom::Model
5
+ config.generators.api_only = true
6
+
7
+ config.generators do |g|
8
+ g.test_framework :rspec
9
+ g.fixture_replacement :factory_bot
10
+ g.factory_bot dir: 'spec/factories'
11
+ end
12
+
13
+ initializer 'ecom_model.factories', after: 'factory_bot.set_factory_paths' do
14
+ FactoryBot.definition_file_paths << File.expand_path('../../spec/factories', __dir__) if defined?(FactoryBot)
15
+ end
16
+
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,5 @@
1
+ module Ecom
2
+ module Model
3
+ VERSION = '2.0.0'.freeze
4
+ end
5
+ end
data/lib/ecom/model.rb ADDED
@@ -0,0 +1,4 @@
1
+ module Ecom
2
+ module Model
3
+ end
4
+ end
data/lib/ecom_model.rb ADDED
@@ -0,0 +1,4 @@
1
+ require 'ecom/model'
2
+ require 'ecom/model/engine'
3
+ require 'ancestry'
4
+ require 'aasm'
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :ecom_model do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,6 @@
1
+ FactoryBot.define do
2
+ factory :application_module, class: 'Ecom::Model::ApplicationModule' do
3
+ code { FFaker::Name.name }
4
+ name { FFaker::Name.name }
5
+ end
6
+ end
@@ -0,0 +1,9 @@
1
+ FactoryBot.define do
2
+ factory :crew_time, class: 'Ecom::Model::CrewTime' do
3
+ checkin_time { Time.now }
4
+ checkout_time { Time.now + 2 * 60 * 60 }
5
+ association :crew
6
+ remark { FFaker::Name.name }
7
+ overtime { false }
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ FactoryBot.define do
2
+ factory :crew_type, class: 'Ecom::Model::CrewType', parent: :resource_type do
3
+ type { 'Ecom::Model::CrewType' }
4
+ end
5
+ end
@@ -0,0 +1,12 @@
1
+ FactoryBot.define do
2
+ factory :crew, class: 'Ecom::Model::Crew' do
3
+ name { FFaker::Name.name }
4
+ phone { FFaker::Name.name }
5
+ email { FFaker::Name.name }
6
+ qualification { FFaker::Name.name }
7
+ employment { Ecom::Model::Crew::PERMANENT }
8
+ wage { FFaker::Random.rand(1000..5000) }
9
+
10
+ association :crew_type
11
+ end
12
+ end
@@ -0,0 +1,6 @@
1
+ FactoryBot.define do
2
+ factory :currency, class: 'Ecom::Model::Currency' do
3
+ code { FFaker::Currency.code }
4
+ name { FFaker::Currency.name }
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ FactoryBot.define do
2
+ factory :equipment_type, class: 'Ecom::Model::EquipmentType', parent: :resource_type do
3
+ type { 'Ecom::Model::EquipmentType' }
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ FactoryBot.define do
2
+ factory :material_type, class: 'Ecom::Model::MaterialType', parent: :resource_type do
3
+ type { 'Ecom::Model::MaterialType' }
4
+ end
5
+ end
@@ -0,0 +1,9 @@
1
+ FactoryBot.define do
2
+ factory :menu, class: 'Ecom::Model::Menu' do
3
+ label { FFaker::Name.name }
4
+ icon { FFaker::Name.name }
5
+ route { FFaker::Name.name }
6
+ parent { nil }
7
+ association :application_module
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ FactoryBot.define do
2
+ factory :product_type, class: 'Ecom::Model::ProductType' do
3
+ name { FFaker::Name.name }
4
+ association :work_product_template
5
+ dimension { [{ name: 'length', label: 'length' }, { name: 'width', label: 'width' }] }
6
+ end
7
+ end
@@ -0,0 +1,23 @@
1
+ FactoryBot.define do
2
+ factory :project, class: 'Ecom::Model::Project' do
3
+ name { FFaker::Name.name }
4
+ description { FFaker::Name.name }
5
+ location { FFaker::Name.name }
6
+ objective { FFaker::Name.name }
7
+ project_scope { FFaker::Name.name }
8
+ association :employer, factory: :stakeholder
9
+ association :contractor, factory: :stakeholder
10
+ association :consultant, factory: :stakeholder
11
+ association :project_manager, factory: :stakeholder
12
+ association :task_template
13
+ contract_number { FFaker::Name.name }
14
+ date_contract_signed { 30.days.ago }
15
+ commencement_date { 1.day.ago }
16
+ completion_date { Time.now.next_month }
17
+ contract_amount { FFaker::Random.rand(1_000_000..9_999_999) }
18
+ advance_payment { FFaker::Random.rand(0..100) }
19
+ retention { FFaker::Random.rand(0..100) }
20
+ remark { FFaker::Name.name }
21
+ association :currency
22
+ end
23
+ end
@@ -0,0 +1,8 @@
1
+ FactoryBot.define do
2
+ factory :resource_type, class: 'Ecom::Model::ResourceType' do
3
+ code { FFaker::Name.name }
4
+ name { FFaker::Name.name }
5
+ base_unit { FFaker::Name.name }
6
+ type { 'Ecom::Model::CrewType' }
7
+ end
8
+ end
@@ -0,0 +1,5 @@
1
+ FactoryBot.define do
2
+ factory :stakeholder_type, class: 'Ecom::Model::StakeholderType' do
3
+ name { FFaker::Name.name }
4
+ end
5
+ end
@@ -0,0 +1,13 @@
1
+ FactoryBot.define do
2
+ factory :stakeholder, class: 'Ecom::Model::Stakeholder' do
3
+ name { FFaker::Name.unique.name }
4
+ type_of_business { FFaker::Name.name }
5
+ address { FFaker::Name.name }
6
+ license_no { FFaker::Name.name }
7
+ tin_no { FFaker::Name.name }
8
+ contact_name { FFaker::Name.name }
9
+ contact_phone { FFaker::Name.name }
10
+ contact_email { FFaker::Name.name }
11
+ association :stakeholder_type
12
+ end
13
+ end
@@ -0,0 +1,6 @@
1
+ FactoryBot.define do
2
+ factory :task_template_type, class: 'Ecom::Model::TaskTemplateType' do
3
+ code { FFaker::Name.unique.name }
4
+ name { FFaker::Name.unique.name }
5
+ end
6
+ end
@@ -0,0 +1,15 @@
1
+ FactoryBot.define do
2
+ factory :task_template, class: 'Ecom::Model::TaskTemplate' do
3
+ code { FFaker::Name.name }
4
+ name { FFaker::Name.name }
5
+ description { FFaker::Name.name }
6
+ association :task_template_type
7
+
8
+ factory :task_template_with_product_template do
9
+ after :create do |task_template, _|
10
+ create(:work_product_template, task_template: task_template)
11
+ end
12
+ end
13
+
14
+ end
15
+ end
@@ -0,0 +1,10 @@
1
+ FactoryBot.define do
2
+ factory :task, class: 'Ecom::Model::Task' do
3
+ code { FFaker::Name.name }
4
+ name { FFaker::Name.name }
5
+ description { FFaker::Name.name }
6
+ ancestry { FFaker::Name.name }
7
+ association :project
8
+ association :task_template
9
+ end
10
+ end
@@ -0,0 +1,6 @@
1
+ FactoryBot.define do
2
+ factory :user_role, class: 'Ecom::Model::UserRole' do
3
+ name { FFaker::Name.name }
4
+ association :application_module
5
+ end
6
+ end
@@ -0,0 +1,9 @@
1
+ FactoryBot.define do
2
+ factory :user, class: 'Ecom::Model::User' do
3
+ first_name { FFaker::Name.name }
4
+ last_name { FFaker::Name.name }
5
+ email { FFaker::Internet.email }
6
+ active { true }
7
+ password { FFaker::Internet.password }
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ FactoryBot.define do
2
+ factory :work_component_template, class: 'Ecom::Model::WorkComponentTemplate' do
3
+ code { FFaker::Name.name }
4
+ name { FFaker::Name.name }
5
+ description { FFaker::Name.name }
6
+ relative_percentage { FFaker::Random.rand(0..100) }
7
+ dimension { [{ label: 'Length', name: 'length' }, { label: 'Width', name: 'width' }] }
8
+ association :work_product_template
9
+ association :task_template
10
+ end
11
+ end
@@ -0,0 +1,18 @@
1
+ FactoryBot.define do
2
+ factory :work_component, class: 'Ecom::Model::WorkComponent' do
3
+ name { FFaker::Name.name }
4
+ dimension { [{ label: 'Length', name: 'length', value: 10 }] }
5
+ assignment_status { :unassigned }
6
+ task_status { :new }
7
+ percent_completed { FFaker::Random.rand(1..100) }
8
+ remark { FFaker::Name.name }
9
+ association :performer, factory: :user
10
+ association :approver, factory: :user
11
+ association :supervisor, factory: :user
12
+ association :quality_controller, factory: :user
13
+ start_date { 1.day.ago }
14
+ completion_date { Time.now.next_week }
15
+ association :work_component_template
16
+ association :work_product
17
+ end
18
+ end
@@ -0,0 +1,9 @@
1
+ FactoryBot.define do
2
+ factory :work_product_template, class: 'Ecom::Model::WorkProductTemplate' do
3
+ code { FFaker::Name.unique.name }
4
+ name { FFaker::Name.unique.name }
5
+ description { FFaker::Name.name }
6
+ remark { FFaker::Name.name }
7
+ association :task_template
8
+ end
9
+ end
@@ -0,0 +1,22 @@
1
+ FactoryBot.define do
2
+ factory :work_product, class: 'Ecom::Model::WorkProduct' do
3
+ code { FFaker::Name.unique.name }
4
+ name { FFaker::Name.name }
5
+ description { FFaker::Name.name }
6
+ design_reference_no { FFaker::Name.name }
7
+ dimension { [{ label: 'Length', name: 'length', value: 12 }] }
8
+ association :task
9
+ association :work_product_template
10
+ association :project
11
+ assignment_status { :unassigned }
12
+ task_status { :new }
13
+ percent_completed { FFaker::Random.rand(1..100) }
14
+ remark { FFaker::Name.name }
15
+ association :performer, factory: :user
16
+ association :approver, factory: :user
17
+ association :supervisor, factory: :user
18
+ association :quality_controller, factory: :user
19
+ start_date { 1.day.ago }
20
+ completion_date { Time.now.next_week }
21
+ end
22
+ end