-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…#1466) * `Marketplace`: `TaxRate`s connect to `Bazaar` - #1137 OK this is a bit larger than I wanted it to be, but it should be a purely structural change. - Creates a `Marketplace::Bazaar` class to attach the `TaxRate` - Migrates `TaxRate` connection to the `Bazaar` on migration - Maintains the wiring of the `TaxRate` to the `Marketplace` * Boop * `Marketplace`: Missed a place to provide `TaxRate#marketplace`
- Loading branch information
Showing
15 changed files
with
62 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class Marketplace | ||
# Serves as a connection point for cross-marketplace functionality, like | ||
# {TaxRate} and {Shopper}. | ||
class Bazaar < ::Space | ||
has_many :marketplaces, through: :rooms, source: :furnitures, inverse_of: :bazaar, class_name: "Marketplace" | ||
has_many :tax_rates, inverse_of: :bazaar, dependent: :destroy | ||
|
||
def space | ||
becomes(Space) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
db/migrate/20230514174823_marketplace_add_bazaar_to_tax_rate.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class MarketplaceAddBazaarToTaxRate < ActiveRecord::Migration[7.0] | ||
disable_ddl_transaction! | ||
def change | ||
add_reference :marketplace_tax_rates, :bazaar, type: :uuid, null: true, index: {algorithm: :concurrently} | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
require "rails_helper" | ||
|
||
RSpec.describe Marketplace::Bazaar, type: :model do | ||
it { is_expected.to have_many(:marketplaces).through(:rooms).inverse_of(:bazaar) } | ||
it { is_expected.to have_many(:tax_rates).inverse_of(:bazaar).dependent(:destroy) } | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters