@unchainedshop/api 3.1.7 → 3.1.9
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/lib/express/index.d.ts.map +1 -1
- package/lib/express/index.js +1 -0
- package/lib/express/index.js.map +1 -1
- package/lib/loaders/assortmentLinkLoader.d.ts +12 -0
- package/lib/loaders/assortmentLinkLoader.d.ts.map +1 -0
- package/lib/loaders/assortmentLinkLoader.js +23 -0
- package/lib/loaders/assortmentLinkLoader.js.map +1 -0
- package/lib/loaders/assortmentLinksLoader.d.ts +14 -0
- package/lib/loaders/assortmentLinksLoader.d.ts.map +1 -0
- package/lib/loaders/assortmentLinksLoader.js +38 -0
- package/lib/loaders/assortmentLinksLoader.js.map +1 -0
- package/lib/loaders/assortmentLoader.d.ts +10 -0
- package/lib/loaders/assortmentLoader.d.ts.map +1 -0
- package/lib/loaders/assortmentLoader.js +15 -0
- package/lib/loaders/assortmentLoader.js.map +1 -0
- package/lib/loaders/assortmentMediaTextLoader.d.ts +12 -0
- package/lib/loaders/assortmentMediaTextLoader.d.ts.map +1 -0
- package/lib/loaders/assortmentMediaTextLoader.js +20 -0
- package/lib/loaders/assortmentMediaTextLoader.js.map +1 -0
- package/lib/loaders/assortmentMediasLoader.d.ts +10 -0
- package/lib/loaders/assortmentMediasLoader.d.ts.map +1 -0
- package/lib/loaders/assortmentMediasLoader.js +18 -0
- package/lib/loaders/assortmentMediasLoader.js.map +1 -0
- package/lib/loaders/assortmentProductLoader.d.ts +12 -0
- package/lib/loaders/assortmentProductLoader.d.ts.map +1 -0
- package/lib/loaders/assortmentProductLoader.js +14 -0
- package/lib/loaders/assortmentProductLoader.js.map +1 -0
- package/lib/loaders/assortmentProductsLoader.d.ts +10 -0
- package/lib/loaders/assortmentProductsLoader.d.ts.map +1 -0
- package/lib/loaders/assortmentProductsLoader.js +18 -0
- package/lib/loaders/assortmentProductsLoader.js.map +1 -0
- package/lib/loaders/assortmentTextLoader.d.ts +12 -0
- package/lib/loaders/assortmentTextLoader.d.ts.map +1 -0
- package/lib/loaders/assortmentTextLoader.js +20 -0
- package/lib/loaders/assortmentTextLoader.js.map +1 -0
- package/lib/loaders/buildTextMap.d.ts +6 -0
- package/lib/loaders/buildTextMap.d.ts.map +1 -0
- package/lib/loaders/buildTextMap.js +16 -0
- package/lib/loaders/buildTextMap.js.map +1 -0
- package/lib/loaders/countryLoader.d.ts +10 -0
- package/lib/loaders/countryLoader.d.ts.map +1 -0
- package/lib/loaders/countryLoader.js +14 -0
- package/lib/loaders/countryLoader.js.map +1 -0
- package/lib/loaders/currencyLoader copy.d.ts +10 -0
- package/lib/loaders/currencyLoader copy.d.ts.map +1 -0
- package/lib/loaders/currencyLoader copy.js +14 -0
- package/lib/loaders/currencyLoader copy.js.map +1 -0
- package/lib/loaders/currencyLoader.d.ts +10 -0
- package/lib/loaders/currencyLoader.d.ts.map +1 -0
- package/lib/loaders/currencyLoader.js +14 -0
- package/lib/loaders/currencyLoader.js.map +1 -0
- package/lib/loaders/currencyLoaderByIsoCode.d.ts +10 -0
- package/lib/loaders/currencyLoaderByIsoCode.d.ts.map +1 -0
- package/lib/loaders/currencyLoaderByIsoCode.js +13 -0
- package/lib/loaders/currencyLoaderByIsoCode.js.map +1 -0
- package/lib/loaders/fileLoader.d.ts +10 -0
- package/lib/loaders/fileLoader.d.ts.map +1 -0
- package/lib/loaders/fileLoader.js +13 -0
- package/lib/loaders/fileLoader.js.map +1 -0
- package/lib/loaders/filterLoader.d.ts +10 -0
- package/lib/loaders/filterLoader.d.ts.map +1 -0
- package/lib/loaders/filterLoader.js +14 -0
- package/lib/loaders/filterLoader.js.map +1 -0
- package/lib/loaders/filterTextLoader.d.ts +14 -0
- package/lib/loaders/filterTextLoader.d.ts.map +1 -0
- package/lib/loaders/filterTextLoader.js +20 -0
- package/lib/loaders/filterTextLoader.js.map +1 -0
- package/lib/loaders/index.d.ts.map +1 -1
- package/lib/loaders/index.js +6 -35
- package/lib/loaders/index.js.map +1 -1
- package/lib/loaders/productLoader.d.ts +10 -0
- package/lib/loaders/productLoader.d.ts.map +1 -0
- package/lib/loaders/productLoader.js +16 -0
- package/lib/loaders/productLoader.js.map +1 -0
- package/lib/loaders/productLoaderBySKU.d.ts +10 -0
- package/lib/loaders/productLoaderBySKU.d.ts.map +1 -0
- package/lib/loaders/productLoaderBySKU.js +16 -0
- package/lib/loaders/productLoaderBySKU.js.map +1 -0
- package/lib/loaders/productMediaTextLoader.d.ts +12 -0
- package/lib/loaders/productMediaTextLoader.d.ts.map +1 -0
- package/lib/loaders/productMediaTextLoader.js +20 -0
- package/lib/loaders/productMediaTextLoader.js.map +1 -0
- package/lib/loaders/productMediasLoader.d.ts +10 -0
- package/lib/loaders/productMediasLoader.d.ts.map +1 -0
- package/lib/loaders/productMediasLoader.js +18 -0
- package/lib/loaders/productMediasLoader.js.map +1 -0
- package/lib/loaders/productTextLoader.d.ts +12 -0
- package/lib/loaders/productTextLoader.d.ts.map +1 -0
- package/lib/loaders/productTextLoader.js +20 -0
- package/lib/loaders/productTextLoader.js.map +1 -0
- package/lib/loaders/userLoader copy.d.ts +10 -0
- package/lib/loaders/userLoader copy.d.ts.map +1 -0
- package/lib/loaders/userLoader copy.js +13 -0
- package/lib/loaders/userLoader copy.js.map +1 -0
- package/lib/loaders/userLoader.d.ts +10 -0
- package/lib/loaders/userLoader.d.ts.map +1 -0
- package/lib/loaders/userLoader.js +13 -0
- package/lib/loaders/userLoader.js.map +1 -0
- package/lib/loaders/utils.d.ts +7 -0
- package/lib/loaders/utils.d.ts.map +1 -0
- package/lib/loaders/utils.js +30 -0
- package/lib/loaders/utils.js.map +1 -0
- package/lib/resolvers/type/assortment/assortment-types.d.ts +1 -1
- package/lib/resolvers/type/assortment/assortment-types.d.ts.map +1 -1
- package/lib/resolvers/type/assortment/assortment-types.js +1 -1
- package/lib/resolvers/type/assortment/assortment-types.js.map +1 -1
- package/lib/resolvers/type/bookmark-types.d.ts.map +1 -1
- package/lib/resolvers/type/bookmark-types.js +1 -0
- package/lib/resolvers/type/bookmark-types.js.map +1 -1
- package/lib/resolvers/type/country-types.d.ts.map +1 -1
- package/lib/resolvers/type/country-types.js +1 -0
- package/lib/resolvers/type/country-types.js.map +1 -1
- package/lib/resolvers/type/delivery-provider-types.d.ts.map +1 -1
- package/lib/resolvers/type/delivery-provider-types.js +1 -0
- package/lib/resolvers/type/delivery-provider-types.js.map +1 -1
- package/lib/resolvers/type/enrollment/enrollment-delivery-types.d.ts.map +1 -1
- package/lib/resolvers/type/enrollment/enrollment-delivery-types.js +1 -0
- package/lib/resolvers/type/enrollment/enrollment-delivery-types.js.map +1 -1
- package/lib/resolvers/type/enrollment/enrollment-payment-types.d.ts.map +1 -1
- package/lib/resolvers/type/enrollment/enrollment-payment-types.js +1 -0
- package/lib/resolvers/type/enrollment/enrollment-payment-types.js.map +1 -1
- package/lib/resolvers/type/enrollment/enrollment-period-types.d.ts.map +1 -1
- package/lib/resolvers/type/enrollment/enrollment-period-types.js +1 -0
- package/lib/resolvers/type/enrollment/enrollment-period-types.js.map +1 -1
- package/lib/resolvers/type/enrollment/enrollment-types.d.ts.map +1 -1
- package/lib/resolvers/type/enrollment/enrollment-types.js +3 -0
- package/lib/resolvers/type/enrollment/enrollment-types.js.map +1 -1
- package/lib/resolvers/type/index.d.ts +1 -1
- package/lib/resolvers/type/index.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-delivery-discount-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-delivery-discount-types.js +1 -0
- package/lib/resolvers/type/order/order-delivery-discount-types.js.map +1 -1
- package/lib/resolvers/type/order/order-delivery-pickup-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-delivery-pickup-types.js +3 -0
- package/lib/resolvers/type/order/order-delivery-pickup-types.js.map +1 -1
- package/lib/resolvers/type/order/order-delivery-shipping-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-delivery-shipping-types.js +2 -0
- package/lib/resolvers/type/order/order-delivery-shipping-types.js.map +1 -1
- package/lib/resolvers/type/order/order-delivery-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-delivery-types.js +1 -0
- package/lib/resolvers/type/order/order-delivery-types.js.map +1 -1
- package/lib/resolvers/type/order/order-discount-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-discount-types.js +3 -0
- package/lib/resolvers/type/order/order-discount-types.js.map +1 -1
- package/lib/resolvers/type/order/order-global-discount-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-global-discount-types.js +1 -0
- package/lib/resolvers/type/order/order-global-discount-types.js.map +1 -1
- package/lib/resolvers/type/order/order-item-discount-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-item-discount-types.js +1 -0
- package/lib/resolvers/type/order/order-item-discount-types.js.map +1 -1
- package/lib/resolvers/type/order/order-item-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-item-types.js +8 -0
- package/lib/resolvers/type/order/order-item-types.js.map +1 -1
- package/lib/resolvers/type/order/order-payment-card-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-payment-card-types.js +2 -0
- package/lib/resolvers/type/order/order-payment-card-types.js.map +1 -1
- package/lib/resolvers/type/order/order-payment-discount-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-payment-discount-types.js +3 -1
- package/lib/resolvers/type/order/order-payment-discount-types.js.map +1 -1
- package/lib/resolvers/type/order/order-payment-generic-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-payment-generic-types.js +2 -0
- package/lib/resolvers/type/order/order-payment-generic-types.js.map +1 -1
- package/lib/resolvers/type/order/order-payment-invoice-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-payment-invoice-types.js +2 -0
- package/lib/resolvers/type/order/order-payment-invoice-types.js.map +1 -1
- package/lib/resolvers/type/order/order-payment-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-payment-types.js +1 -0
- package/lib/resolvers/type/order/order-payment-types.js.map +1 -1
- package/lib/resolvers/type/order/order-types.d.ts.map +1 -1
- package/lib/resolvers/type/order/order-types.js +8 -0
- package/lib/resolvers/type/order/order-types.js.map +1 -1
- package/lib/resolvers/type/payment/payment-credentials-types.d.ts.map +1 -1
- package/lib/resolvers/type/payment/payment-credentials-types.js +3 -0
- package/lib/resolvers/type/payment/payment-credentials-types.js.map +1 -1
- package/lib/resolvers/type/payment/payment-provider-types.d.ts.map +1 -1
- package/lib/resolvers/type/payment/payment-provider-types.js +1 -0
- package/lib/resolvers/type/payment/payment-provider-types.js.map +1 -1
- package/lib/resolvers/type/product/product-bundle-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-catalog-price-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-catalog-price-types.js +2 -0
- package/lib/resolvers/type/product/product-catalog-price-types.js.map +1 -1
- package/lib/resolvers/type/product/product-configurable-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-configurable-types.js +1 -0
- package/lib/resolvers/type/product/product-configurable-types.js.map +1 -1
- package/lib/resolvers/type/product/product-plan-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-review-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-review-types.js +1 -0
- package/lib/resolvers/type/product/product-review-types.js.map +1 -1
- package/lib/resolvers/type/product/product-simple-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-simple-types.js +2 -0
- package/lib/resolvers/type/product/product-simple-types.js.map +1 -1
- package/lib/resolvers/type/product/product-tokenized-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-tokenized-types.js +2 -0
- package/lib/resolvers/type/product/product-tokenized-types.js.map +1 -1
- package/lib/resolvers/type/product/product-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-types.js +2 -0
- package/lib/resolvers/type/product/product-types.js.map +1 -1
- package/lib/resolvers/type/product/product-variation-assignment-vector.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-variation-assignment-vector.js +2 -0
- package/lib/resolvers/type/product/product-variation-assignment-vector.js.map +1 -1
- package/lib/resolvers/type/product/product-variation-option-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-variation-option-types.js +1 -0
- package/lib/resolvers/type/product/product-variation-option-types.js.map +1 -1
- package/lib/resolvers/type/product/product-variation-types.d.ts.map +1 -1
- package/lib/resolvers/type/product/product-variation-types.js +1 -0
- package/lib/resolvers/type/product/product-variation-types.js.map +1 -1
- package/lib/resolvers/type/product-search-result-types.d.ts.map +1 -1
- package/lib/resolvers/type/quotation-types.d.ts.map +1 -1
- package/lib/resolvers/type/quotation-types.js +3 -0
- package/lib/resolvers/type/quotation-types.js.map +1 -1
- package/lib/resolvers/type/shop-types.d.ts.map +1 -1
- package/lib/resolvers/type/shop-types.js +2 -0
- package/lib/resolvers/type/shop-types.js.map +1 -1
- package/lib/resolvers/type/token-types.d.ts.map +1 -1
- package/lib/resolvers/type/token-types.js +7 -0
- package/lib/resolvers/type/token-types.js.map +1 -1
- package/lib/resolvers/type/user-types.d.ts.map +1 -1
- package/lib/resolvers/type/user-types.js +9 -0
- package/lib/resolvers/type/user-types.js.map +1 -1
- package/lib/resolvers/type/work-types.d.ts.map +1 -1
- package/lib/resolvers/type/work-types.js +1 -0
- package/lib/resolvers/type/work-types.js.map +1 -1
- package/package.json +1 -1
- package/src/express/index.ts +1 -0
- package/src/loaders/buildTextMap.ts +19 -0
- package/src/loaders/index.ts +6 -40
- package/src/resolvers/type/assortment/assortment-types.ts +1 -1
- package/src/resolvers/type/bookmark-types.ts +1 -0
- package/src/resolvers/type/country-types.ts +1 -0
- package/src/resolvers/type/delivery-provider-types.ts +2 -0
- package/src/resolvers/type/enrollment/enrollment-delivery-types.ts +1 -0
- package/src/resolvers/type/enrollment/enrollment-payment-types.ts +1 -0
- package/src/resolvers/type/enrollment/enrollment-period-types.ts +1 -0
- package/src/resolvers/type/enrollment/enrollment-types.ts +3 -0
- package/src/resolvers/type/order/order-delivery-discount-types.ts +1 -0
- package/src/resolvers/type/order/order-delivery-pickup-types.ts +3 -0
- package/src/resolvers/type/order/order-delivery-shipping-types.ts +2 -0
- package/src/resolvers/type/order/order-delivery-types.ts +1 -0
- package/src/resolvers/type/order/order-discount-types.ts +3 -0
- package/src/resolvers/type/order/order-global-discount-types.ts +1 -0
- package/src/resolvers/type/order/order-item-discount-types.ts +1 -0
- package/src/resolvers/type/order/order-item-types.ts +9 -0
- package/src/resolvers/type/order/order-payment-card-types.ts +3 -0
- package/src/resolvers/type/order/order-payment-discount-types.ts +1 -0
- package/src/resolvers/type/order/order-payment-generic-types.ts +2 -0
- package/src/resolvers/type/order/order-payment-invoice-types.ts +2 -0
- package/src/resolvers/type/order/order-payment-types.ts +1 -0
- package/src/resolvers/type/order/order-types.ts +8 -0
- package/src/resolvers/type/payment/payment-credentials-types.ts +3 -0
- package/src/resolvers/type/payment/payment-provider-types.ts +2 -0
- package/src/resolvers/type/product/product-catalog-price-types.ts +2 -0
- package/src/resolvers/type/product/product-configurable-types.ts +1 -0
- package/src/resolvers/type/product/product-review-types.ts +1 -0
- package/src/resolvers/type/product/product-simple-types.ts +2 -0
- package/src/resolvers/type/product/product-tokenized-types.ts +2 -0
- package/src/resolvers/type/product/product-types.ts +2 -0
- package/src/resolvers/type/product/product-variation-assignment-vector.ts +2 -0
- package/src/resolvers/type/product/product-variation-option-types.ts +1 -0
- package/src/resolvers/type/product/product-variation-types.ts +1 -0
- package/src/resolvers/type/quotation-types.ts +3 -0
- package/src/resolvers/type/shop-types.ts +2 -0
- package/src/resolvers/type/token-types.ts +7 -0
- package/src/resolvers/type/user-types.ts +18 -0
- package/src/resolvers/type/work-types.ts +2 -0
|
@@ -32,36 +32,43 @@ export const Order = {
|
|
|
32
32
|
},
|
|
33
33
|
|
|
34
34
|
async currency(order: OrderType, _, { modules }: Context): Promise<Currency> {
|
|
35
|
+
// TODO: use loader
|
|
35
36
|
return modules.currencies.findCurrency({ isoCode: order.currency });
|
|
36
37
|
},
|
|
37
38
|
|
|
38
39
|
async country(order: OrderType, _, { modules }: Context): Promise<Country> {
|
|
40
|
+
// TODO: use loader
|
|
39
41
|
return modules.countries.findCountry({ isoCode: order.countryCode });
|
|
40
42
|
},
|
|
41
43
|
|
|
42
44
|
async discounts(order: OrderType, _, { modules }: Context): Promise<Array<OrderDiscount>> {
|
|
45
|
+
// TODO: use loader?
|
|
43
46
|
return modules.orders.discounts.findOrderDiscounts({ orderId: order._id });
|
|
44
47
|
},
|
|
45
48
|
|
|
46
49
|
async delivery(order: OrderType, _, { modules }: Context): Promise<OrderDelivery> {
|
|
50
|
+
// TODO: use loader
|
|
47
51
|
return modules.orders.deliveries.findDelivery({
|
|
48
52
|
orderDeliveryId: order.deliveryId,
|
|
49
53
|
});
|
|
50
54
|
},
|
|
51
55
|
|
|
52
56
|
async enrollment(order: OrderType, _, { modules }: Context): Promise<Enrollment> {
|
|
57
|
+
// TODO: use loader
|
|
53
58
|
return modules.enrollments.findEnrollment({
|
|
54
59
|
orderId: order._id,
|
|
55
60
|
});
|
|
56
61
|
},
|
|
57
62
|
|
|
58
63
|
async items(order: OrderType, _, { modules }: Context): Promise<Array<OrderPosition>> {
|
|
64
|
+
// TODO: use loader?
|
|
59
65
|
return modules.orders.positions.findOrderPositions({
|
|
60
66
|
orderId: order._id,
|
|
61
67
|
});
|
|
62
68
|
},
|
|
63
69
|
|
|
64
70
|
async payment(order: OrderType, _, { modules }: Context): Promise<OrderPayment> {
|
|
71
|
+
// TODO: use loader
|
|
65
72
|
return modules.orders.payments.findOrderPayment({
|
|
66
73
|
orderPaymentId: order.paymentId,
|
|
67
74
|
});
|
|
@@ -87,6 +94,7 @@ export const Order = {
|
|
|
87
94
|
},
|
|
88
95
|
|
|
89
96
|
async user(order: OrderType, _, { modules }: Context): Promise<User> {
|
|
97
|
+
// TODO: use loader
|
|
90
98
|
return modules.users.findUserById(order.userId);
|
|
91
99
|
},
|
|
92
100
|
};
|
|
@@ -15,10 +15,12 @@ export interface PaymentCredentialsHelperTypes {
|
|
|
15
15
|
}
|
|
16
16
|
export const PaymentCredentials: PaymentCredentialsHelperTypes = {
|
|
17
17
|
async user(obj, _, { modules }) {
|
|
18
|
+
// TODO: use loader
|
|
18
19
|
return modules.users.findUserById(obj.userId);
|
|
19
20
|
},
|
|
20
21
|
|
|
21
22
|
async paymentProvider(obj, _, { modules }) {
|
|
23
|
+
// TODO: use loader
|
|
22
24
|
return modules.payment.paymentProviders.findProvider({
|
|
23
25
|
paymentProviderId: obj.paymentProviderId,
|
|
24
26
|
});
|
|
@@ -27,6 +29,7 @@ export const PaymentCredentials: PaymentCredentialsHelperTypes = {
|
|
|
27
29
|
async isValid(obj, _, requestContext) {
|
|
28
30
|
const { modules, userId } = requestContext;
|
|
29
31
|
|
|
32
|
+
// TODO: use loader
|
|
30
33
|
const paymentProvider = await modules.payment.paymentProviders.findProvider({
|
|
31
34
|
paymentProviderId: obj.paymentProviderId,
|
|
32
35
|
});
|
|
@@ -29,6 +29,8 @@ export const PaymentProvider = {
|
|
|
29
29
|
requestContext: Context,
|
|
30
30
|
) {
|
|
31
31
|
const { modules, countryContext: country, user } = requestContext;
|
|
32
|
+
|
|
33
|
+
// TODO: use loader
|
|
32
34
|
const order = await modules.orders.findOrder({ orderId });
|
|
33
35
|
const currency = currencyCode || order?.currency || requestContext.currencyContext;
|
|
34
36
|
const pricingContext = {
|
|
@@ -26,9 +26,11 @@ export const ProductCatalogPrice: ProductCatalogPriceHelperTypes = {
|
|
|
26
26
|
return isNetPrice || false;
|
|
27
27
|
},
|
|
28
28
|
country: async ({ countryCode }, _, { modules }) => {
|
|
29
|
+
// TODO: use loader
|
|
29
30
|
return modules.countries.findCountry({ isoCode: countryCode });
|
|
30
31
|
},
|
|
31
32
|
currency: async ({ currencyCode }, _, { modules }) => {
|
|
33
|
+
// TODO: use loader
|
|
32
34
|
return modules.currencies.findCurrency({ isoCode: currencyCode });
|
|
33
35
|
},
|
|
34
36
|
};
|
|
@@ -23,6 +23,7 @@ export const SimpleProduct = {
|
|
|
23
23
|
const { referenceDate, quantity } = params;
|
|
24
24
|
const { services, modules } = requestContext;
|
|
25
25
|
|
|
26
|
+
// TODO: use loader?
|
|
26
27
|
const deliveryProviders = await modules.delivery.findProviders({});
|
|
27
28
|
|
|
28
29
|
return services.products.simulateProductDispatching({
|
|
@@ -50,6 +51,7 @@ export const SimpleProduct = {
|
|
|
50
51
|
const { modules, services } = requestContext;
|
|
51
52
|
const { referenceDate, deliveryProviderType } = params;
|
|
52
53
|
|
|
54
|
+
// TODO: use loader?
|
|
53
55
|
const deliveryProviders = await modules.delivery.findProviders({
|
|
54
56
|
type: deliveryProviderType,
|
|
55
57
|
});
|
|
@@ -47,6 +47,7 @@ export const TokenizedProduct = {
|
|
|
47
47
|
const { modules, services } = requestContext;
|
|
48
48
|
const { referenceDate } = params;
|
|
49
49
|
|
|
50
|
+
// TODO: use loader?
|
|
50
51
|
const deliveryProviders = await modules.delivery.findProviders({});
|
|
51
52
|
|
|
52
53
|
return services.products.simulateProductInventory({
|
|
@@ -59,6 +60,7 @@ export const TokenizedProduct = {
|
|
|
59
60
|
async tokens(product: Product, params: never, requestContext: Context) {
|
|
60
61
|
await checkAction(requestContext, actions.viewTokens, [undefined, params]);
|
|
61
62
|
|
|
63
|
+
// TODO: use loader?
|
|
62
64
|
const tokens = await requestContext.modules.warehousing.findTokens({
|
|
63
65
|
productId: product._id,
|
|
64
66
|
});
|
|
@@ -78,6 +78,7 @@ export const Product = {
|
|
|
78
78
|
},
|
|
79
79
|
{ modules }: Context,
|
|
80
80
|
): Promise<Array<ProductReview>> {
|
|
81
|
+
// TODO: use loader?
|
|
81
82
|
return modules.products.reviews.findProductReviews({
|
|
82
83
|
productId: product._id,
|
|
83
84
|
limit,
|
|
@@ -96,6 +97,7 @@ export const Product = {
|
|
|
96
97
|
return modules.products.reviews.count({ ...params, productId: product._id });
|
|
97
98
|
},
|
|
98
99
|
|
|
100
|
+
// TODO: slow!
|
|
99
101
|
async siblings(
|
|
100
102
|
product: ProductType,
|
|
101
103
|
params: {
|
|
@@ -18,6 +18,7 @@ export const ProductVariationAssignmentVector: ProductVariationAssignmentVectorH
|
|
|
18
18
|
_id: ({ product, key, value }) => `${product._id}:${key}=${value}`,
|
|
19
19
|
|
|
20
20
|
option: async (obj, _, { modules }) => {
|
|
21
|
+
// TODO: use loader?
|
|
21
22
|
const productVariation = await modules.products.variations.findProductVariationByKey({
|
|
22
23
|
key: obj.key,
|
|
23
24
|
productId: obj.product._id,
|
|
@@ -29,6 +30,7 @@ export const ProductVariationAssignmentVector: ProductVariationAssignmentVectorH
|
|
|
29
30
|
},
|
|
30
31
|
|
|
31
32
|
variation: (obj, _, { modules }) => {
|
|
33
|
+
// TODO: use loader?
|
|
32
34
|
return modules.products.variations.findProductVariationByKey({
|
|
33
35
|
productId: obj?.product?._id,
|
|
34
36
|
key: obj?.key,
|
|
@@ -21,6 +21,7 @@ export const ProductVariationOption: ProductVariationOptionHelperTypes = {
|
|
|
21
21
|
},
|
|
22
22
|
|
|
23
23
|
texts: async (obj, { forceLocale }, { modules, localeContext }) => {
|
|
24
|
+
// TODO: use loader
|
|
24
25
|
return modules.products.variations.texts.findLocalizedVariationText({
|
|
25
26
|
locale: forceLocale || localeContext.baseName,
|
|
26
27
|
productVariationId: obj._id,
|
|
@@ -29,6 +29,7 @@ export const ProductVariation: ProductVariationHelperTypes = {
|
|
|
29
29
|
},
|
|
30
30
|
|
|
31
31
|
texts: async (obj, { forceLocale }, { modules, localeContext }) => {
|
|
32
|
+
// TODO: use loader
|
|
32
33
|
return modules.products.variations.texts.findLocalizedVariationText({
|
|
33
34
|
productVariationId: obj._id,
|
|
34
35
|
locale: forceLocale || localeContext.baseName,
|
|
@@ -17,8 +17,10 @@ type QuotationHelperTypes = {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
export const Quotation: QuotationHelperTypes = {
|
|
20
|
+
// TODO: use loader
|
|
20
21
|
country: async (obj, _, { modules }) => modules.countries.findCountry({ isoCode: obj.countryCode }),
|
|
21
22
|
|
|
23
|
+
// TODO: use loader
|
|
22
24
|
currency: async (obj, _, { modules }) => modules.currencies.findCurrency({ isoCode: obj.currency }),
|
|
23
25
|
|
|
24
26
|
isExpired: (obj, { referenceDate }, { modules }) =>
|
|
@@ -33,5 +35,6 @@ export const Quotation: QuotationHelperTypes = {
|
|
|
33
35
|
|
|
34
36
|
status: (obj, _, { modules }) => modules.quotations.normalizedStatus(obj),
|
|
35
37
|
|
|
38
|
+
// TODO: use loader
|
|
36
39
|
user: (obj, _, { modules }) => modules.users.findUserById(obj.userId),
|
|
37
40
|
};
|
|
@@ -19,9 +19,11 @@ export const Shop: ShopHelperTypes = {
|
|
|
19
19
|
},
|
|
20
20
|
|
|
21
21
|
language: async (_root, _params, { localeContext, modules }) => {
|
|
22
|
+
// TODO: use loader
|
|
22
23
|
return modules.languages.findLanguage({ isoCode: localeContext.language });
|
|
23
24
|
},
|
|
24
25
|
country: async (_root, _params, { countryContext, modules }) => {
|
|
26
|
+
// TODO: use loader
|
|
25
27
|
return modules.countries.findCountry({ isoCode: countryContext });
|
|
26
28
|
},
|
|
27
29
|
|
|
@@ -7,11 +7,13 @@ import { WarehousingDirector } from '@unchainedshop/core';
|
|
|
7
7
|
|
|
8
8
|
export const Token = {
|
|
9
9
|
product: async (token: TokenSurrogate, params: never, { modules }: Context) => {
|
|
10
|
+
// TODO: use loader
|
|
10
11
|
return modules.products.findProduct({ productId: token.productId });
|
|
11
12
|
},
|
|
12
13
|
|
|
13
14
|
user: async (token: TokenSurrogate, params: never, { modules }: Context) => {
|
|
14
15
|
if (!token.userId) return null;
|
|
16
|
+
// TODO: use loader
|
|
15
17
|
return modules.users.findUserById(token.userId);
|
|
16
18
|
},
|
|
17
19
|
|
|
@@ -19,6 +21,7 @@ export const Token = {
|
|
|
19
21
|
if (token.walletAddress && !token.userId) {
|
|
20
22
|
return TokenStatus.DECENTRALIZED;
|
|
21
23
|
}
|
|
24
|
+
// TODO: use loader?
|
|
22
25
|
const workItems = await modules.worker.findWorkQueue({
|
|
23
26
|
types: ['EXPORT_TOKEN'],
|
|
24
27
|
status: [WorkStatus.NEW, WorkStatus.ALLOCATED],
|
|
@@ -33,8 +36,10 @@ export const Token = {
|
|
|
33
36
|
context: Context,
|
|
34
37
|
) => {
|
|
35
38
|
const { modules } = context;
|
|
39
|
+
// TODO: use loader
|
|
36
40
|
const product = await modules.products.findProduct({ productId: token.productId });
|
|
37
41
|
|
|
42
|
+
// TODO: use loader
|
|
38
43
|
const virtualProviders = await context.modules.warehousing.findProviders({
|
|
39
44
|
type: WarehousingProviderType.VIRTUAL,
|
|
40
45
|
});
|
|
@@ -54,8 +59,10 @@ export const Token = {
|
|
|
54
59
|
|
|
55
60
|
isInvalidateable: async (token: TokenSurrogate, _params: never, context: Context) => {
|
|
56
61
|
const { modules } = context;
|
|
62
|
+
// TODO: use loader
|
|
57
63
|
const product = await modules.products.findProduct({ productId: token.productId });
|
|
58
64
|
|
|
65
|
+
// TODO: use loader
|
|
59
66
|
const virtualProviders = await context.modules.warehousing.findProviders({
|
|
60
67
|
type: WarehousingProviderType.VIRTUAL,
|
|
61
68
|
});
|
|
@@ -169,6 +169,8 @@ export const User: UserHelperTypes = {
|
|
|
169
169
|
|
|
170
170
|
bookmarks: async (user, params, context) => {
|
|
171
171
|
await checkAction(context, viewUserPrivateInfos, [user, params]);
|
|
172
|
+
|
|
173
|
+
// TODO: use loader?
|
|
172
174
|
return context.modules.bookmarks.findBookmarksByUserId(user._id);
|
|
173
175
|
},
|
|
174
176
|
|
|
@@ -188,6 +190,8 @@ export const User: UserHelperTypes = {
|
|
|
188
190
|
user.services?.web3?.flatMap((service) => {
|
|
189
191
|
return service.verified ? [service.address] : [];
|
|
190
192
|
}) || [];
|
|
193
|
+
|
|
194
|
+
// TODO: use loader?
|
|
191
195
|
return context.modules.warehousing.findTokensForUser({
|
|
192
196
|
userId: user._id,
|
|
193
197
|
walletAddresses,
|
|
@@ -197,6 +201,8 @@ export const User: UserHelperTypes = {
|
|
|
197
201
|
async country(user, params, context) {
|
|
198
202
|
await checkAction(context, viewUserPrivateInfos, [user, params]);
|
|
199
203
|
const userLocale = context.modules.users.userLocale(user);
|
|
204
|
+
|
|
205
|
+
// TODO: use loader
|
|
200
206
|
return context.modules.countries.findCountry({
|
|
201
207
|
isoCode: userLocale.region?.toUpperCase(),
|
|
202
208
|
});
|
|
@@ -204,6 +210,8 @@ export const User: UserHelperTypes = {
|
|
|
204
210
|
|
|
205
211
|
async enrollments(user, params, context) {
|
|
206
212
|
await checkAction(context, viewUserEnrollments, [user, params]);
|
|
213
|
+
|
|
214
|
+
// TODO: use loader?
|
|
207
215
|
return context.modules.enrollments.findEnrollments({
|
|
208
216
|
...(params || {}),
|
|
209
217
|
userId: user._id,
|
|
@@ -213,6 +221,8 @@ export const User: UserHelperTypes = {
|
|
|
213
221
|
language: async (user, params, context) => {
|
|
214
222
|
await checkAction(context, viewUserPrivateInfos, [user, params]);
|
|
215
223
|
const userLocale = context.modules.users.userLocale(user);
|
|
224
|
+
|
|
225
|
+
// TODO: use loader
|
|
216
226
|
return context.modules.languages.findLanguage({
|
|
217
227
|
isoCode: userLocale.language,
|
|
218
228
|
});
|
|
@@ -227,6 +237,8 @@ export const User: UserHelperTypes = {
|
|
|
227
237
|
|
|
228
238
|
orders: async (user, params, context) => {
|
|
229
239
|
await checkAction(context, viewUserOrders, [user, params]);
|
|
240
|
+
|
|
241
|
+
// TODO: use loader?
|
|
230
242
|
return context.modules.orders.findOrders({
|
|
231
243
|
...(params || {}),
|
|
232
244
|
userId: user._id,
|
|
@@ -235,6 +247,8 @@ export const User: UserHelperTypes = {
|
|
|
235
247
|
|
|
236
248
|
paymentCredentials: async (user, params, context) => {
|
|
237
249
|
await checkAction(context, viewUserPrivateInfos, [user, params]);
|
|
250
|
+
|
|
251
|
+
// TODO: use loader?
|
|
238
252
|
return context.modules.payment.paymentCredentials.findPaymentCredentials(
|
|
239
253
|
{ ...params.selector, userId: user._id },
|
|
240
254
|
{
|
|
@@ -256,6 +270,8 @@ export const User: UserHelperTypes = {
|
|
|
256
270
|
},
|
|
257
271
|
quotations: async (user, params, context) => {
|
|
258
272
|
await checkAction(context, viewUserQuotations, [user, params]);
|
|
273
|
+
|
|
274
|
+
// TODO: use loader?
|
|
259
275
|
return context.modules.quotations.findQuotations({
|
|
260
276
|
...(params || {}),
|
|
261
277
|
userId: user._id,
|
|
@@ -273,6 +289,8 @@ export const User: UserHelperTypes = {
|
|
|
273
289
|
async reviews(user, params, context) {
|
|
274
290
|
const { modules } = context;
|
|
275
291
|
await checkAction(context, viewUserProductReviews, [user, params]);
|
|
292
|
+
|
|
293
|
+
// TODO: use loader?
|
|
276
294
|
return modules.products.reviews.findProductReviews({
|
|
277
295
|
...(params || {}),
|
|
278
296
|
authorId: user._id,
|