cats_core 1.4.40 → 1.4.43

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 (53) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/cats/core/cash_donations_controller.rb +19 -0
  3. data/app/controllers/cats/core/commodity_donations_controller.rb +22 -0
  4. data/app/controllers/cats/core/dispatch_plans_controller.rb +24 -0
  5. data/app/controllers/cats/core/loans_controller.rb +20 -0
  6. data/app/controllers/cats/core/purchase_orders_controller.rb +24 -0
  7. data/app/controllers/cats/core/round_beneficiaries_controller.rb +49 -0
  8. data/app/controllers/cats/core/swaps_controller.rb +21 -0
  9. data/app/models/cats/core/beneficiary.rb +9 -0
  10. data/app/models/cats/core/cash_donation.rb +11 -0
  11. data/app/models/cats/core/commodity_donation.rb +15 -0
  12. data/app/models/cats/core/dispatch_plan.rb +1 -1
  13. data/app/models/cats/core/donation.rb +2 -16
  14. data/app/models/cats/core/gift_certificate.rb +3 -23
  15. data/app/models/cats/core/loan.rb +15 -0
  16. data/app/models/cats/core/plan.rb +4 -0
  17. data/app/models/cats/core/project.rb +1 -0
  18. data/app/models/cats/core/purchase_order.rb +5 -13
  19. data/app/models/cats/core/rhn_request.rb +4 -4
  20. data/app/models/cats/core/round_beneficiary.rb +16 -0
  21. data/app/models/cats/core/round_plan.rb +2 -4
  22. data/app/models/cats/core/round_plan_item.rb +1 -0
  23. data/app/models/cats/core/swap.rb +19 -0
  24. data/app/models/concerns/cats/core/dispatchable.rb +8 -0
  25. data/app/serializers/cats/core/cash_donation_serializer.rb +8 -0
  26. data/app/serializers/cats/core/commodity_donation_serializer.rb +9 -0
  27. data/app/serializers/cats/core/loan_serializer.rb +8 -0
  28. data/app/serializers/cats/core/purchase_order_serializer.rb +9 -0
  29. data/app/serializers/cats/core/round_beneficiary_serializer.rb +8 -0
  30. data/app/serializers/cats/core/swap_serializer.rb +9 -0
  31. data/app/services/cats/core/beneficiary_service.rb +87 -0
  32. data/app/services/cats/core/dispatch_plan_service.rb +79 -0
  33. data/config/routes.rb +19 -0
  34. data/db/migrate/20210717032330_create_cats_core_commodity_donations.rb +29 -0
  35. data/db/migrate/20210717032408_create_cats_core_cash_donations.rb +20 -0
  36. data/db/migrate/20210717032602_create_cats_core_gift_certificates.rb +2 -8
  37. data/db/migrate/20210717032855_create_cats_core_purchase_orders.rb +9 -5
  38. data/db/migrate/20220511082354_create_cats_core_beneficiaries.rb +4 -0
  39. data/db/migrate/20220626063501_create_cats_core_loans.rb +21 -0
  40. data/db/migrate/20220626063757_create_cats_core_swaps.rb +29 -0
  41. data/db/migrate/20220626132050_create_cats_core_round_beneficiaries.rb +26 -0
  42. data/lib/cats/core/version.rb +1 -1
  43. data/spec/factories/cats/core/beneficiaries.rb +1 -0
  44. data/spec/factories/cats/core/cash_donations.rb +10 -0
  45. data/spec/factories/cats/core/{donations.rb → commodity_donations.rb} +3 -6
  46. data/spec/factories/cats/core/gift_certificates.rb +5 -6
  47. data/spec/factories/cats/core/loans.rb +11 -0
  48. data/spec/factories/cats/core/projects.rb +1 -1
  49. data/spec/factories/cats/core/purchase_orders.rb +3 -1
  50. data/spec/factories/cats/core/round_beneficiaries.rb +10 -0
  51. data/spec/factories/cats/core/swaps.rb +13 -0
  52. metadata +33 -7
  53. data/db/migrate/20210717032330_create_cats_core_donations.rb +0 -35
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f351b09b0928289a2d7a7eba97b0784bb459bec5e830a81648e1a6248d187cfb
4
- data.tar.gz: 968878625a82ba3e0dca6b11264be31955c7e237c255684150d47f71d2b59ad6
3
+ metadata.gz: c6e5cfab401c5346af868d378d9a068b2cef5a154e803d5fd940f2d9bebdd8ff
4
+ data.tar.gz: de1ea59da4f3e9a283685e84813e2285202d707d9d5bac98d26abc4d87820ac5
5
5
  SHA512:
6
- metadata.gz: 6d2f3cff48d29e0c9e2fb370be54d735b2ac0e9e2c6d549b43bfb0c181efb17bf7dc20d2a3420240e258fbd6508e7e5347e91ee59fb2cdca8d93dbed95df6edc
7
- data.tar.gz: d1d76375ad48d4bba448318854cca83b14ad7955e3c19ca142bfa56dd9231449e042681037daae808327b1a30518514b22bbe2653abbf8d87ccf45406bb8b0dd
6
+ metadata.gz: 1d1ad46c73a7f35f1916fd9328dbef03cfeb3b6736566eac0c44ef2372bcea6dc6b804e313396c8ed7abe05a17ff2ae2f865a6b091337cbbab0e53f075938ac1
7
+ data.tar.gz: f9f9633161e3578d49ea763e6254cd18706ce7fb0abaf3673d8321e21399a16f4cc3aac607106117901eee84a15fd44e95ed8faffa56454786d51575d926f5c3
@@ -0,0 +1,19 @@
1
+ module Cats
2
+ module Core
3
+ class CashDonationsController < ApplicationController
4
+ include Common
5
+
6
+ def index
7
+ super do
8
+ CashDonation.includes(:donor, :currency).all
9
+ end
10
+ end
11
+
12
+ private
13
+
14
+ def model_params
15
+ params.require(:payload).permit(:reference_no, :description, :donated_on, :donor_id, :amount, :currency_id)
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,22 @@
1
+ module Cats
2
+ module Core
3
+ class CommodityDonationsController < ApplicationController
4
+ include Common
5
+
6
+ def index
7
+ super do
8
+ CommodityDonation.includes(:donor, :plan, :unit, :commodity_category).all
9
+ end
10
+ end
11
+
12
+ private
13
+
14
+ def model_params
15
+ params.require(:payload).permit(
16
+ :reference_no, :description, :shipping_reference, :donated_on, :donor_id, :plan_id, :quantity,
17
+ :commodity_category_id, :unit_id
18
+ )
19
+ end
20
+ end
21
+ end
22
+ end
@@ -27,6 +27,18 @@ module Cats
27
27
  render json: { success: false, error: e.message }, status: :unprocessable_entity
28
28
  end
29
29
 
30
+ def generate
31
+ service = DispatchPlanService.new
32
+ items = service.generate(params[:id])
33
+ render json: { success: true, data: serialize(items) }
34
+ end
35
+
36
+ def bulk_create
37
+ service = DispatchPlanService.new
38
+ plan = service.bulk_create(bulk_create_params, current_user)
39
+ render json: { success: true, data: serialize(plan) }
40
+ end
41
+
30
42
  def approve
31
43
  service = DispatchPlanService.new
32
44
  plan = DispatchPlan.find(params[:id])
@@ -41,6 +53,18 @@ module Cats
41
53
  def model_params
42
54
  params.require(:payload).permit(:reference_no, :dispatchable_id, :dispatchable_type)
43
55
  end
56
+
57
+ def bulk_create_params
58
+ params.require(:payload).permit(
59
+ :reference_no,
60
+ :dispatchable_id,
61
+ :dispatchable_type,
62
+ items: %i[
63
+ reference_no region zone woreda fdp commodity_category unit_id unit quantity source_id destination_id
64
+ commodity_id
65
+ ]
66
+ )
67
+ end
44
68
  end
45
69
  end
46
70
  end
