-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(pricing,types): price list API + price calculations with price lists #5498
Conversation
🦋 Changeset detectedLatest commit: b4548c8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 3 Ignored Deployments
|
* chore: add price list creation with prices & rules * chore: add price list pricing in calculate prices * chore: self review * fix tests and compilation errors * chore: safely run migrations --------- Co-authored-by: Philip Korsholm <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Partial reviews
packages/pricing/integration-tests/__tests__/services/pricing-module/price-list-rule.spec.ts
Show resolved
Hide resolved
packages/pricing/integration-tests/__tests__/services/pricing-module/price-list-rule.spec.ts
Outdated
Show resolved
Hide resolved
packages/pricing/integration-tests/__tests__/services/pricing-module/price-list.spec.ts
Outdated
Show resolved
Hide resolved
@@ -101,5 +101,39 @@ export class Migration20230929122253 extends Migration { | |||
this.addSql( | |||
'alter table "price_rule" add constraint "price_rule_price_set_money_amount_id_foreign" foreign key ("price_set_money_amount_id") references "price_set_money_amount" ("id") on update cascade on delete cascade;' | |||
) | |||
|
|||
this.addSql( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: take or leave. In the product module to ensure it is always working, we have adding IF EXISTS / NOT EXISTS for every query on table/column/index etc. should we alwas do that. wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In pricing migrations, I only did if exists for conflicting tables with the core. I don't think its necessary for those that are not available on the core. Happy to add if you think so, i don't have a strong opinion on this.
this.addSql( | ||
'create table "price_list_rule" ("id" text not null, "rule_type_id" text not null, "value" text not null, "priority" integer not null default 0, "price_list_id" text not null, constraint "price_list_rule_pkey" primary key ("id"));' | ||
) | ||
|
||
this.addSql( | ||
'create index "IDX_price_list_rule_rule_type_id" on "price_list_rule" ("rule_type_id");' | ||
) | ||
this.addSql( | ||
'create index "IDX_price_list_rule_price_list_id" on "price_list_rule" ("price_list_id");' | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May not be necessary considering id
is the PK, but do we also want to add a Unique Index on (rule_type_id, price_list_id)
unique combination?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, added in the unique constraint. 🔥
On the first comment, these are foreign keys here with which we scope on the table by, can you elaborate on why you think these aren't needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just have a few comments regarding softDelete methods that we should consider to have in all the entities we expose and therefore can be extended.
But it doesn't need to be in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, really awesome work 💪
what:
PriceList Service APIs:
Price Calculations