Open adelevie opened 7 years ago
An idea for a state builder:
ChangeState.new(auction, published: :unpublished).perform
Although maybe raw ActiveRecord is still fine. The abstractions don't seem to abstract too much other than the column names of AuctionState
, which I'm not even sure need to be hidden.
Ended up writing something close:
ChangeState.new(auction, 'published', 'unpublished').perform
This helps simplify UpdateAuction
in that UpdateAuction#create_auction_states
no longer needs to know about whether or not an AuctionState needs to be created or found-and-updated. This will be handy as we add more state changes to UpdateAuction
.
Working with @baccigalupi to pay down some technical debt by moving many of the groupings of fields on
Auction
into their own state objects. The disambiguation will make the code easier to reason about, and easier to modify as state needs change.