@@ -0,0 +1,20 @@
1
+ module Cats
2
+ module Core
3
+ class LoansController < ApplicationController
4
+ include Common
5
+
6
+ def index
7
+ super do
8
+ Loan.includes(:commodity_category, :unit).all
9
+ end
10
+ end
11
+
12
+ private
13
+
14
+ def model_params
15
+ params.require(:payload).permit(:reference_no, :lender, :agreement_date, :repayment_date, :quantity, :unit_id,
16
+ :commodity_category_id)
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,24 @@
1
+ module Cats
2
+ module Core
3
+ class PurchaseOrdersController < ApplicationController
4
+ include Common
5
+
6
+ def index
7
+ purchase_orders = Cats::Core::PurchaseOrder.where(cash_donation_id: params[:id]).includes(
8
+ :commodity_category,
9
+ :unit,
10
+ :currency
11
+ )
12
+ render json: { success: true, data: serialize(purchase_orders) }
13
+ end
14
+
15
+ private
16
+
17
+ def model_params
18
+ params.require(:payload).permit(:reference_no, :order_date, :requisition_no, :supplier, :cash_donation_id,
19
+ :commodity_category_id, :quantity, :purchase_type, :unit_id, :price,
20
+ :currency_id)
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,49 @@
1
+ module Cats
2
+ module Core
3
+ class RoundBeneficiariesController < ApplicationController
4
+ include Common
5
+
6
+ def index
7
+ beneficiaries = RoundBeneficiary.joins(:round_plan_item)
8
+ .where(round_plan_item: { round_plan_id: params[:id] })
9
+ .includes(:beneficiary, :commodity_category, :unit)
10
+ render json: { success: true, data: serialize(beneficiaries) }
11
+ end
12
+
13
+ def generate
14
+ service = BeneficiaryService.new
15
+ result = service.generate_distribution_list(params[:id])
16
+ render json: { success: result }
17
+ rescue StandardError => e
18
+ render json: { success: false, error: e.message }
19
+ end
20
+
21
+ def filter
22
+ query = RoundBeneficiary.includes(:beneficiary, :commodity_category, :unit).ransack(params[:q])
23
+ render json: { success: true, data: serialize(query.result) }
24
+ end
25
+
26
+ def remove_beneficiaries
27
+ service = BeneficiaryService.new
28
+ result = service.remove_items(params[:id], common_params[:ids])
29
+ render json: { success: result }
30
+ rescue StandardError => e
31
+ render json: { success: false, error: e.message }
32
+ end
33
+
34
+ def confirm_receipt
35
+ service = BeneficiaryService.new
36
+ result = service.confirm_receipt(params[:id], common_params[:ids])
37
+ render json: { success: result }
38
+ rescue StandardError => e
39
+ render json: { success: false, error: e.message }
40
+ end
41
+
42
+ private
43
+
44
+ def common_params
45
+ params.permit(ids: [])
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,21 @@
1
+ module Cats
2
+ module Core
3
+ class SwapsController < ApplicationController
4
+ include Common
5
+
6
+ def index
7
+ super do
8
+ Swap.includes(:issued_commodity, :issued_unit, :received_commodity, :received_unit).all
9
+ end
10
+ end
11
+
12
+ private
13
+
14
+ def model_params
15
+ params.require(:payload).permit(:reference_no, :swapper, :agreement_date, :issued_commodity_id,
16
+ :issued_quantity, :received_commodity_id, :received_quantity,
17
+ :issued_unit_id, :received_unit_id)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -6,12 +6,21 @@ module Cats
6
6
  GENDERS = [MALE, FEMALE].freeze
7
7
 
8
8
  belongs_to :beneficiary_category
9
+ belongs_to :fdp, class_name: 'Location'
9
10
 
10
11
  validates :full_name, :age, :gender, presence: true
11
12
  validates :gender, inclusion: { in: GENDERS }
12
13
  validates :age, numericality: { greater_than: 0, less_than: 100 }
14
+ validate :validate_fdp
13
15
 
14
16
  delegate(:name, to: :beneficiary_category, prefix: true)
17
+ delegate(:name, to: :fdp, prefix: true)
18
+
19
+ def validate_fdp
20
+ return unless fdp
21
+
22
+ errors.add(:fdp, 'should be a valid distribution point.') unless fdp.location_type == Location::FDP
23
+ end
15
24
  end
16
25
  end
17
26
  end
@@ -0,0 +1,11 @@
1
+ module Cats
2
+ module Core
3
+ class CashDonation < Donation
4
+ belongs_to :currency
5
+
6
+ validates :amount, presence: true, numericality: { greater_than: 0 }
7
+
8
+ delegate(:code, to: :currency, prefix: true)
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,15 @@
1
+ module Cats
2
+ module Core
3
+ class CommodityDonation < Donation
4
+ belongs_to :plan, optional: true
5
+ belongs_to :commodity_category
6
+ belongs_to :unit, class_name: 'UnitOfMeasure'
7
+
8
+ validates :quantity, presence: true, numericality: { greater_than: 0 }
9
+
10
+ delegate(:reference_no, to: :plan, prefix: true, allow_nil: true)
11
+ delegate(:name, to: :commodity_category, prefix: true)
12
+ delegate(:abbreviation, to: :unit, prefix: true)
13
+ end
14
+ end
15
+ end
@@ -32,7 +32,7 @@ module Cats
32
32
 
