~singpolyma/sgx-jmp

ref: f571b5e726750cf8c4523c22d77e110194c3e16a sgx-jmp/lib/customer_repo.rb -rw-r--r-- 4.3 KiB
Postgres#query_one

Helper for queries that only return a single row.
Do not allow nil tndetails
LazyObject is not nil, so safenav doesn't work
Refactor CustomerInfoForm to use find_by_format
Set Sentry user from CustomerRepo

We don't always use this to get the current user, so make it optional.
CustomerRepo::QueryKey and CustomerRepo#find_by_format

Introduce objects representing the different kind of query keys that can be used
to look up a customer.  These keys know how to use themselves to get
the (customer_id, jid) pair that is needed for an actual repo lookup.  All
find_by_* methods are now just trivial wrappers over these objects that pass on
to find_inner.

This enables the easy creation of a new helper: QueryKey.for, used as
find_by_format which allows passing an xmpp: URI, or a properly formatted tel,
or a customer id, and will find by the correct one.  This could cause a problem
if a customer id were to be a valid xmpp: URI or a formatted tel, so this method
does assume not using these formats for any customer id (which would be
ill-advised in any case).
put_monthly_overage_limit
Use default from Customer constructor
Everything from redis is an int for now
Need to splat the keys back out
Merge branch 'overage-limit'

* overage-limit:
  auto_top_up_amount and monthly_overage_limit from CustomerRepo
  Move Bandwidth Tn remote operations to BandwidthTnRepo
  Use value_semantics to DRY up CustomerRepo
  Use NotFound exception for all customer not found cases
auto_top_up_amount and monthly_overage_limit from CustomerRepo

Move load of auto_top_up_amount to the repo, and load monthly_overage_limit in
the same operation.
Move Bandwidth Tn remote operations to BandwidthTnRepo
Use value_semantics to DRY up CustomerRepo
Use NotFound exception for all customer not found cases
Merge branch 'nuke-legacy-customers'

* nuke-legacy-customers:
  Remove LegacyCustomer
Remove LegacyCustomer

Such customers are not longer a common or valid case.
Next