cats_core 1.1.29 → 1.1.33

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bb380491b61a7969316bce920572048d8654e059ea310880d6c7919ec3797dd9
4
- data.tar.gz: 8650f299e8e221842a6c1c88b1e603e0b78acf709c8731b61743e82454d64e49
3
+ metadata.gz: cc7dd4f19838153db58356a4d33eb5f0fcff634279643a00e221084b170bd840
4
+ data.tar.gz: b423a14678d56634fb1b2d1f10ee7c9df20ef0129de0ac245b956a6943cf8029
5
5
  SHA512:
6
- metadata.gz: 1700fa7100a312a136579defe9782a1c4a919c488cb44c25d899f1cfc72ce6ac94a50e677aa521c2b600fa672b44fe89213db5e947fefe77c24861686f75db3b
7
- data.tar.gz: '08df5a63ebfa01ad0f2c47094b81d9fa0e2546b37ab5704e8882c09aa6ac949cee80682cf50a3dac84e52dd149ea9a0fb10f0e1b3d346968f8f5641bb16abb48'
6
+ metadata.gz: 1ebaeba514c4ebba0f6f3288efbadd58546cf94e5f5b1028808a037767c8b36df516b357ea404e1d7046fb26729334eed0d90c11b31fe267cff1f05ccf20b98e
7
+ data.tar.gz: 89514042663c0b651b09da15c7897e4c7f87b4a8df2648661181c692ea9b99b3c6575f4e592a595fe364e419ccc1175a1d08412a55d8d9a55231cbfe6de50943
@@ -20,7 +20,7 @@ module Cats
20
20
  jwt = Cats::Core::TokenAuthService.issue(payload)
21
21
  render json: { token: jwt, user: payload }
22
22
  else
23
- rener json: { error: 'Invalid username or password.' }, status: 400
23
+ render json: { error: 'Invalid username or password.' }, status: 400
24
24
  end
25
25
  else
26
26
  render json: { error: 'User does not exist.' }, status: 400
@@ -20,7 +20,7 @@ module Cats
20
20
  validates :commodity_status, inclusion: { in: Cats::Core::Commodity::COMMODITY_STATUSES }
21
21
  validates :stack_status, inclusion: { in: STACK_STATUSES }
22
22
  validate :validate_coordinates, :validate_dimensions, :validate_distance_from_wall, :validate_overlap,
23
- :validate_space_between_stack
23
+ :validate_space_between_stack, unless: -> { store && store.code == 'SUP-STORE' }
24
24
 
25
25
  after_save :update_store_space
26
26
 
@@ -0,0 +1,29 @@
1
+ # To deliver this notification:
2
+ #
3
+ # AllocationNotification.with(post: @post).deliver_later(current_user)
4
+ # AllocationNotification.with(post: @post).deliver(current_user)
5
+
6
+ module Cats
7
+ module Core
8
+ class AllocationNotification < Noticed::Base
9
+ deliver_by :database
10
+
11
+ param :allocation_item
12
+
13
+ def message
14
+ allocation_item = params[:allocation_item]
15
+ commodity = allocation_item.allocation.commodity.name
16
+ title = "Allocation Notification - #{commodity}"
17
+ date = Date.today
18
+ body = <<~BODY
19
+ Commodity with the following specification has been allocated to you:
20
+ Batch No. = #{allocation_item.allocation.commodity.batch_no}
21
+ Commodity = #{commodity}
22
+ Quantity = #{allocation_item.quantity}
23
+ The commodity is expected to be delivered from #{allocation_item.from} to #{allocation_item.to}
24
+ BODY
25
+ { title: title, date: date, body: body }
26
+ end
27
+ end
28
+ end
29
+ end
@@ -7,13 +7,14 @@ module Cats
7
7
 
8
8
  def message
9
9
  dispatch = params[:dispatch]
10
- title = 'Dispatch Notification'
10
+ commodity = dispatch.allocation_item.allocation.commodity.name
11
+ title = "Dispatch Notification - #{commodity}"
11
12
  date = Date.today
12
13
  body = <<~BODY
13
14
  Commodity with the following details has been dispatched to you:
14
15
  Dispatch Ref. = #{dispatch.reference_no}
15
16
  Batch No. = #{dispatch.allocation_item.allocation.commodity.batch_no}
16
- Commodity = #{dispatch.allocation_item.allocation.commodity.name}
17
+ Commodity = #{commodity}
17
18
  Allocated Quantity = #{dispatch.allocation_item.quantity}
18
19
  Quantity = #{dispatch.quantity}
19
20
  Truck Plate No. = #{dispatch.plate_no}
@@ -1,8 +1,8 @@
1
1
  module Cats
2
2
  module Core
3
3
  class DispatchTransactionSerializer < ActiveModel::Serializer
4
- attributes :id, :source_id, :source_code, :destination_id, :destination_reference_no, :quantity, :transaction_date,
5
- :status
4
+ attributes :id, :source_id, :source_code, :destination_id, :destination_reference_no, :quantity,
5
+ :transaction_date, :status
6
6
  end
7
7
  end
8
8
  end
@@ -1,5 +1,5 @@
1
1
  module Cats
2
2
  module Core
3
- VERSION = '1.1.29'.freeze
3
+ VERSION = '1.1.33'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cats_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.29
4
+ version: 1.1.33
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-10 00:00:00.000000000 Z
11
+ date: 2021-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_model_serializers
@@ -286,6 +286,7 @@ files:
286
286
  - app/models/cats/core/transporter.rb
287
287
  - app/models/cats/core/unit_of_measure.rb
288
288
  - app/models/cats/core/user.rb
289
+ - app/notifications/cats/core/allocation_notification.rb
289
290
  - app/notifications/cats/core/dispatch_notification.rb
290
291
  - app/notifications/cats/core/simple_notification.rb
291
292
  - app/serializers/cats/core/commodity_category_serializer.rb