**what**
- Add support to remove resources by batch on discount conditions
- Add support on medusa-js and medusa-react
**Tests**
- Add integration tests to validate that the resources have been deleted and the length is the one expected
- Add unit tests on medusa react
FIXES CORE-609
* feat(medusa): Allow to add items to a discount condition by batch + cleanup of discounts and discount conditions end points
* style(medusa): cleanup catch and log
* feat(medusa-react, medusa-js): Add support to add item batch to discount condition
* cleanup
* cleanup
* rename items to resources
* fix(medusa-js): url
* Create fast-suns-repair.md
* update naming
* tests(integration): Update tests to reflect API changes
* feat(medusa): Delete a condition should be idempotent on discount and condition
* revert
* fix babel transform-runtime regenerator required for migrations
* add customer group model
* add migration for customer group
* add customer group model export
* add customer group repository
* add customer group service
* add CustomerGroupRepository to "withTransaction" in CustomerGroupService
* remove unnecessary argument to runtime plugin
* service export ordering
* add create customer group endpoint
* add customergroup to route index in admin
* add customer group service
* add customer groups test
* cleanup
* add customers batch initial
* batch creation of customer groups
* integration testing batch creation
* integration tests
* chaining existing customers creation in repo
* remove commented test
* update unit tests to reflect change in idempotent behavior
* ensure that exceptions are expected
* update idempotency behavior
* update formatting
* update format
* Update packages/medusa/src/repositories/customer-group.ts
Co-authored-by: Sebastian Rindom <skrindom@gmail.com>
* pr feedback
* add In import
* add seperate model dto
* add integration test
* error handling in repository
* remove unused import
* jsdoc
* Update packages/medusa/src/api/routes/admin/customer-groups/add-customers-batch.ts
Co-authored-by: Sebastian Rindom <skrindom@gmail.com>
* Update packages/medusa/src/api/routes/admin/customer-groups/add-customers-batch.ts
Co-authored-by: Sebastian Rindom <skrindom@gmail.com>
* pr review comments
* rename variable
* fix: adds atomic phase clean up callback
* fix: call error handler in new transaction block too
* restore
* error handling
* fix: error handler in no isolation case
* add integration test for missing group on update
* final adjustments to test
* fix pr feedback
* cleanup core for pr
* remove console.log
* remove customergroupservice test from customers
* Apply suggestions from code review
Co-authored-by: Sebastian Rindom <skrindom@gmail.com>
* add end bracket to customer tests
* remove comments
* change model decorator
* fix integration test merge
* onDelete cascade instead of cascade:true
* remove verbose flag
* fix: dedupe type
* add save to customer groups
* customer model delete cascade
* add await to asyncronous save operations
Co-authored-by: Sebastian Rindom <skrindom@gmail.com>
* discount expiration validation and testing
* integration testing
* double quotes
* add iso8601 package
* api testing
* add joi validation of start and end dates as well as valid_duration
* valid_duration column
* service testing
* discount validation in services
* integration test with invalid date interval
* include valid_duration when fetching a discount
* rename variable for clarity
* add test for dynamic discount with expiration date
* remove debug code
* adjust tests to reflect valid_duration being included in default fields
* additional discount update validation
* fixed failing test
* set ends_at on dynamic discount creation
* discount integration tests
* removed unused console.log
* removed validation of dynamic discounts by duration and added ends_at to dynamic discount creation
* integration tests for dynamic discount with and without duration
* optional valid duration for dynamic discounts
* allow nullable dynamic discount durations
* expect assertions
* fix unit test after change to dynamic discounts without duration
* change to date instead of string
* add assertions
* error handling
* addressed feedback
* fix: replace ILIKE operator with ILike function where possible
* remove: unused import
* fix: remove alias from test case as it is not needed
* fix: product variant query
* add: integration tests + fallback to original query for all queries searching on the display_id field
* remove: console.log