33
33
  return if dispatchable.status == RhnRequest::APPROVED
34
34
 
35
- errors.add(:dispatchable, 'is already reserved.') if id.nil?
35
+ errors.add(:dispatchable, 'is already reserved.') if id.nil? && dispatchable.status == Dispatchable::RESERVED
36
36
  end
37
37
 
38
38
  def approve
@@ -1,28 +1,14 @@
1
1
  module Cats
2
2
  module Core
3
3
  class Donation < ApplicationRecord
4
- CASH = 'Cash'.freeze
5
- KIND = 'Kind'.freeze
6
- DONATION_TYPES = [CASH, KIND].freeze
4
+ self.abstract_class = true
7
5
 
8
6
  belongs_to :donor
9
- belongs_to :plan, optional: true
10
- belongs_to :currency, optional: true
11
- belongs_to :commodity_category, optional: true
12
- belongs_to :unit_of_measure, optional: true
13
7
 
14
- validates :reference_no, :amount, :donation_type, :donated_on, presence: true
8
+ validates :reference_no, :donated_on, presence: true
15
9
  validates :reference_no, uniqueness: true
16
- validates :donation_type, inclusion: { in: DONATION_TYPES }
17
- validates :currency, presence: true, if: -> { donation_type == CASH }
18
- validates :commodity_category, presence: true, if: -> { donation_type == KIND }
19
- validates :unit_of_measure, presence: true, if: -> { donation_type == KIND }
20
10
 
21
11
  delegate(:name, to: :donor, prefix: true)
22
- delegate(:reference_no, to: :plan, prefix: true, allow_nil: true)
23
- delegate(:name, to: :commodity_category, prefix: true, allow_nil: true)
24
- delegate(:code, to: :currency, prefix: true, allow_nil: true)
25
- delegate(:abbreviation, to: :unit_of_measure, prefix: true, allow_nil: true)
26
12
  end
27
13
  end
28
14
  end
@@ -3,9 +3,9 @@ module Cats
3
3
  class GiftCertificate < ApplicationRecord
4
4
  belongs_to :donation, optional: true
5
5
  belongs_to :commodity_category
6
- belongs_to :unit_of_measure
6
+ belongs_to :unit, class_name: 'UnitOfMeasure'
7
7
  belongs_to :currency
8
- belongs_to :destination_warehouse, class_name: 'Cats::Core::Location'
8
+ belongs_to :destination_warehouse, class_name: 'Location'
9
9
 
10
10
  validates :reference_no, presence: true, uniqueness: true
11
11
  validates :gift_date, :quantity, :requested_by, :customs_office, presence: true
@@ -13,28 +13,8 @@ module Cats
13
13
 
14
14
  delegate(:name, to: :commodity_category, prefix: true)
15
15
  delegate(:name, to: :destination_warehouse, prefix: true)
16
- delegate(:abbreviation, to: :unit_of_measure, prefix: true)
16
+ delegate(:abbreviation, to: :unit, prefix: true)
17
17
  delegate(:code, to: :currency, prefix: true)
18
-
19
- before_validation :set_commodity_category
20
- after_create :update_donation
21
-
22
- def update_donation
23
- return unless donation
24
-
25
- return if donation.active
26
-
27
- donation.active = true
28
- donation.save!
29
- end
30
-
31
- def set_commodity_category
32
- return unless donation
33
-
34
- return if commodity_category == donation.commodity_category
35
-
36
- self.commodity_category = donation.commodity_category
37
- end
38
18
  end
39
19
  end
40
20
  end
@@ -0,0 +1,15 @@
1
+ module Cats
2
+ module Core
3
+ class Loan < ApplicationRecord
4
+ belongs_to :commodity_category
5
+ belongs_to :unit, class_name: 'UnitOfMeasure'
6
+
7
+ validates :reference_no, presence: true, uniqueness: true
8
+ validates :lender, :agreement_date, presence: true
9
+ validates :quantity, presence: true, numericality: { greater_than: 0 }
10
+
11
+ delegate(:name, to: :commodity_category, prefix: true)
12
+ delegate(:abbreviation, to: :unit, prefix: true)
13
+ end
14
+ end
15
+ end
@@ -27,6 +27,10 @@ module Cats
27
27
  validates :season, presence: true, inclusion: { in: SEASONS }
28
28
  validates :reference_no, uniqueness: true
