ecom_core 1.3.7 → 1.3.12
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.
- checksums.yaml +4 -4
- data/app/controllers/ecom/core/users_controller.rb +5 -0
- data/app/models/ecom/core/crew.rb +1 -1
- data/app/models/ecom/core/maintenance_service_order.rb +3 -0
- data/app/models/ecom/core/maintenance_status.rb +5 -0
- data/app/models/ecom/core/site_crew.rb +10 -2
- data/app/models/ecom/core/task_attachment.rb +1 -2
- data/app/models/ecom/core/work_order.rb +1 -0
- data/app/models/ecom/core/work_package.rb +1 -0
- data/app/serializers/ecom/core/user_lookup_serializer.rb +11 -0
- data/config/routes.rb +1 -0
- data/db/migrate/20191207103731_create_ecom_core_work_orders.rb +4 -0
- data/db/migrate/20210417095657_rename_photo_fields.rb +6 -0
- data/db/migrate/20210417120215_create_active_storage_tables.active_storage.rb +36 -0
- data/lib/ecom/core/version.rb +1 -1
- data/lib/ecom_core.rb +0 -2
- data/spec/factories/ecom/core/crews.rb +1 -1
- data/spec/factories/ecom/core/work_orders.rb +1 -0
- metadata +12 -54
- data/app/uploaders/ecom/core/photo_uploader.rb +0 -30
- data/app/uploaders/ecom/core/task_attachment_uploader.rb +0 -11
- data/config/initializers/carrierwave.rb +0 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b5251e2d89a8210a191854b487363709e503d187c20134cf3555db18cddf8b2c
|
|
4
|
+
data.tar.gz: 741d7ced3999e07483ca9e8c8e611158ffde648f29978b6b67b45c6ca702740a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5c459d2c9ed785a9e37554f5c521af55e2a7d4695da9f8992e851929e495baad031a6f903d183370a76a64c120024a7e9a5db34c54d3714a5ac943af087b202e
|
|
7
|
+
data.tar.gz: '009335d749873a86b77170ca7c263a70c41823675ff72b083c4d896eb5e8a294bd879e4b7699e4afe4102d01dce4d8be2ad876728dc299ea8df605ba9c7edfe8'
|
|
@@ -7,6 +7,11 @@ module Ecom
|
|
|
7
7
|
render json: User.all
|
|
8
8
|
end
|
|
9
9
|
|
|
10
|
+
def lookup
|
|
11
|
+
data = ActiveModelSerializers::SerializableResource.new(User.all, each_serializer: UserLookupSerializer)
|
|
12
|
+
render json: { success: true, data: data }
|
|
13
|
+
end
|
|
14
|
+
|
|
10
15
|
def active
|
|
11
16
|
render json: User.active
|
|
12
17
|
end
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
module Ecom
|
|
2
2
|
module Core
|
|
3
3
|
class Crew < ApplicationRecord
|
|
4
|
-
mount_base64_uploader :photo, PhotoUploader
|
|
5
4
|
PERMANENT = 'Permanent'.freeze
|
|
6
5
|
SUPERVISOR = 'Supervisor'.freeze
|
|
7
6
|
TEMPORARY = 'Temporary'.freeze
|
|
@@ -13,6 +12,7 @@ module Ecom
|
|
|
13
12
|
after_save :set_employee_id
|
|
14
13
|
|
|
15
14
|
belongs_to :crew_type
|
|
15
|
+
has_one_attached :photo
|
|
16
16
|
|
|
17
17
|
validates :name, :address, :qualification, :employment, :wage, :guarantor_name, :guarantor_phone, presence: true
|
|
18
18
|
validates :employment, inclusion: EMPLOYMENT_TYPES
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
module Ecom
|
|
2
2
|
module Core
|
|
3
3
|
class MaintenanceStatus < Lookup
|
|
4
|
+
EQUIPMENT_NOT_RECEIVED = 'Equipment not received'.freeze
|
|
5
|
+
RECEIVED_EQUIPMENT = 'Received equipment'.freeze
|
|
6
|
+
IN_PROGRESS = 'In progress'.freeze
|
|
7
|
+
WAITING_FOR_PARTS = 'Waiting for parts'.freeze
|
|
8
|
+
MAINTENANCE_COMPLETED = 'Maintenance completed'.freeze
|
|
4
9
|
end
|
|
5
10
|
end
|
|
6
11
|
end
|
|
@@ -13,8 +13,8 @@ module Ecom
|
|
|
13
13
|
validates :crew_id, :crew, :site_id, :site, :start_date, :site_crew_type, :status, presence: true
|
|
14
14
|
|
|
15
15
|
validates_uniqueness_of :site_id,
|
|
16
|
-
scope:
|
|
17
|
-
if:
|
|
16
|
+
scope: %i[crew_id status],
|
|
17
|
+
if: :active_site_crew_exists?,
|
|
18
18
|
message: 'There can only be one record with status `Active` for a given site and crew'
|
|
19
19
|
|
|
20
20
|
validates :site_crew_type, inclusion: SITE_CREW_TYPES
|
|
@@ -22,6 +22,14 @@ module Ecom
|
|
|
22
22
|
|
|
23
23
|
belongs_to :crew
|
|
24
24
|
belongs_to :site
|
|
25
|
+
|
|
26
|
+
def active_site_crew_exists?
|
|
27
|
+
active_site_crew = Ecom::Core::SiteCrew.where(site_id: site_id, crew_id: crew_id, status: ACTIVE)
|
|
28
|
+
|
|
29
|
+
return true if !active_site_crew.count.zero? && status == ACTIVE
|
|
30
|
+
|
|
31
|
+
false
|
|
32
|
+
end
|
|
25
33
|
end
|
|
26
34
|
end
|
|
27
35
|
end
|
data/config/routes.rb
CHANGED
|
@@ -6,6 +6,7 @@ Ecom::Core::Engine.routes.draw do
|
|
|
6
6
|
resources :menus, only: %i[index]
|
|
7
7
|
resources :users, only: %i[index create update]
|
|
8
8
|
get '/users/active', controller: :users, action: :active
|
|
9
|
+
get '/users/lookup', controller: :users, action: :lookup
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
resources :crew_types
|
|
@@ -3,6 +3,10 @@ class CreateEcomCoreWorkOrders < ActiveRecord::Migration[6.0]
|
|
|
3
3
|
create_table :ecom_core_work_orders do |t|
|
|
4
4
|
t.string :name
|
|
5
5
|
t.string :reference_number
|
|
6
|
+
t.references :work_package,
|
|
7
|
+
null: false,
|
|
8
|
+
index: { name: 'wo_on_wp_indx' },
|
|
9
|
+
foreign_key: { to_table: :ecom_core_work_packages }
|
|
6
10
|
t.references :assigned_to,
|
|
7
11
|
null: false,
|
|
8
12
|
index: { name: 'wo_on_at_indx' },
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# This migration comes from active_storage (originally 20170806125915)
|
|
2
|
+
class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
|
|
3
|
+
def change
|
|
4
|
+
create_table :active_storage_blobs do |t|
|
|
5
|
+
t.string :key, null: false
|
|
6
|
+
t.string :filename, null: false
|
|
7
|
+
t.string :content_type
|
|
8
|
+
t.text :metadata
|
|
9
|
+
t.string :service_name, null: false
|
|
10
|
+
t.bigint :byte_size, null: false
|
|
11
|
+
t.string :checksum, null: false
|
|
12
|
+
t.datetime :created_at, null: false
|
|
13
|
+
|
|
14
|
+
t.index [ :key ], unique: true
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
create_table :active_storage_attachments do |t|
|
|
18
|
+
t.string :name, null: false
|
|
19
|
+
t.references :record, null: false, polymorphic: true, index: false
|
|
20
|
+
t.references :blob, null: false
|
|
21
|
+
|
|
22
|
+
t.datetime :created_at, null: false
|
|
23
|
+
|
|
24
|
+
t.index [ :record_type, :record_id, :name, :blob_id ], name: "index_active_storage_attachments_uniqueness", unique: true
|
|
25
|
+
t.foreign_key :active_storage_blobs, column: :blob_id
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
create_table :active_storage_variant_records do |t|
|
|
29
|
+
t.belongs_to :blob, null: false, index: false
|
|
30
|
+
t.string :variation_digest, null: false
|
|
31
|
+
|
|
32
|
+
t.index %i[ blob_id variation_digest ], name: "index_active_storage_variant_records_uniqueness", unique: true
|
|
33
|
+
t.foreign_key :active_storage_blobs, column: :blob_id
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
data/lib/ecom/core/version.rb
CHANGED
data/lib/ecom_core.rb
CHANGED
|
@@ -10,7 +10,7 @@ FactoryBot.define do
|
|
|
10
10
|
wage_in_words { FFaker::Name.name }
|
|
11
11
|
employment_date { Date.today - 1 }
|
|
12
12
|
sub_contracted { false }
|
|
13
|
-
|
|
13
|
+
photo_url { FFaker::Name.name }
|
|
14
14
|
guarantor_name { FFaker::Name.name }
|
|
15
15
|
guarantor_phone { FFaker::Name.name }
|
|
16
16
|
active { true }
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ecom_core
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.3.
|
|
4
|
+
version: 1.3.12
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Henock L.
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-
|
|
11
|
+
date: 2021-04-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: aasm
|
|
@@ -87,21 +87,7 @@ dependencies:
|
|
|
87
87
|
- !ruby/object:Gem::Version
|
|
88
88
|
version: '0'
|
|
89
89
|
- !ruby/object:Gem::Dependency
|
|
90
|
-
name:
|
|
91
|
-
requirement: !ruby/object:Gem::Requirement
|
|
92
|
-
requirements:
|
|
93
|
-
- - ">="
|
|
94
|
-
- !ruby/object:Gem::Version
|
|
95
|
-
version: '0'
|
|
96
|
-
type: :runtime
|
|
97
|
-
prerelease: false
|
|
98
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
99
|
-
requirements:
|
|
100
|
-
- - ">="
|
|
101
|
-
- !ruby/object:Gem::Version
|
|
102
|
-
version: '0'
|
|
103
|
-
- !ruby/object:Gem::Dependency
|
|
104
|
-
name: carrierwave-base64
|
|
90
|
+
name: json-schema
|
|
105
91
|
requirement: !ruby/object:Gem::Requirement
|
|
106
92
|
requirements:
|
|
107
93
|
- - ">="
|
|
@@ -134,42 +120,14 @@ dependencies:
|
|
|
134
120
|
requirements:
|
|
135
121
|
- - "~>"
|
|
136
122
|
- !ruby/object:Gem::Version
|
|
137
|
-
version: 6.
|
|
138
|
-
type: :runtime
|
|
139
|
-
prerelease: false
|
|
140
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
141
|
-
requirements:
|
|
142
|
-
- - "~>"
|
|
143
|
-
- !ruby/object:Gem::Version
|
|
144
|
-
version: 6.0.3
|
|
145
|
-
- !ruby/object:Gem::Dependency
|
|
146
|
-
name: json-schema
|
|
147
|
-
requirement: !ruby/object:Gem::Requirement
|
|
148
|
-
requirements:
|
|
149
|
-
- - ">="
|
|
150
|
-
- !ruby/object:Gem::Version
|
|
151
|
-
version: '0'
|
|
152
|
-
type: :runtime
|
|
153
|
-
prerelease: false
|
|
154
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
155
|
-
requirements:
|
|
156
|
-
- - ">="
|
|
157
|
-
- !ruby/object:Gem::Version
|
|
158
|
-
version: '0'
|
|
159
|
-
- !ruby/object:Gem::Dependency
|
|
160
|
-
name: fog-google
|
|
161
|
-
requirement: !ruby/object:Gem::Requirement
|
|
162
|
-
requirements:
|
|
163
|
-
- - "~>"
|
|
164
|
-
- !ruby/object:Gem::Version
|
|
165
|
-
version: 1.12.0
|
|
123
|
+
version: 6.1.3
|
|
166
124
|
type: :runtime
|
|
167
125
|
prerelease: false
|
|
168
126
|
version_requirements: !ruby/object:Gem::Requirement
|
|
169
127
|
requirements:
|
|
170
128
|
- - "~>"
|
|
171
129
|
- !ruby/object:Gem::Version
|
|
172
|
-
version: 1.
|
|
130
|
+
version: 6.1.3
|
|
173
131
|
- !ruby/object:Gem::Dependency
|
|
174
132
|
name: factory_bot_rails
|
|
175
133
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -372,6 +330,7 @@ files:
|
|
|
372
330
|
- app/serializers/ecom/core/lookup_serializer.rb
|
|
373
331
|
- app/serializers/ecom/core/resource_type_serializer.rb
|
|
374
332
|
- app/serializers/ecom/core/unit_cost_serializer.rb
|
|
333
|
+
- app/serializers/ecom/core/user_lookup_serializer.rb
|
|
375
334
|
- app/serializers/ecom/core/user_role_serializer.rb
|
|
376
335
|
- app/serializers/ecom/core/user_serializer.rb
|
|
377
336
|
- app/services/ecom/core/crew_contract_transaction_service.rb
|
|
@@ -379,11 +338,8 @@ files:
|
|
|
379
338
|
- app/services/ecom/core/menu_service.rb
|
|
380
339
|
- app/services/ecom/core/site_crew_service.rb
|
|
381
340
|
- app/services/ecom/core/token_auth_service.rb
|
|
382
|
-
- app/uploaders/ecom/core/photo_uploader.rb
|
|
383
|
-
- app/uploaders/ecom/core/task_attachment_uploader.rb
|
|
384
341
|
- app/validators/ecom/core/date_range_validator.rb
|
|
385
342
|
- config/database.ci.yml
|
|
386
|
-
- config/initializers/carrierwave.rb
|
|
387
343
|
- config/routes.rb
|
|
388
344
|
- db/migrate/20190101085530_create_ecom_core_companies.rb
|
|
389
345
|
- db/migrate/20190101112620_create_ecom_core_lookups.rb
|
|
@@ -462,6 +418,8 @@ files:
|
|
|
462
418
|
- db/migrate/20201125191158_create_ecom_core_work_item_resource_requirement_templates.rb
|
|
463
419
|
- db/migrate/20201126191334_create_ecom_core_resource_requisitions.rb
|
|
464
420
|
- db/migrate/20201126191349_create_ecom_core_resource_requisition_items.rb
|
|
421
|
+
- db/migrate/20210417095657_rename_photo_fields.rb
|
|
422
|
+
- db/migrate/20210417120215_create_active_storage_tables.active_storage.rb
|
|
465
423
|
- lib/ecom/core.rb
|
|
466
424
|
- lib/ecom/core/engine.rb
|
|
467
425
|
- lib/ecom/core/version.rb
|
|
@@ -557,7 +515,7 @@ homepage: http://www.mks.com.et
|
|
|
557
515
|
licenses:
|
|
558
516
|
- MIT
|
|
559
517
|
metadata: {}
|
|
560
|
-
post_install_message:
|
|
518
|
+
post_install_message:
|
|
561
519
|
rdoc_options: []
|
|
562
520
|
require_paths:
|
|
563
521
|
- lib
|
|
@@ -572,8 +530,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
572
530
|
- !ruby/object:Gem::Version
|
|
573
531
|
version: '0'
|
|
574
532
|
requirements: []
|
|
575
|
-
rubygems_version: 3.
|
|
576
|
-
signing_key:
|
|
533
|
+
rubygems_version: 3.2.15
|
|
534
|
+
signing_key:
|
|
577
535
|
specification_version: 4
|
|
578
536
|
summary: Core engine for construction management application.
|
|
579
537
|
test_files: []
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
module Ecom
|
|
2
|
-
module Core
|
|
3
|
-
class PhotoUploader < CarrierWave::Uploader::Base
|
|
4
|
-
if Rails.env.production?
|
|
5
|
-
storage :fog
|
|
6
|
-
else
|
|
7
|
-
storage :file
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def store_dir
|
|
11
|
-
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def extension_whitelist
|
|
15
|
-
%w[jpg jpeg gif png]
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def filename
|
|
19
|
-
"#{secure_token}.#{file.extension}" if original_filename.present?
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
protected
|
|
23
|
-
|
|
24
|
-
def secure_token
|
|
25
|
-
var = :"@#{mounted_as}_secure_token"
|
|
26
|
-
model.instance_variable_get(var) || model.instance_variable_set(var, SecureRandom.uuid)
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
CarrierWave.configure do |config|
|
|
2
|
-
config.fog_credentials = {
|
|
3
|
-
provider: 'Google',
|
|
4
|
-
google_storage_access_key_id: ENV["GOOGLE_STORAGE_ACCESS_KEY"],
|
|
5
|
-
google_storage_secret_access_key: ENV["GOOGLE_STORAGE_SECRETE_KEY"]
|
|
6
|
-
}
|
|
7
|
-
config.fog_directory = ENV["GOOGLE_STORAGE_BUCKET_NAME"]
|
|
8
|
-
end
|