@medusajs/medusa 1.2.2-dev.56 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +48 -0
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/index.js.map +1 -1
- package/dist/api/middlewares/error-handler.js +1 -1
- package/dist/api/routes/admin/auth/create-session.js +5 -5
- package/dist/api/routes/admin/auth/create-session.js.map +1 -1
- package/dist/api/routes/admin/customer-groups/list-customer-groups.js +2 -2
- package/dist/api/routes/admin/customer-groups/list-customer-groups.js.map +1 -1
- package/dist/api/routes/admin/discounts/create-discount.d.ts +11 -2
- package/dist/api/routes/admin/discounts/create-discount.js +66 -12
- package/dist/api/routes/admin/discounts/create-discount.js.map +1 -1
- package/dist/api/routes/admin/discounts/create-dynamic-code.d.ts +1 -0
- package/dist/api/routes/admin/discounts/create-dynamic-code.js +4 -1
- package/dist/api/routes/admin/discounts/create-dynamic-code.js.map +1 -1
- package/dist/api/routes/admin/discounts/delete-dynamic-code.js +3 -1
- package/dist/api/routes/admin/discounts/delete-dynamic-code.js.map +1 -1
- package/dist/api/routes/admin/discounts/get-discount.d.ts +7 -0
- package/dist/api/routes/admin/discounts/get-discount.js +43 -9
- package/dist/api/routes/admin/discounts/get-discount.js.map +1 -1
- package/dist/api/routes/admin/discounts/index.d.ts +1 -3
- package/dist/api/routes/admin/discounts/index.js +1 -6
- package/dist/api/routes/admin/discounts/index.js.map +1 -1
- package/dist/api/routes/admin/discounts/list-discounts.d.ts +2 -6
- package/dist/api/routes/admin/discounts/list-discounts.js +15 -28
- package/dist/api/routes/admin/discounts/list-discounts.js.map +1 -1
- package/dist/api/routes/admin/discounts/update-discount.d.ts +12 -2
- package/dist/api/routes/admin/discounts/update-discount.js +70 -15
- package/dist/api/routes/admin/discounts/update-discount.js.map +1 -1
- package/dist/api/routes/admin/draft-orders/create-draft-order.d.ts +3 -3
- package/dist/api/routes/admin/draft-orders/create-draft-order.js.map +1 -1
- package/dist/api/routes/admin/draft-orders/create-line-item.d.ts +1 -1
- package/dist/api/routes/admin/draft-orders/create-line-item.js.map +1 -1
- package/dist/api/routes/admin/draft-orders/index.js +7 -1
- package/dist/api/routes/admin/draft-orders/index.js.map +1 -1
- package/dist/api/routes/admin/draft-orders/register-payment.js +0 -1
- package/dist/api/routes/admin/draft-orders/register-payment.js.map +1 -1
- package/dist/api/routes/admin/draft-orders/update-line-item.d.ts +1 -1
- package/dist/api/routes/admin/draft-orders/update-line-item.js.map +1 -1
- package/dist/api/routes/admin/notifications/index.js.map +1 -1
- package/dist/api/routes/admin/notifications/list-notifications.js.map +1 -1
- package/dist/api/routes/admin/notifications/resend-notification.js.map +1 -1
- package/dist/api/routes/admin/orders/add-shipping-method.d.ts +1 -1
- package/dist/api/routes/admin/orders/add-shipping-method.js.map +1 -1
- package/dist/api/routes/admin/orders/create-order.js.map +1 -1
- package/dist/api/routes/admin/orders/create-swap.js +7 -3
- package/dist/api/routes/admin/orders/create-swap.js.map +1 -1
- package/dist/api/routes/admin/orders/index.d.ts +1 -1
- package/dist/api/routes/admin/orders/index.js +1 -3
- package/dist/api/routes/admin/orders/index.js.map +1 -1
- package/dist/api/routes/admin/orders/list-orders.js.map +1 -1
- package/dist/api/routes/admin/orders/update-order.js.map +1 -1
- package/dist/api/routes/admin/price-lists/index.d.ts +7 -0
- package/dist/api/routes/admin/price-lists/index.js +3 -0
- package/dist/api/routes/admin/price-lists/index.js.map +1 -1
- package/dist/api/routes/admin/price-lists/list-price-list-products.d.ts +74 -0
- package/dist/api/routes/admin/price-lists/list-price-list-products.js +246 -0
- package/dist/api/routes/admin/price-lists/list-price-list-products.js.map +1 -0
- package/dist/api/routes/admin/price-lists/update-price-list.d.ts +2 -2
- package/dist/api/routes/admin/price-lists/update-price-list.js.map +1 -1
- package/dist/api/routes/admin/products/list-products.d.ts +2 -1
- package/dist/api/routes/admin/products/list-products.js +31 -65
- package/dist/api/routes/admin/products/list-products.js.map +1 -1
- package/dist/api/routes/admin/products/update-variant.js +11 -7
- package/dist/api/routes/admin/products/update-variant.js.map +1 -1
- package/dist/api/routes/admin/regions/index.d.ts +1 -1
- package/dist/api/routes/admin/store/get-store.js.map +1 -1
- package/dist/api/routes/admin/swaps/index.js +3 -0
- package/dist/api/routes/admin/swaps/index.js.map +1 -1
- package/dist/api/routes/admin/tax-rates/list-tax-rates.js.map +1 -1
- package/dist/api/routes/admin/tax-rates/utils/get-query-config.d.ts +1 -1
- package/dist/api/routes/admin/tax-rates/utils/get-query-config.js +4 -2
- package/dist/api/routes/admin/tax-rates/utils/get-query-config.js.map +1 -1
- package/dist/api/routes/admin/uploads/index.d.ts +1 -1
- package/dist/api/routes/store/auth/create-session.js +4 -5
- package/dist/api/routes/store/auth/create-session.js.map +1 -1
- package/dist/api/routes/store/carts/create-cart.js +8 -5
- package/dist/api/routes/store/carts/create-cart.js.map +1 -1
- package/dist/api/routes/store/carts/create-line-item.d.ts +1 -1
- package/dist/api/routes/store/carts/create-line-item.js +9 -6
- package/dist/api/routes/store/carts/create-line-item.js.map +1 -1
- package/dist/api/routes/store/carts/index.d.ts +0 -1
- package/dist/api/routes/store/carts/index.js +1 -3
- package/dist/api/routes/store/carts/index.js.map +1 -1
- package/dist/api/routes/store/carts/update-cart.js +7 -7
- package/dist/api/routes/store/carts/update-cart.js.map +1 -1
- package/dist/api/routes/store/customers/create-customer.js +3 -4
- package/dist/api/routes/store/customers/create-customer.js.map +1 -1
- package/dist/api/routes/store/orders/index.js +0 -2
- package/dist/api/routes/store/orders/index.js.map +1 -1
- package/dist/api/routes/store/products/get-product.js +17 -5
- package/dist/api/routes/store/products/get-product.js.map +1 -1
- package/dist/api/routes/store/products/index.d.ts +2 -2
- package/dist/api/routes/store/products/list-products.d.ts +2 -1
- package/dist/api/routes/store/products/list-products.js +21 -8
- package/dist/api/routes/store/products/list-products.js.map +1 -1
- package/dist/api/routes/store/products/search.d.ts +1 -1
- package/dist/api/routes/store/products/search.js.map +1 -1
- package/dist/api/routes/store/shipping-options/list-options.js.map +1 -1
- package/dist/api/routes/store/swaps/create-swap.js +7 -3
- package/dist/api/routes/store/swaps/create-swap.js.map +1 -1
- package/dist/api/routes/store/variants/get-variant.js +17 -5
- package/dist/api/routes/store/variants/get-variant.js.map +1 -1
- package/dist/api/routes/store/variants/list-variants.d.ts +2 -1
- package/dist/api/routes/store/variants/list-variants.js +38 -9
- package/dist/api/routes/store/variants/list-variants.js.map +1 -1
- package/dist/commands/develop.js +1 -1
- package/dist/commands/develop.js.map +1 -1
- package/dist/controllers/customers/index.d.ts +1 -1
- package/dist/controllers/customers/list-customers.d.ts +1 -1
- package/dist/controllers/customers/list-customers.js +34 -37
- package/dist/controllers/customers/list-customers.js.map +1 -1
- package/dist/controllers/products/admin-list-products.d.ts +16 -0
- package/dist/controllers/products/admin-list-products.js +103 -0
- package/dist/controllers/products/admin-list-products.js.map +1 -0
- package/dist/helpers/test-request.js +15 -7
- package/dist/helpers/test-request.js.map +1 -1
- package/dist/index.d.ts +3 -59
- package/dist/index.js +3 -62
- package/dist/index.js.map +1 -1
- package/dist/interfaces/base-service.d.ts +66 -0
- package/dist/interfaces/base-service.js +378 -0
- package/dist/interfaces/base-service.js.map +1 -0
- package/dist/interfaces/index.d.ts +1 -0
- package/dist/interfaces/index.js +1 -0
- package/dist/interfaces/index.js.map +1 -1
- package/dist/interfaces/price-selection-strategy.d.ts +50 -0
- package/dist/interfaces/price-selection-strategy.js +34 -0
- package/dist/interfaces/price-selection-strategy.js.map +1 -0
- package/dist/interfaces/tax-service.d.ts +6 -0
- package/dist/interfaces/tax-service.js +31 -0
- package/dist/interfaces/tax-service.js.map +1 -1
- package/dist/loaders/api.d.ts +9 -5
- package/dist/loaders/api.js +2 -6
- package/dist/loaders/api.js.map +1 -1
- package/dist/loaders/config.d.ts +3 -0
- package/dist/loaders/config.js +47 -0
- package/dist/loaders/config.js.map +1 -0
- package/dist/loaders/database.d.ts +8 -4
- package/dist/loaders/database.js.map +1 -1
- package/dist/loaders/defaults.d.ts +4 -3
- package/dist/loaders/defaults.js +39 -31
- package/dist/loaders/defaults.js.map +1 -1
- package/dist/loaders/express.d.ts +7 -4
- package/dist/loaders/express.js +7 -5
- package/dist/loaders/express.js.map +1 -1
- package/dist/loaders/index.d.ts +13 -8
- package/dist/loaders/index.js +29 -54
- package/dist/loaders/index.js.map +1 -1
- package/dist/loaders/logger.d.ts +1 -0
- package/dist/loaders/logger.js.map +1 -1
- package/dist/loaders/models.d.ts +8 -3
- package/dist/loaders/models.js +19 -17
- package/dist/loaders/models.js.map +1 -1
- package/dist/loaders/passport.d.ts +7 -4
- package/dist/loaders/passport.js +23 -21
- package/dist/loaders/passport.js.map +1 -1
- package/dist/loaders/plugins.d.ts +18 -10
- package/dist/loaders/plugins.js +27 -24
- package/dist/loaders/plugins.js.map +1 -1
- package/dist/loaders/redis.d.ts +8 -5
- package/dist/loaders/redis.js +3 -3
- package/dist/loaders/redis.js.map +1 -1
- package/dist/loaders/repositories.d.ts +7 -3
- package/dist/loaders/repositories.js +1 -1
- package/dist/loaders/repositories.js.map +1 -1
- package/dist/loaders/search-index.d.ts +4 -3
- package/dist/loaders/search-index.js.map +1 -1
- package/dist/loaders/services.d.ts +10 -5
- package/dist/loaders/services.js.map +1 -1
- package/dist/loaders/strategies.d.ts +1 -1
- package/dist/loaders/subscribers.d.ts +7 -3
- package/dist/loaders/subscribers.js.map +1 -1
- package/dist/migrations/1646324713514-discount_conditions.d.ts +6 -0
- package/dist/migrations/1646324713514-discount_conditions.js +335 -0
- package/dist/migrations/1646324713514-discount_conditions.js.map +1 -0
- package/dist/migrations/1648600574750-add_line_item_adjustments.d.ts +6 -0
- package/dist/migrations/1648600574750-add_line_item_adjustments.js +101 -0
- package/dist/migrations/1648600574750-add_line_item_adjustments.js.map +1 -0
- package/dist/migrations/1648641130007-tax_line_constraints.d.ts +6 -0
- package/dist/{api/routes/admin/discounts/remove-valid-product.js → migrations/1648641130007-tax_line_constraints.js} +39 -44
- package/dist/migrations/1648641130007-tax_line_constraints.js.map +1 -0
- package/dist/migrations/1649775522087-add_batch_job_model.d.ts +6 -0
- package/dist/{api/routes/admin/discounts/add-valid-product.js → migrations/1649775522087-add_batch_job_model.js} +39 -44
- package/dist/migrations/1649775522087-add_batch_job_model.js.map +1 -0
- package/dist/models/batch-job.d.ts +58 -0
- package/dist/models/batch-job.js +119 -0
- package/dist/models/batch-job.js.map +1 -0
- package/dist/models/country.d.ts +1 -1
- package/dist/models/country.js +1 -1
- package/dist/models/country.js.map +1 -1
- package/dist/models/customer-group.js +3 -1
- package/dist/models/customer-group.js.map +1 -1
- package/dist/models/discount-condition-customer-group.d.ts +39 -0
- package/dist/models/discount-condition-customer-group.js +84 -0
- package/dist/models/discount-condition-customer-group.js.map +1 -0
- package/dist/models/discount-condition-product-collection.d.ts +39 -0
- package/dist/models/discount-condition-product-collection.js +84 -0
- package/dist/models/discount-condition-product-collection.js.map +1 -0
- package/dist/models/discount-condition-product-tag.d.ts +39 -0
- package/dist/models/discount-condition-product-tag.js +84 -0
- package/dist/models/discount-condition-product-tag.js.map +1 -0
- package/dist/models/discount-condition-product-type.d.ts +39 -0
- package/dist/models/discount-condition-product-type.js +84 -0
- package/dist/models/discount-condition-product-type.js.map +1 -0
- package/dist/models/discount-condition-product.d.ts +39 -0
- package/dist/models/discount-condition-product.js +84 -0
- package/dist/models/discount-condition-product.js.map +1 -0
- package/dist/models/discount-condition.d.ts +68 -0
- package/dist/models/discount-condition.js +208 -0
- package/dist/models/discount-condition.js.map +1 -0
- package/dist/models/discount-rule.d.ts +5 -5
- package/dist/models/discount-rule.js +6 -17
- package/dist/models/discount-rule.js.map +1 -1
- package/dist/models/discount.js.map +1 -1
- package/dist/models/index.d.ts +66 -0
- package/dist/models/index.js +79 -0
- package/dist/models/index.js.map +1 -0
- package/dist/models/line-item-adjustment.d.ts +13 -0
- package/dist/models/line-item-adjustment.js +79 -0
- package/dist/models/line-item-adjustment.js.map +1 -0
- package/dist/models/line-item-tax-line.js +2 -1
- package/dist/models/line-item-tax-line.js.map +1 -1
- package/dist/models/line-item.d.ts +2 -0
- package/dist/models/line-item.js +5 -0
- package/dist/models/line-item.js.map +1 -1
- package/dist/models/money-amount.js +4 -1
- package/dist/models/money-amount.js.map +1 -1
- package/dist/models/price-list.js +6 -2
- package/dist/models/price-list.js.map +1 -1
- package/dist/models/product-variant.js +9 -3
- package/dist/models/product-variant.js.map +1 -1
- package/dist/models/shipping-method-tax-line.js +2 -1
- package/dist/models/shipping-method-tax-line.js.map +1 -1
- package/dist/models/swap.d.ts +4 -4
- package/dist/models/swap.js +23 -23
- package/dist/models/swap.js.map +1 -1
- package/dist/repositories/cart.d.ts +2 -2
- package/dist/repositories/cart.js.map +1 -1
- package/dist/repositories/customer.d.ts +1 -1
- package/dist/repositories/customer.js +7 -9
- package/dist/repositories/customer.js.map +1 -1
- package/dist/repositories/discount-condition.d.ts +34 -0
- package/dist/repositories/discount-condition.js +384 -0
- package/dist/repositories/discount-condition.js.map +1 -0
- package/dist/repositories/line-item-adjustment.d.ts +4 -0
- package/dist/repositories/line-item-adjustment.js +38 -0
- package/dist/repositories/line-item-adjustment.js.map +1 -0
- package/dist/repositories/line-item-tax-line.d.ts +2 -0
- package/dist/repositories/line-item-tax-line.js +80 -0
- package/dist/repositories/line-item-tax-line.js.map +1 -1
- package/dist/repositories/line-item.js +1 -0
- package/dist/repositories/line-item.js.map +1 -1
- package/dist/repositories/money-amount.d.ts +1 -0
- package/dist/repositories/money-amount.js +49 -2
- package/dist/repositories/money-amount.js.map +1 -1
- package/dist/repositories/product.d.ts +2 -0
- package/dist/repositories/product.js +35 -17
- package/dist/repositories/product.js.map +1 -1
- package/dist/repositories/shipping-method-tax-line.d.ts +2 -0
- package/dist/repositories/shipping-method-tax-line.js +80 -0
- package/dist/repositories/shipping-method-tax-line.js.map +1 -1
- package/dist/scripts/discount-rule-migration.d.ts +4 -0
- package/dist/scripts/discount-rule-migration.js +177 -0
- package/dist/scripts/discount-rule-migration.js.map +1 -0
- package/dist/scripts/line-item-adjustment-migration.d.ts +4 -0
- package/dist/scripts/line-item-adjustment-migration.js +173 -0
- package/dist/scripts/line-item-adjustment-migration.js.map +1 -0
- package/dist/services/cart.d.ts +58 -47
- package/dist/services/cart.js +1306 -1391
- package/dist/services/cart.js.map +1 -1
- package/dist/services/customer.js +4 -2
- package/dist/services/customer.js.map +1 -1
- package/dist/services/discount.d.ts +50 -58
- package/dist/services/discount.js +363 -152
- package/dist/services/discount.js.map +1 -1
- package/dist/services/draft-order.js +1 -0
- package/dist/services/draft-order.js.map +1 -1
- package/dist/services/fulfillment-provider.js +23 -17
- package/dist/services/fulfillment-provider.js.map +1 -1
- package/dist/services/invite.d.ts +4 -2
- package/dist/services/invite.js +11 -9
- package/dist/services/invite.js.map +1 -1
- package/dist/services/line-item-adjustment.d.ts +87 -0
- package/dist/services/line-item-adjustment.js +436 -0
- package/dist/services/line-item-adjustment.js.map +1 -0
- package/dist/services/line-item.d.ts +48 -40
- package/dist/services/line-item.js +226 -193
- package/dist/services/line-item.js.map +1 -1
- package/dist/services/order.js +4 -4
- package/dist/services/order.js.map +1 -1
- package/dist/services/payment-provider.js +23 -17
- package/dist/services/payment-provider.js.map +1 -1
- package/dist/services/product-variant.d.ts +26 -9
- package/dist/services/product-variant.js +222 -76
- package/dist/services/product-variant.js.map +1 -1
- package/dist/services/product.d.ts +22 -4
- package/dist/services/product.js +236 -48
- package/dist/services/product.js.map +1 -1
- package/dist/services/region.js +8 -4
- package/dist/services/region.js.map +1 -1
- package/dist/services/return.js +0 -1
- package/dist/services/return.js.map +1 -1
- package/dist/services/shipping-option.d.ts +2 -2
- package/dist/services/shipping-option.js +7 -4
- package/dist/services/shipping-option.js.map +1 -1
- package/dist/services/swap.d.ts +4 -1
- package/dist/services/swap.js +29 -16
- package/dist/services/swap.js.map +1 -1
- package/dist/services/system-tax.d.ts +2 -3
- package/dist/services/system-tax.js +2 -2
- package/dist/services/system-tax.js.map +1 -1
- package/dist/services/tax-provider.d.ts +2 -0
- package/dist/services/tax-provider.js +96 -7
- package/dist/services/tax-provider.js.map +1 -1
- package/dist/services/tax-rate.d.ts +3 -3
- package/dist/services/tax-rate.js +1 -1
- package/dist/services/tax-rate.js.map +1 -1
- package/dist/services/totals.d.ts +9 -8
- package/dist/services/totals.js +41 -88
- package/dist/services/totals.js.map +1 -1
- package/dist/strategies/price-selection.d.ts +13 -0
- package/dist/strategies/price-selection.js +185 -0
- package/dist/strategies/price-selection.js.map +1 -0
- package/dist/subscribers/order.js +1 -7
- package/dist/subscribers/order.js.map +1 -1
- package/dist/types/batch-job.d.ts +6 -0
- package/dist/types/batch-job.js +11 -0
- package/dist/types/batch-job.js.map +1 -0
- package/dist/types/common.d.ts +1 -3
- package/dist/types/discount.d.ts +69 -1
- package/dist/types/discount.js +129 -5
- package/dist/types/discount.js.map +1 -1
- package/dist/types/global.d.ts +34 -0
- package/dist/types/global.js +3 -0
- package/dist/types/global.js.map +1 -0
- package/dist/types/line-item-adjustment.d.ts +9 -0
- package/dist/types/line-item-adjustment.js +50 -0
- package/dist/types/line-item-adjustment.js.map +1 -0
- package/dist/types/price-selection.d.ts +5 -0
- package/dist/types/price-selection.js +35 -0
- package/dist/types/price-selection.js.map +1 -0
- package/dist/types/product-variant.d.ts +6 -0
- package/dist/types/product-variant.js.map +1 -1
- package/dist/types/product.d.ts +16 -0
- package/dist/types/product.js +86 -1
- package/dist/types/product.js.map +1 -1
- package/dist/types/validators/exactly-one.d.ts +6 -0
- package/dist/types/validators/exactly-one.js +37 -0
- package/dist/types/validators/exactly-one.js.map +1 -0
- package/dist/utils/date-helpers.d.ts +2 -0
- package/dist/utils/date-helpers.js +15 -0
- package/dist/utils/date-helpers.js.map +1 -0
- package/dist/utils/get-query-config.d.ts +11 -0
- package/dist/utils/get-query-config.js +88 -0
- package/dist/utils/get-query-config.js.map +1 -0
- package/package.json +7 -8
- package/dist/api/routes/admin/discounts/add-valid-product.d.ts +0 -23
- package/dist/api/routes/admin/discounts/add-valid-product.js.map +0 -1
- package/dist/api/routes/admin/discounts/remove-valid-product.d.ts +0 -23
- package/dist/api/routes/admin/discounts/remove-valid-product.js.map +0 -1
- package/dist/api/routes/store/carts/update-payment-method.d.ts +0 -38
- package/dist/api/routes/store/carts/update-payment-method.js +0 -122
- package/dist/api/routes/store/carts/update-payment-method.js.map +0 -1
- package/dist/config/index.d.ts +0 -14
- package/dist/config/index.js +0 -40
- package/dist/config/index.js.map +0 -1
- package/yarn-error.log +0 -6769
package/dist/models/swap.js
CHANGED
|
@@ -9,7 +9,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.Swap = exports.
|
|
12
|
+
exports.Swap = exports.SwapPaymentStatus = exports.SwapFulfillmentStatus = void 0;
|
|
13
13
|
var typeorm_1 = require("typeorm");
|
|
14
14
|
var ulid_1 = require("ulid");
|
|
15
15
|
var db_aware_column_1 = require("../utils/db-aware-column");
|
|
@@ -21,26 +21,26 @@ var return_1 = require("./return");
|
|
|
21
21
|
var cart_1 = require("./cart");
|
|
22
22
|
var payment_1 = require("./payment");
|
|
23
23
|
var shipping_method_1 = require("./shipping-method");
|
|
24
|
-
var
|
|
25
|
-
(function (
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
})(
|
|
32
|
-
var
|
|
33
|
-
(function (
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
})(
|
|
24
|
+
var SwapFulfillmentStatus;
|
|
25
|
+
(function (SwapFulfillmentStatus) {
|
|
26
|
+
SwapFulfillmentStatus["NOT_FULFILLED"] = "not_fulfilled";
|
|
27
|
+
SwapFulfillmentStatus["FULFILLED"] = "fulfilled";
|
|
28
|
+
SwapFulfillmentStatus["SHIPPED"] = "shipped";
|
|
29
|
+
SwapFulfillmentStatus["CANCELED"] = "canceled";
|
|
30
|
+
SwapFulfillmentStatus["REQUIRES_ACTION"] = "requires_action";
|
|
31
|
+
})(SwapFulfillmentStatus = exports.SwapFulfillmentStatus || (exports.SwapFulfillmentStatus = {}));
|
|
32
|
+
var SwapPaymentStatus;
|
|
33
|
+
(function (SwapPaymentStatus) {
|
|
34
|
+
SwapPaymentStatus["NOT_PAID"] = "not_paid";
|
|
35
|
+
SwapPaymentStatus["AWAITING"] = "awaiting";
|
|
36
|
+
SwapPaymentStatus["CAPTURED"] = "captured";
|
|
37
|
+
SwapPaymentStatus["CONFIRMED"] = "confirmed";
|
|
38
|
+
SwapPaymentStatus["CANCELED"] = "canceled";
|
|
39
|
+
SwapPaymentStatus["DIFFERENCE_REFUNDED"] = "difference_refunded";
|
|
40
|
+
SwapPaymentStatus["PARTIALLY_REFUNDED"] = "partially_refunded";
|
|
41
|
+
SwapPaymentStatus["REFUNDED"] = "refunded";
|
|
42
|
+
SwapPaymentStatus["REQUIRES_ACTION"] = "requires_action";
|
|
43
|
+
})(SwapPaymentStatus = exports.SwapPaymentStatus || (exports.SwapPaymentStatus = {}));
|
|
44
44
|
var Swap = /** @class */ (function () {
|
|
45
45
|
function Swap() {
|
|
46
46
|
}
|
|
@@ -55,11 +55,11 @@ var Swap = /** @class */ (function () {
|
|
|
55
55
|
__metadata("design:type", String)
|
|
56
56
|
], Swap.prototype, "id", void 0);
|
|
57
57
|
__decorate([
|
|
58
|
-
(0, db_aware_column_1.DbAwareColumn)({ type: "enum", enum:
|
|
58
|
+
(0, db_aware_column_1.DbAwareColumn)({ type: "enum", enum: SwapFulfillmentStatus }),
|
|
59
59
|
__metadata("design:type", String)
|
|
60
60
|
], Swap.prototype, "fulfillment_status", void 0);
|
|
61
61
|
__decorate([
|
|
62
|
-
(0, db_aware_column_1.DbAwareColumn)({ type: "enum", enum:
|
|
62
|
+
(0, db_aware_column_1.DbAwareColumn)({ type: "enum", enum: SwapPaymentStatus }),
|
|
63
63
|
__metadata("design:type", String)
|
|
64
64
|
], Swap.prototype, "payment_status", void 0);
|
|
65
65
|
__decorate([
|
package/dist/models/swap.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swap.js","sourceRoot":"","sources":["../../src/models/swap.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAegB;AAChB,6BAA2B;AAC3B,4DAAuE;AAEvE,iCAA+B;AAC/B,6CAA2C;AAC3C,qCAAmC;AACnC,yCAAsC;AACtC,mCAAiC;AACjC,+BAA6B;AAC7B,qCAAmC;AACnC,qDAAkD;AAElD,IAAY,
|
|
1
|
+
{"version":3,"file":"swap.js","sourceRoot":"","sources":["../../src/models/swap.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAegB;AAChB,6BAA2B;AAC3B,4DAAuE;AAEvE,iCAA+B;AAC/B,6CAA2C;AAC3C,qCAAmC;AACnC,yCAAsC;AACtC,mCAAiC;AACjC,+BAA6B;AAC7B,qCAAmC;AACnC,qDAAkD;AAElD,IAAY,qBAMX;AAND,WAAY,qBAAqB;IAC/B,wDAA+B,CAAA;IAC/B,gDAAuB,CAAA;IACvB,4CAAmB,CAAA;IACnB,8CAAqB,CAAA;IACrB,4DAAmC,CAAA;AACrC,CAAC,EANW,qBAAqB,GAArB,6BAAqB,KAArB,6BAAqB,QAMhC;AAED,IAAY,iBAUX;AAVD,WAAY,iBAAiB;IAC3B,0CAAqB,CAAA;IACrB,0CAAqB,CAAA;IACrB,0CAAqB,CAAA;IACrB,4CAAuB,CAAA;IACvB,0CAAqB,CAAA;IACrB,gEAA2C,CAAA;IAC3C,8DAAyC,CAAA;IACzC,0CAAqB,CAAA;IACrB,wDAAmC,CAAA;AACrC,CAAC,EAVW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB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2
2
|
import { Cart } from "../models/cart";
|
|
3
3
|
export declare class CartRepository extends Repository<Cart> {
|
|
4
|
-
findWithRelations(relations?:
|
|
5
|
-
findOneWithRelations(relations?:
|
|
4
|
+
findWithRelations(relations?: string[], optionsWithoutRelations?: Omit<FindManyOptions<Cart>, "relations">): Promise<Cart[]>;
|
|
5
|
+
findOneWithRelations(relations?: string[], optionsWithoutRelations?: Omit<FindManyOptions<Cart>, "relations">): Promise<Cart>;
|
|
6
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cart.js","sourceRoot":"","sources":["../../src/repositories/cart.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAqD;AACrD,mCAAuE;AACvE,uCAAqC;AAGrC;IAAoC,kCAAgB;IAApD;;IA+CA,CAAC;IA9Cc,0CAAiB,GAA9B,UACE,
|
|
1
|
+
{"version":3,"file":"cart.js","sourceRoot":"","sources":["../../src/repositories/cart.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAqD;AACrD,mCAAuE;AACvE,uCAAqC;AAGrC;IAAoC,kCAAgB;IAApD;;IA+CA,CAAC;IA9Cc,0CAAiB,GAA9B,UACE,SAAwB,EACxB,uBAAsE;QADtE,0BAAA,EAAA,cAAwB;QACxB,wCAAA,EAAA,4BAAsE;;;;;;;4BAErD,qBAAM,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,EAAA;;wBAAnD,QAAQ,GAAG,SAAwC;wBACnD,WAAW,GAAG,QAAQ,CAAC,GAAG,CAAC,UAAC,EAAM;gCAAJ,EAAE,QAAA;4BAAO,OAAA,EAAE;wBAAF,CAAE,CAAC,CAAA;w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,CAAC,CAAA;wBAEjB,qBAAM,IAAI,CAAC,iBAAiB,CACzC,SAAS,EACT,uBAAuB,CACxB,EAAA;;wBAHK,MAAM,GAAG,SAGd;wBACD,sBAAO,MAAM,CAAC,CAAC,CAAC,EAAA;;;;KACjB;IA9CU,cAAc;QAD1B,IAAA,0BAAgB,EAAC,WAAI,CAAC;OACV,cAAc,CA+C1B;IAAD,qBAAC;CAAA,AA/CD,CAAoC,oBAAU,GA+C7C;AA/CY,wCAAc"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Repository } from "typeorm";
|
|
2
2
|
import { Customer } from "../models/customer";
|
|
3
3
|
export declare class CustomerRepository extends Repository<Customer> {
|
|
4
|
-
listAndCount(query: any): Promise<[Customer[], number]>;
|
|
4
|
+
listAndCount(query: any, groups: any): Promise<[Customer[], number]>;
|
|
5
5
|
}
|
|
@@ -65,15 +65,13 @@ var CustomerRepository = /** @class */ (function (_super) {
|
|
|
65
65
|
function CustomerRepository() {
|
|
66
66
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
67
67
|
}
|
|
68
|
-
CustomerRepository.prototype.listAndCount = function (query) {
|
|
69
|
-
var _a
|
|
68
|
+
CustomerRepository.prototype.listAndCount = function (query, groups) {
|
|
69
|
+
var _a;
|
|
70
70
|
return __awaiter(this, void 0, void 0, function () {
|
|
71
|
-
var
|
|
72
|
-
return __generator(this, function (
|
|
73
|
-
switch (
|
|
71
|
+
var qb;
|
|
72
|
+
return __generator(this, function (_b) {
|
|
73
|
+
switch (_b.label) {
|
|
74
74
|
case 0:
|
|
75
|
-
groups = (_a = query === null || query === void 0 ? void 0 : query.where) === null || _a === void 0 ? void 0 : _a.groups;
|
|
76
|
-
(_b = query === null || query === void 0 ? void 0 : query.where) === null || _b === void 0 ? true : delete _b.groups;
|
|
77
75
|
qb = this.createQueryBuilder("customer")
|
|
78
76
|
.where(query.where)
|
|
79
77
|
.skip(query.skip)
|
|
@@ -83,13 +81,13 @@ var CustomerRepository = /** @class */ (function (_super) {
|
|
|
83
81
|
.leftJoinAndSelect("customer.groups", "group")
|
|
84
82
|
.andWhere("group.id IN (:...ids)", { ids: groups.value });
|
|
85
83
|
}
|
|
86
|
-
if ((
|
|
84
|
+
if ((_a = query.relations) === null || _a === void 0 ? void 0 : _a.length) {
|
|
87
85
|
query.relations.forEach(function (rel) {
|
|
88
86
|
qb = qb.leftJoinAndSelect("customer.".concat(rel), rel);
|
|
89
87
|
});
|
|
90
88
|
}
|
|
91
89
|
return [4 /*yield*/, qb.getManyAndCount()];
|
|
92
|
-
case 1: return [2 /*return*/,
|
|
90
|
+
case 1: return [2 /*return*/, _b.sent()];
|
|
93
91
|
}
|
|
94
92
|
});
|
|
95
93
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customer.js","sourceRoot":"","sources":["../../src/repositories/customer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAsD;AACtD,+CAA6C;AAG7C;IAAwC,sCAAoB;IAA5D;;
|
|
1
|
+
{"version":3,"file":"customer.js","sourceRoot":"","sources":["../../src/repositories/customer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAsD;AACtD,+CAA6C;AAG7C;IAAwC,sCAAoB;IAA5D;;IAqBA,CAAC;IApBO,yCAAY,GAAlB,UAAmB,KAAK,EAAE,MAAM;;;;;;;wBAC1B,EAAE,GAAG,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC;6BACzC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC;6BAClB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;6BAChB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;wBAEnB,IAAI,MAAM,EAAE;4BACV,EAAE,GAAG,EAAE;iCACJ,iBAAiB,CAAC,iBAAiB,EAAE,OAAO,CAAC;iCAC7C,QAAQ,CAAC,uBAAuB,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAA;yBAC5D;wBAED,IAAI,MAAA,KAAK,CAAC,SAAS,0CAAE,MAAM,EAAE;4BAC3B,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,UAAC,GAAG;gCAC1B,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,mBAAY,GAAG,CAAE,EAAE,GAAG,CAAC,CAAA;4BACnD,CAAC,CAAC,CAAA;yBACH;wBAEM,qBAAM,EAAE,CAAC,eAAe,EAAE,EAAA;4BAAjC,sBAAO,SAA0B,EAAA;;;;KAClC;IApBU,kBAAkB;QAD9B,IAAA,0BAAgB,EAAC,mBAAQ,CAAC;OACd,kBAAkB,CAqB9B;IAAD,yBAAC;CAAA,AArBD,CAAwC,oBAAU,GAqBjD;AArBY,gDAAkB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { DeleteResult, EntityTarget, Repository } from "typeorm";
|
|
2
|
+
import { DiscountCondition, DiscountConditionType } from "../models/discount-condition";
|
|
3
|
+
import { DiscountConditionCustomerGroup } from "../models/discount-condition-customer-group";
|
|
4
|
+
import { DiscountConditionProduct } from "../models/discount-condition-product";
|
|
5
|
+
import { DiscountConditionProductCollection } from "../models/discount-condition-product-collection";
|
|
6
|
+
import { DiscountConditionProductTag } from "../models/discount-condition-product-tag";
|
|
7
|
+
import { DiscountConditionProductType } from "../models/discount-condition-product-type";
|
|
8
|
+
export declare enum DiscountConditionJoinTableForeignKey {
|
|
9
|
+
PRODUCT_ID = "product_id",
|
|
10
|
+
PRODUCT_TYPE_ID = "product_type_id",
|
|
11
|
+
PRODUCT_COLLECTION_ID = "product_collection_id",
|
|
12
|
+
PRODUCT_TAG_ID = "product_tag_id",
|
|
13
|
+
CUSTOMER_GROUP_ID = "customer_group_id"
|
|
14
|
+
}
|
|
15
|
+
declare type DiscountConditionResourceType = EntityTarget<DiscountConditionProduct | DiscountConditionProductType | DiscountConditionProductCollection | DiscountConditionProductTag | DiscountConditionCustomerGroup>;
|
|
16
|
+
export declare class DiscountConditionRepository extends Repository<DiscountCondition> {
|
|
17
|
+
getJoinTableResourceIdentifiers(type: string): {
|
|
18
|
+
joinTable: string;
|
|
19
|
+
resourceKey: string;
|
|
20
|
+
joinTableForeignKey: DiscountConditionJoinTableForeignKey;
|
|
21
|
+
conditionTable: DiscountConditionResourceType;
|
|
22
|
+
joinTableKey: string;
|
|
23
|
+
};
|
|
24
|
+
removeConditionResources(id: string, type: DiscountConditionType, resourceIds: string[]): Promise<DeleteResult | void>;
|
|
25
|
+
addConditionResources(conditionId: string, resourceIds: string[], type: DiscountConditionType, overrideExisting?: boolean): Promise<(DiscountConditionProduct | DiscountConditionProductType | DiscountConditionProductCollection | DiscountConditionProductTag | DiscountConditionCustomerGroup)[]>;
|
|
26
|
+
queryConditionTable({ type, condId, resourceId }: {
|
|
27
|
+
type: any;
|
|
28
|
+
condId: any;
|
|
29
|
+
resourceId: any;
|
|
30
|
+
}): Promise<number>;
|
|
31
|
+
isValidForProduct(discountRuleId: string, productId: string): Promise<boolean>;
|
|
32
|
+
canApplyForCustomer(discountRuleId: string, customerId: string): Promise<boolean>;
|
|
33
|
+
}
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
+
};
|
|
23
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
24
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
25
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
26
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
27
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
28
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
29
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
33
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
34
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
35
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
36
|
+
function step(op) {
|
|
37
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
38
|
+
while (_) try {
|
|
39
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
40
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
41
|
+
switch (op[0]) {
|
|
42
|
+
case 0: case 1: t = op; break;
|
|
43
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
44
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
45
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
46
|
+
default:
|
|
47
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
48
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
49
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
50
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
51
|
+
if (t[2]) _.ops.pop();
|
|
52
|
+
_.trys.pop(); continue;
|
|
53
|
+
}
|
|
54
|
+
op = body.call(thisArg, _);
|
|
55
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
56
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
var __values = (this && this.__values) || function(o) {
|
|
60
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
61
|
+
if (m) return m.call(o);
|
|
62
|
+
if (o && typeof o.length === "number") return {
|
|
63
|
+
next: function () {
|
|
64
|
+
if (o && i >= o.length) o = void 0;
|
|
65
|
+
return { value: o && o[i++], done: !o };
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
69
|
+
};
|
|
70
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
71
|
+
exports.DiscountConditionRepository = exports.DiscountConditionJoinTableForeignKey = void 0;
|
|
72
|
+
var typeorm_1 = require("typeorm");
|
|
73
|
+
var discount_condition_1 = require("../models/discount-condition");
|
|
74
|
+
var discount_condition_customer_group_1 = require("../models/discount-condition-customer-group");
|
|
75
|
+
var discount_condition_product_1 = require("../models/discount-condition-product");
|
|
76
|
+
var discount_condition_product_collection_1 = require("../models/discount-condition-product-collection");
|
|
77
|
+
var discount_condition_product_tag_1 = require("../models/discount-condition-product-tag");
|
|
78
|
+
var discount_condition_product_type_1 = require("../models/discount-condition-product-type");
|
|
79
|
+
var DiscountConditionJoinTableForeignKey;
|
|
80
|
+
(function (DiscountConditionJoinTableForeignKey) {
|
|
81
|
+
DiscountConditionJoinTableForeignKey["PRODUCT_ID"] = "product_id";
|
|
82
|
+
DiscountConditionJoinTableForeignKey["PRODUCT_TYPE_ID"] = "product_type_id";
|
|
83
|
+
DiscountConditionJoinTableForeignKey["PRODUCT_COLLECTION_ID"] = "product_collection_id";
|
|
84
|
+
DiscountConditionJoinTableForeignKey["PRODUCT_TAG_ID"] = "product_tag_id";
|
|
85
|
+
DiscountConditionJoinTableForeignKey["CUSTOMER_GROUP_ID"] = "customer_group_id";
|
|
86
|
+
})(DiscountConditionJoinTableForeignKey = exports.DiscountConditionJoinTableForeignKey || (exports.DiscountConditionJoinTableForeignKey = {}));
|
|
87
|
+
var DiscountConditionRepository = /** @class */ (function (_super) {
|
|
88
|
+
__extends(DiscountConditionRepository, _super);
|
|
89
|
+
function DiscountConditionRepository() {
|
|
90
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
91
|
+
}
|
|
92
|
+
DiscountConditionRepository.prototype.getJoinTableResourceIdentifiers = function (type) {
|
|
93
|
+
var conditionTable = discount_condition_product_1.DiscountConditionProduct;
|
|
94
|
+
var joinTable = "product";
|
|
95
|
+
var joinTableForeignKey = DiscountConditionJoinTableForeignKey.PRODUCT_ID;
|
|
96
|
+
var joinTableKey = "id";
|
|
97
|
+
// On the joined table (e.g. `product`), what key should be match on
|
|
98
|
+
// (e.g `type_id` for product types and `id` for products)
|
|
99
|
+
var resourceKey;
|
|
100
|
+
switch (type) {
|
|
101
|
+
case discount_condition_1.DiscountConditionType.PRODUCTS: {
|
|
102
|
+
resourceKey = "id";
|
|
103
|
+
joinTableForeignKey = DiscountConditionJoinTableForeignKey.PRODUCT_ID;
|
|
104
|
+
joinTable = "product";
|
|
105
|
+
conditionTable = discount_condition_product_1.DiscountConditionProduct;
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
case discount_condition_1.DiscountConditionType.PRODUCT_TYPES: {
|
|
109
|
+
resourceKey = "type_id";
|
|
110
|
+
joinTableForeignKey =
|
|
111
|
+
DiscountConditionJoinTableForeignKey.PRODUCT_TYPE_ID;
|
|
112
|
+
joinTable = "product";
|
|
113
|
+
conditionTable = discount_condition_product_type_1.DiscountConditionProductType;
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
case discount_condition_1.DiscountConditionType.PRODUCT_COLLECTIONS: {
|
|
117
|
+
resourceKey = "collection_id";
|
|
118
|
+
joinTableForeignKey =
|
|
119
|
+
DiscountConditionJoinTableForeignKey.PRODUCT_COLLECTION_ID;
|
|
120
|
+
joinTable = "product";
|
|
121
|
+
conditionTable = discount_condition_product_collection_1.DiscountConditionProductCollection;
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
case discount_condition_1.DiscountConditionType.PRODUCT_TAGS: {
|
|
125
|
+
joinTableKey = "product_id";
|
|
126
|
+
resourceKey = "product_tag_id";
|
|
127
|
+
joinTableForeignKey =
|
|
128
|
+
DiscountConditionJoinTableForeignKey.PRODUCT_TAG_ID;
|
|
129
|
+
joinTable = "product_tags";
|
|
130
|
+
conditionTable = discount_condition_product_tag_1.DiscountConditionProductTag;
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
case discount_condition_1.DiscountConditionType.CUSTOMER_GROUPS: {
|
|
134
|
+
joinTableKey = "customer_id";
|
|
135
|
+
resourceKey = "customer_group_id";
|
|
136
|
+
joinTable = "customer_group_customers";
|
|
137
|
+
joinTableForeignKey =
|
|
138
|
+
DiscountConditionJoinTableForeignKey.CUSTOMER_GROUP_ID;
|
|
139
|
+
conditionTable = discount_condition_customer_group_1.DiscountConditionCustomerGroup;
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
default:
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
return {
|
|
146
|
+
joinTable: joinTable,
|
|
147
|
+
joinTableKey: joinTableKey,
|
|
148
|
+
resourceKey: resourceKey,
|
|
149
|
+
joinTableForeignKey: joinTableForeignKey,
|
|
150
|
+
conditionTable: conditionTable,
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
DiscountConditionRepository.prototype.removeConditionResources = function (id, type, resourceIds) {
|
|
154
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
155
|
+
var _a, conditionTable, joinTableForeignKey;
|
|
156
|
+
var _b;
|
|
157
|
+
return __generator(this, function (_c) {
|
|
158
|
+
switch (_c.label) {
|
|
159
|
+
case 0:
|
|
160
|
+
_a = this.getJoinTableResourceIdentifiers(type), conditionTable = _a.conditionTable, joinTableForeignKey = _a.joinTableForeignKey;
|
|
161
|
+
if (!conditionTable || !joinTableForeignKey) {
|
|
162
|
+
return [2 /*return*/, Promise.resolve()];
|
|
163
|
+
}
|
|
164
|
+
return [4 /*yield*/, this.createQueryBuilder()
|
|
165
|
+
.delete()
|
|
166
|
+
.from(conditionTable)
|
|
167
|
+
.where((_b = { condition_id: id }, _b[joinTableForeignKey] = (0, typeorm_1.In)(resourceIds), _b))
|
|
168
|
+
.execute()];
|
|
169
|
+
case 1: return [2 /*return*/, _c.sent()];
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
};
|
|
174
|
+
DiscountConditionRepository.prototype.addConditionResources = function (conditionId, resourceIds, type, overrideExisting) {
|
|
175
|
+
if (overrideExisting === void 0) { overrideExisting = false; }
|
|
176
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
177
|
+
var toInsert, _a, conditionTable, joinTableForeignKey, insertResult;
|
|
178
|
+
var _b;
|
|
179
|
+
return __generator(this, function (_c) {
|
|
180
|
+
switch (_c.label) {
|
|
181
|
+
case 0:
|
|
182
|
+
toInsert = [];
|
|
183
|
+
_a = this.getJoinTableResourceIdentifiers(type), conditionTable = _a.conditionTable, joinTableForeignKey = _a.joinTableForeignKey;
|
|
184
|
+
if (!conditionTable || !joinTableForeignKey) {
|
|
185
|
+
return [2 /*return*/, Promise.resolve([])];
|
|
186
|
+
}
|
|
187
|
+
toInsert = resourceIds.map(function (rId) {
|
|
188
|
+
var _a;
|
|
189
|
+
return (_a = {
|
|
190
|
+
condition_id: conditionId
|
|
191
|
+
},
|
|
192
|
+
_a[joinTableForeignKey] = rId,
|
|
193
|
+
_a);
|
|
194
|
+
});
|
|
195
|
+
return [4 /*yield*/, this.createQueryBuilder()
|
|
196
|
+
.insert()
|
|
197
|
+
.orIgnore(true)
|
|
198
|
+
.into(conditionTable)
|
|
199
|
+
.values(toInsert)
|
|
200
|
+
.execute()];
|
|
201
|
+
case 1:
|
|
202
|
+
insertResult = _c.sent();
|
|
203
|
+
if (!overrideExisting) return [3 /*break*/, 3];
|
|
204
|
+
return [4 /*yield*/, this.createQueryBuilder()
|
|
205
|
+
.delete()
|
|
206
|
+
.from(conditionTable)
|
|
207
|
+
.where((_b = {
|
|
208
|
+
condition_id: conditionId
|
|
209
|
+
},
|
|
210
|
+
_b[joinTableForeignKey] = (0, typeorm_1.Not)((0, typeorm_1.In)(resourceIds)),
|
|
211
|
+
_b))
|
|
212
|
+
.execute()];
|
|
213
|
+
case 2:
|
|
214
|
+
_c.sent();
|
|
215
|
+
_c.label = 3;
|
|
216
|
+
case 3: return [4 /*yield*/, this.manager
|
|
217
|
+
.createQueryBuilder(conditionTable, "discon")
|
|
218
|
+
.select()
|
|
219
|
+
.where(insertResult.identifiers)
|
|
220
|
+
.getMany()];
|
|
221
|
+
case 4: return [2 /*return*/, _c.sent()];
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
};
|
|
226
|
+
DiscountConditionRepository.prototype.queryConditionTable = function (_a) {
|
|
227
|
+
var type = _a.type, condId = _a.condId, resourceId = _a.resourceId;
|
|
228
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
229
|
+
var _b, conditionTable, joinTable, joinTableForeignKey, resourceKey, joinTableKey;
|
|
230
|
+
return __generator(this, function (_c) {
|
|
231
|
+
switch (_c.label) {
|
|
232
|
+
case 0:
|
|
233
|
+
_b = this.getJoinTableResourceIdentifiers(type), conditionTable = _b.conditionTable, joinTable = _b.joinTable, joinTableForeignKey = _b.joinTableForeignKey, resourceKey = _b.resourceKey, joinTableKey = _b.joinTableKey;
|
|
234
|
+
return [4 /*yield*/, this.manager
|
|
235
|
+
.createQueryBuilder(conditionTable, "dc")
|
|
236
|
+
.innerJoin(joinTable, "resource", "dc.".concat(joinTableForeignKey, " = resource.").concat(resourceKey, " and resource.").concat(joinTableKey, " = :resourceId "), {
|
|
237
|
+
resourceId: resourceId,
|
|
238
|
+
})
|
|
239
|
+
.where("dc.condition_id = :conditionId", {
|
|
240
|
+
conditionId: condId,
|
|
241
|
+
})
|
|
242
|
+
.getCount()];
|
|
243
|
+
case 1: return [2 /*return*/, _c.sent()];
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
});
|
|
247
|
+
};
|
|
248
|
+
DiscountConditionRepository.prototype.isValidForProduct = function (discountRuleId, productId) {
|
|
249
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
250
|
+
var discountConditions, discountConditions_1, discountConditions_1_1, condition, numConditions, e_1_1;
|
|
251
|
+
var e_1, _a;
|
|
252
|
+
return __generator(this, function (_b) {
|
|
253
|
+
switch (_b.label) {
|
|
254
|
+
case 0: return [4 /*yield*/, this.createQueryBuilder("discon")
|
|
255
|
+
.select(["discon.id", "discon.type", "discon.operator"])
|
|
256
|
+
.where("discon.discount_rule_id = :discountRuleId", {
|
|
257
|
+
discountRuleId: discountRuleId,
|
|
258
|
+
})
|
|
259
|
+
.getMany()
|
|
260
|
+
// in case of no discount conditions, we assume that the discount
|
|
261
|
+
// is valid for all
|
|
262
|
+
];
|
|
263
|
+
case 1:
|
|
264
|
+
discountConditions = _b.sent();
|
|
265
|
+
// in case of no discount conditions, we assume that the discount
|
|
266
|
+
// is valid for all
|
|
267
|
+
if (!discountConditions.length) {
|
|
268
|
+
return [2 /*return*/, true];
|
|
269
|
+
}
|
|
270
|
+
_b.label = 2;
|
|
271
|
+
case 2:
|
|
272
|
+
_b.trys.push([2, 7, 8, 9]);
|
|
273
|
+
discountConditions_1 = __values(discountConditions), discountConditions_1_1 = discountConditions_1.next();
|
|
274
|
+
_b.label = 3;
|
|
275
|
+
case 3:
|
|
276
|
+
if (!!discountConditions_1_1.done) return [3 /*break*/, 6];
|
|
277
|
+
condition = discountConditions_1_1.value;
|
|
278
|
+
return [4 /*yield*/, this.queryConditionTable({
|
|
279
|
+
type: condition.type,
|
|
280
|
+
condId: condition.id,
|
|
281
|
+
resourceId: productId,
|
|
282
|
+
})];
|
|
283
|
+
case 4:
|
|
284
|
+
numConditions = _b.sent();
|
|
285
|
+
if (condition.operator === discount_condition_1.DiscountConditionOperator.IN &&
|
|
286
|
+
numConditions === 0) {
|
|
287
|
+
return [2 /*return*/, false];
|
|
288
|
+
}
|
|
289
|
+
if (condition.operator === discount_condition_1.DiscountConditionOperator.NOT_IN &&
|
|
290
|
+
numConditions > 0) {
|
|
291
|
+
return [2 /*return*/, false];
|
|
292
|
+
}
|
|
293
|
+
_b.label = 5;
|
|
294
|
+
case 5:
|
|
295
|
+
discountConditions_1_1 = discountConditions_1.next();
|
|
296
|
+
return [3 /*break*/, 3];
|
|
297
|
+
case 6: return [3 /*break*/, 9];
|
|
298
|
+
case 7:
|
|
299
|
+
e_1_1 = _b.sent();
|
|
300
|
+
e_1 = { error: e_1_1 };
|
|
301
|
+
return [3 /*break*/, 9];
|
|
302
|
+
case 8:
|
|
303
|
+
try {
|
|
304
|
+
if (discountConditions_1_1 && !discountConditions_1_1.done && (_a = discountConditions_1.return)) _a.call(discountConditions_1);
|
|
305
|
+
}
|
|
306
|
+
finally { if (e_1) throw e_1.error; }
|
|
307
|
+
return [7 /*endfinally*/];
|
|
308
|
+
case 9: return [2 /*return*/, true];
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
});
|
|
312
|
+
};
|
|
313
|
+
DiscountConditionRepository.prototype.canApplyForCustomer = function (discountRuleId, customerId) {
|
|
314
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
315
|
+
var discountConditions, discountConditions_2, discountConditions_2_1, condition, numConditions, e_2_1;
|
|
316
|
+
var e_2, _a;
|
|
317
|
+
return __generator(this, function (_b) {
|
|
318
|
+
switch (_b.label) {
|
|
319
|
+
case 0: return [4 /*yield*/, this.createQueryBuilder("discon")
|
|
320
|
+
.select(["discon.id", "discon.type", "discon.operator"])
|
|
321
|
+
.where("discon.discount_rule_id = :discountRuleId", {
|
|
322
|
+
discountRuleId: discountRuleId,
|
|
323
|
+
})
|
|
324
|
+
.getMany()
|
|
325
|
+
// in case of no discount conditions, we assume that the discount
|
|
326
|
+
// is valid for all
|
|
327
|
+
];
|
|
328
|
+
case 1:
|
|
329
|
+
discountConditions = _b.sent();
|
|
330
|
+
// in case of no discount conditions, we assume that the discount
|
|
331
|
+
// is valid for all
|
|
332
|
+
if (!discountConditions.length) {
|
|
333
|
+
return [2 /*return*/, true];
|
|
334
|
+
}
|
|
335
|
+
_b.label = 2;
|
|
336
|
+
case 2:
|
|
337
|
+
_b.trys.push([2, 7, 8, 9]);
|
|
338
|
+
discountConditions_2 = __values(discountConditions), discountConditions_2_1 = discountConditions_2.next();
|
|
339
|
+
_b.label = 3;
|
|
340
|
+
case 3:
|
|
341
|
+
if (!!discountConditions_2_1.done) return [3 /*break*/, 6];
|
|
342
|
+
condition = discountConditions_2_1.value;
|
|
343
|
+
return [4 /*yield*/, this.queryConditionTable({
|
|
344
|
+
type: "customer_groups",
|
|
345
|
+
condId: condition.id,
|
|
346
|
+
resourceId: customerId,
|
|
347
|
+
})];
|
|
348
|
+
case 4:
|
|
349
|
+
numConditions = _b.sent();
|
|
350
|
+
if (condition.operator === discount_condition_1.DiscountConditionOperator.IN &&
|
|
351
|
+
numConditions === 0) {
|
|
352
|
+
return [2 /*return*/, false];
|
|
353
|
+
}
|
|
354
|
+
if (condition.operator === discount_condition_1.DiscountConditionOperator.NOT_IN &&
|
|
355
|
+
numConditions > 0) {
|
|
356
|
+
return [2 /*return*/, false];
|
|
357
|
+
}
|
|
358
|
+
_b.label = 5;
|
|
359
|
+
case 5:
|
|
360
|
+
discountConditions_2_1 = discountConditions_2.next();
|
|
361
|
+
return [3 /*break*/, 3];
|
|
362
|
+
case 6: return [3 /*break*/, 9];
|
|
363
|
+
case 7:
|
|
364
|
+
e_2_1 = _b.sent();
|
|
365
|
+
e_2 = { error: e_2_1 };
|
|
366
|
+
return [3 /*break*/, 9];
|
|
367
|
+
case 8:
|
|
368
|
+
try {
|
|
369
|
+
if (discountConditions_2_1 && !discountConditions_2_1.done && (_a = discountConditions_2.return)) _a.call(discountConditions_2);
|
|
370
|
+
}
|
|
371
|
+
finally { if (e_2) throw e_2.error; }
|
|
372
|
+
return [7 /*endfinally*/];
|
|
373
|
+
case 9: return [2 /*return*/, true];
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
});
|
|
377
|
+
};
|
|
378
|
+
DiscountConditionRepository = __decorate([
|
|
379
|
+
(0, typeorm_1.EntityRepository)(discount_condition_1.DiscountCondition)
|
|
380
|
+
], DiscountConditionRepository);
|
|
381
|
+
return DiscountConditionRepository;
|
|
382
|
+
}(typeorm_1.Repository));
|
|
383
|
+
exports.DiscountConditionRepository = DiscountConditionRepository;
|
|
384
|
+
//# sourceMappingURL=discount-condition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discount-condition.js","sourceRoot":"","sources":["../../src/repositories/discount-condition.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAOgB;AAChB,mEAIqC;AACrC,iGAA4F;AAC5F,mFAA+E;AAC/E,yGAAoG;AACpG,2FAAsF;AACtF,6FAAwF;AAExF,IAAY,oCAMX;AAND,WAAY,oCAAoC;IAC9C,iEAAyB,CAAA;IACzB,2EAAmC,CAAA;IACnC,uFAA+C,CAAA;IAC/C,yEAAiC,CAAA;IACjC,+EAAuC,CAAA;AACzC,CAAC,EANW,oCAAoC,GAApC,4CAAoC,KAApC,4CAAoC,QAM/C;AAWD;IAAiD,+CAA6B;IAA9E;;IA4QA,CAAC;IA3QC,qEAA+B,GAA/B,UAAgC,IAAY;QAO1C,IAAI,cAAc,GAAkC,qDAAwB,CAAA;QAE5E,IAAI,SAAS,GAAG,SAAS,CAAA;QACzB,IAAI,mBAAmB,GACrB,oCAAoC,CAAC,UAAU,CAAA;QACjD,IAAI,YAAY,GAAG,IAAI,CAAA;QAEvB,oEAAoE;QACpE,0DAA0D;QAC1D,IAAI,WAAW,CAAA;QAEf,QAAQ,IAAI,EAAE;YACZ,KAAK,0CAAqB,CAAC,QAAQ,CAAC,CAAC;gBACnC,WAAW,GAAG,IAAI,CAAA;gBAClB,mBAAmB,GAAG,oCAAoC,CAAC,UAAU,CAAA;gBACrE,SAAS,GAAG,SAAS,CAAA;gBAErB,cAAc,GAAG,qDAAwB,CAAA;gBACzC,MAAK;aACN;YACD,KAAK,0CAAqB,CAAC,aAAa,CAAC,CAAC;gBACxC,WAAW,GAAG,SAAS,CAAA;gBACvB,mBAAmB;oBACjB,oCAAoC,CAAC,eAAe,CAAA;gBACtD,SAAS,GAAG,SAAS,CAAA;gBAErB,cAAc,GAAG,8D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