29
29
  validates :status, inclusion: { in: STATUSES }
30
+
31
+ def no_of_round_days
32
+ total_days / rounds
33
+ end
30
34
  end
31
35
  end
32
36
  end
@@ -9,6 +9,7 @@ module Cats
9
9
  validates :year, numericality: { greater_than: 2000 }
10
10
 
11
11
  delegate(:code, to: :program, prefix: true)
12
+ delegate(:reference_no, to: :source, prefix: true)
12
13
  end
13
14
  end
14
15
  end
@@ -5,27 +5,19 @@ module Cats
5
5
  FOREIGN = 'Foreign'.freeze
6
6
  PURCHASE_TYPES = [LOCAL, FOREIGN].freeze
7
7
 
8
- belongs_to :donation
8
+ belongs_to :cash_donation
9
9
  belongs_to :commodity_category
10
+ belongs_to :currency
10
11
  belongs_to :unit, class_name: 'Cats::Core::UnitOfMeasure'
11
12
 
12
- validates :reference_no, :order_date, :supplier, :quantity, :purchase_type, presence: true
13
+ validates :reference_no, :order_date, :supplier, :purchase_type, presence: true
13
14
  validates :reference_no, uniqueness: true
14
15
  validates :purchase_type, inclusion: { in: PURCHASE_TYPES }
15
- validates :quantity, numericality: { greater_than: 0 }
16
+ validates :quantity, :price, presence: true, numericality: { greater_than: 0 }
16
17
 
17
18
  delegate(:name, to: :commodity_category, prefix: true)
18
19
  delegate(:name, to: :unit, prefix: true)
19
-
20
- after_create :update_donation
21
-
22
- def update_donation
23
- donation = self.donation
24
- return if donation.active
25
-
26
- donation.active = true
27
- donation.save!
28
- end
20
+ delegate(:code, to: :currency, prefix: true)
29
21
  end
30
22
  end
31
23
  end
@@ -3,11 +3,11 @@ module Cats
3
3
  class RhnRequest < ApplicationRecord
4
4
  include Dispatchable
5
5
 
6
- DRAFT = 'Draft'.freeze
7
- APPROVED = 'Approved'.freeze
8
- RESERVED = 'Reserved'.freeze
6
+ # DRAFT = 'Draft'.freeze
7
+ # APPROVED = 'Approved'.freeze
8
+ # RESERVED = 'Reserved'.freeze
9
9
  ALLOCATED = 'Allocated'.freeze
10
- STATUSES = [DRAFT, APPROVED, RESERVED, ALLOCATED].freeze
10
+ STATUSES << ALLOCATED
11
11
 
12
12
  belongs_to :commodity
13
13
 
@@ -0,0 +1,16 @@
1
+ module Cats
2
+ module Core
3
+ class RoundBeneficiary < ApplicationRecord
4
+ belongs_to :beneficiary
5
+ belongs_to :round_plan_item
6
+ belongs_to :commodity_category
7
+ belongs_to :unit, class_name: 'UnitOfMeasure'
8
+
9
+ validates :quantity, presence: true, numericality: { greater_than: 0 }
10
+
11
+ delegate(:full_name, to: :beneficiary, prefix: true)
12
+ delegate(:name, to: :commodity_category, prefix: true)
13
+ delegate(:abbreviation, to: :unit, prefix: true)
14
+ end
15
+ end
16
+ end
@@ -3,12 +3,9 @@ module Cats
3
3
  class RoundPlan < ApplicationRecord
4
4
  include Dispatchable
5
5
 
6
- DRAFT = 'Draft'.freeze
7
- APPROVED = 'Approved'.freeze
8
- RESERVED = 'Reserved'.freeze
9
6
  NEEDS_APPROVED = 'Needs Approved'.freeze
10
7
 
11
- STATUSES = [DRAFT, APPROVED, RESERVED, NEEDS_APPROVED].freeze
8
+ STATUSES << NEEDS_APPROVED
12
9
 
13
10
  belongs_to :plan
14
11
  belongs_to :region, class_name: 'Cats::Core::Location'
@@ -17,6 +14,7 @@ module Cats
17
14
  has_many :round_rations
18
15
  has_many :beneficiary_round_plan_items, through: :round_plan_items
19
16
  has_many :round_plan_item_details, through: :beneficiary_round_plan_items
17
+ has_many :round_beneficiaries, through: :round_plan_items
20
18
 
21
19
  validates :rounds, presence: true
22
20
  validates :reference_no, presence: true, uniqueness: true
@@ -10,6 +10,7 @@ module Cats
10
10
 
11
11
  has_many :beneficiary_round_plan_items
12
12
  has_many :round_plan_item_details, through: :beneficiary_round_plan_items
13
+ has_many :round_beneficiaries
13
14
 
14
15
  validates :plan_item_id, presence: true
15
16
  validates :round_plan_id, uniqueness: { scope: :fdp_id }
@@ -0,0 +1,19 @@
1
+ module Cats
2
+ module Core
3
+ class Swap < ApplicationRecord
4
+ belongs_to :issued_commodity, class_name: 'CommodityCategory'
5
+ belongs_to :issued_unit, class_name: 'UnitOfMeasure'
6
+ belongs_to :received_commodity, class_name: 'CommodityCategory'
7
+ belongs_to :received_unit, class_name: 'UnitOfMeasure'
8
+
9
+ validates :reference_no, presence: true, uniqueness: true
10
+ validates :swapper, :agreement_date, :issued_quantity, :received_quantity, presence: true
11
+ validates :issued_quantity, :received_quantity, presence: true, numericality: { greater_than: 0 }
12
+
13
+ delegate(:name, to: :issued_commodity, prefix: true)
14
+ delegate(:name, to: :received_commodity, prefix: true)
15
+ delegate(:abbreviation, to: :issued_unit, prefix: true)
16
+ delegate(:abbreviation, to: :received_unit, prefix: true)
17
+ end
18
+ end
19
+ end
@@ -7,6 +7,14 @@ module Cats
7
7
  module Dispatchable
8
8
  extend ActiveSupport::Concern
9
9
 
10
+ DRAFT = 'Draft'.freeze
11
+ APPROVED = 'Approved'.freeze
12
+ RESERVED = 'Reserved'.freeze
13
+
14
+ # rubocop:disable Style/MutableConstant
15
+ STATUSES = [DRAFT, APPROVED, RESERVED]
16
+ # rubocop:enable Style/MutableConstant
17
+
10
18
  included do
11
19
  has_many :dispatch_plans, as: :dispatchable
12
20
  end
@@ -0,0 +1,8 @@
1
+ module Cats
2
+ module Core
3
+ class CashDonationSerializer < ActiveModel::Serializer
4
+ attributes :id, :reference_no, :description, :donated_on, :donor_id, :donor_name, :amount, :currency_id,
5
+ :currency_code
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,9 @@
1
+ module Cats
2
+ module Core
3
+ class CommodityDonationSerializer < ActiveModel::Serializer
4
+ attributes :id, :reference_no, :donated_on, :donor_id, :donor_name, :plan_id, :plan_reference_no,
5
+ :quantity, :unit_id, :unit_abbreviation, :description, :commodity_category_id,
6
+ :commodity_category_name, :shipping_reference
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,8 @@
1
+ module Cats
2
+ module Core
3
+ class LoanSerializer < ActiveModel::Serializer
4
+ attributes :id, :reference_no, :lender, :agreement_date, :repayment_date, :commodity_category_id,
5
+ :commodity_category_name, :quantity, :unit_id, :unit_abbreviation
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,9 @@
1
+ module Cats
2
+ module Core
3
+ class PurchaseOrderSerializer < ActiveModel::Serializer
4
+ attributes :id, :reference_no, :order_date, :requisition_no, :supplier, :cash_donation_id, :purchase_type,
5
+ :commodity_category_id, :commodity_category_name, :quantity, :unit_id, :unit_name, :currency_id,
6
+ :currency_code, :price
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,8 @@
1
+ module Cats
2
+ module Core
3
+ class RoundBeneficiarySerializer < ActiveModel::Serializer
4
+ attributes :id, :beneficiary_id, :beneficiary_full_name, :round_plan_item_id, :commodity_category_id,
5
+ :commodity_category_name, :quantity, :unit_id, :unit_abbreviation, :received
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,9 @@
1
+ module Cats
2
+ module Core
3
+ class SwapSerializer < ActiveModel::Serializer
4
+ attributes :id, :reference_no, :swapper, :agreement_date, :issued_commodity_id, :issued_commodity_name,
5
+ :issued_quantity, :received_commodity_id, :received_commodity_name, :received_quantity,
6
+ :issued_unit_id, :issued_unit_abbreviation, :received_unit_id, :received_unit_abbreviation
7
+ end
8
+ end
9
+ end