cabloy 5.1.126 → 5.1.128
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/.cabloy-version +1 -1
- package/CHANGELOG.md +37 -0
- package/cabloy-docs/backend/error-guide.md +17 -0
- package/cabloy-docs/backend/i18n-guide.md +86 -7
- package/e2e/specs/a-commerce/commerce.spec.ts +222 -6
- package/package.json +1 -1
- package/vona/env/.env +2 -0
- package/vona/env/.env.prod +6 -2
- package/vona/packages-cli/cabloy-cli/package.json +1 -1
- package/vona/packages-cli/cli/package.json +1 -1
- package/vona/packages-cli/cli-set-api/package.json +1 -1
- package/vona/packages-utils/module-glob/package.json +1 -1
- package/vona/packages-utils/utils/package.json +1 -1
- package/vona/packages-utils/utils/src/vona.ts +8 -1
- package/vona/packages-vona/vona/package.json +1 -1
- package/vona/packages-vona/vona-core/package.json +1 -1
- package/vona/packages-vona/vona-core/src/lib/bean/resource/error/errorClass.ts +21 -4
- package/vona/packages-vona/vona-core/src/lib/bean/resource/error/errorObject.ts +1 -0
- package/vona/packages-vona/vona-core/src/lib/bean/type.ts +3 -1
- package/vona/packages-vona/vona-core/src/types/interface/module.ts +6 -1
- package/vona/packages-vona/vona-mock/package.json +1 -1
- package/vona/pnpm-lock.yaml +15 -44
- package/vona/src/suite/a-commerce/modules/commerce-catalog/src/.metadata/index.ts +37 -2
- package/vona/src/suite/a-commerce/modules/commerce-catalog/src/config/locale/en-us.ts +1 -0
- package/vona/src/suite/a-commerce/modules/commerce-catalog/src/config/locale/zh-cn.ts +1 -0
- package/vona/src/suite/a-commerce/modules/commerce-catalog/src/dto/categorySelectResItem.tsx +3 -1
- package/vona/src/suite/a-commerce/modules/commerce-catalog/src/dto/categoryView.tsx +3 -1
- package/vona/src/suite/a-commerce/modules/commerce-catalog/src/dto/productSelectResItem.tsx +3 -1
- package/vona/src/suite/a-commerce/modules/commerce-catalog/src/dto/productView.tsx +3 -1
- package/vona/src/suite/a-commerce/modules/commerce-catalog/src/entity/category.tsx +21 -2
- package/vona/src/suite/a-commerce/modules/commerce-catalog/src/entity/product.tsx +23 -3
- package/vona/src/suite/a-commerce/modules/commerce-catalog/src/model/category.ts +11 -1
- package/vona/src/suite/a-commerce/modules/commerce-catalog/src/model/product.ts +1 -0
- package/vona/src/suite/a-commerce/modules/commerce-catalog/src/service/category.ts +7 -2
- package/vona/src/suite/a-commerce/modules/commerce-catalog/src/service/product.ts +7 -2
- package/vona/src/suite/a-commerce/modules/commerce-catalog/test/categoryPresentation.test.ts +218 -0
- package/vona/src/suite/a-commerce/modules/commerce-catalog/test/productPresentation.test.ts +214 -0
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/bean/payScene.commerceOrder.ts +39 -3
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/service/commercePayScene.ts +14 -1
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/service/paymentAttempt.ts +5 -1
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/.metadata/index.ts +17 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/controller/checkout.ts +18 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/dto/checkoutCreate.tsx +3 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/dto/checkoutPaymentMethod.tsx +19 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/dto/checkoutPaymentMethods.tsx +17 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/dto/refundResult.tsx +3 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/service/order.ts +53 -1
- package/vona/src/suite/a-commerce/modules/commerce-trade/test/paymentOutcome.test.ts +2 -1
- package/vona/src/suite/a-commerce/modules/commerce-trade/test/refundLifecycle.test.ts +111 -3
- package/vona/src/suite-vendor/a-pay/modules/a-pay/package.json +1 -1
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/.metadata/index.ts +94 -55
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/bean/bean.payScene.ts +65 -1
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/bean/meta.redlock.ts +2 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/controller/paymentCallback.ts +32 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/controller/paymentSession.ts +26 -8
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/service/paymentCallback.ts +99 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/service/paymentSession.ts +26 -3
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/service/providerOperation.ts +214 -82
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/service/refundOperation.ts +27 -2
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/types/payScene.ts +9 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/types/payment.ts +5 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-mock/package.json +1 -1
- package/vona/src/suite-vendor/a-pay/modules/pay-mock/src/bean/payProvider.mock.ts +7 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-paypal/package.json +1 -1
- package/vona/src/suite-vendor/a-pay/modules/pay-paypal/src/bean/payProvider.paypal.ts +395 -84
- package/vona/src/suite-vendor/a-pay/modules/pay-paypal/src/lib/index.ts +1 -1
- package/vona/src/suite-vendor/a-pay/modules/pay-paypal/src/lib/paypalGateway.ts +129 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-paypal/src/types/index.ts +2 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-stripe/package.json +1 -1
- package/vona/src/suite-vendor/a-pay/modules/pay-stripe/src/bean/payProvider.stripe.ts +7 -0
- package/vona/src/suite-vendor/a-pay/package.json +5 -5
- package/vona/src/suite-vendor/a-vona/modules/a-core/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/package.json +1 -1
- package/zova/packages-cli/cli/package.json +3 -3
- package/zova/packages-cli/cli-set-front/package.json +4 -4
- package/zova/packages-utils/zova-jsx/package.json +3 -3
- package/zova/packages-utils/zova-vite/package.json +2 -2
- package/zova/packages-zova/zova/package.json +3 -3
- package/zova/packages-zova/zova-core/package.json +2 -2
- package/zova/src/suite/a-commerce/modules/commerce-member/src/api/openapi/schemas.ts +16 -4
- package/zova/src/suite/a-commerce/modules/commerce-member/src/api/openapi/types.ts +240 -19
- package/zova/src/suite/a-commerce/modules/commerce-trade/cli/openapi.config.ts +1 -0
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/api/commerceTradeCheckout.ts +16 -0
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/api/openapi/schemas.ts +8 -0
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/api/openapi/types.ts +184 -8
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/apiSchema/commerceTradeCheckout.ts +12 -1
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/model/cart.ts +11 -0
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/page/checkout/controller.tsx +25 -1
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/page/payment/controller.tsx +27 -4
- package/zova/src/suite/cabloy-basic/modules/basic-select/src/bean/tableCell.select.tsx +12 -6
- package/zova/src/suite/cabloy-basic/modules/basic-select/src/component/formFieldSelect/controller.tsx +6 -3
- package/zova/src/suite-vendor/a-pay/modules/a-pay/cli/openapi.config.ts +1 -1
- package/zova/src/suite-vendor/a-pay/modules/a-pay/package.json +1 -1
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/api/openapi/schemas.ts +20 -8
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/api/openapi/types.ts +292 -32
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/api/paymentSession.ts +26 -4
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/apiSchema/paymentSession.ts +5 -0
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/component/paymentNextAction/controller.tsx +2 -1
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/model/paymentSession.ts +12 -0
- package/zova/src/suite-vendor/a-pay/package.json +2 -2
- package/zova/src/suite-vendor/a-zova/modules/a-zova/package.json +4 -4
- package/zova/src/suite-vendor/a-zova/package.json +2 -2
package/vona/pnpm-lock.yaml
CHANGED
|
@@ -24,7 +24,7 @@ importers:
|
|
|
24
24
|
dependencies:
|
|
25
25
|
'@babel/core':
|
|
26
26
|
specifier: ^7.29.0
|
|
27
|
-
version: 7.29.7
|
|
27
|
+
version: 7.29.7
|
|
28
28
|
'@babel/traverse':
|
|
29
29
|
specifier: ^7.29.0
|
|
30
30
|
version: 7.29.7
|
|
@@ -69,7 +69,7 @@ importers:
|
|
|
69
69
|
version: 8.0.1
|
|
70
70
|
bullmq:
|
|
71
71
|
specifier: ^5.74.1
|
|
72
|
-
version: 5.79.1
|
|
72
|
+
version: 5.79.1
|
|
73
73
|
chalk:
|
|
74
74
|
specifier: ^5.6.2
|
|
75
75
|
version: 5.6.2
|
|
@@ -81,7 +81,7 @@ importers:
|
|
|
81
81
|
version: 11.3.5
|
|
82
82
|
ioredis:
|
|
83
83
|
specifier: ^5.10.1
|
|
84
|
-
version: 5.11.1
|
|
84
|
+
version: 5.11.1
|
|
85
85
|
knex:
|
|
86
86
|
specifier: ^3.3.0
|
|
87
87
|
version: 3.3.0(better-sqlite3@12.11.1)
|
|
@@ -1834,16 +1834,16 @@ importers:
|
|
|
1834
1834
|
src/suite-vendor/a-pay:
|
|
1835
1835
|
dependencies:
|
|
1836
1836
|
vona-module-a-pay:
|
|
1837
|
-
specifier: ^5.0.
|
|
1837
|
+
specifier: ^5.0.3
|
|
1838
1838
|
version: link:modules/a-pay
|
|
1839
1839
|
vona-module-pay-mock:
|
|
1840
|
-
specifier: ^5.0.
|
|
1840
|
+
specifier: ^5.0.3
|
|
1841
1841
|
version: link:modules/pay-mock
|
|
1842
1842
|
vona-module-pay-paypal:
|
|
1843
|
-
specifier: ^5.0.
|
|
1843
|
+
specifier: ^5.0.3
|
|
1844
1844
|
version: link:modules/pay-paypal
|
|
1845
1845
|
vona-module-pay-stripe:
|
|
1846
|
-
specifier: ^5.0.
|
|
1846
|
+
specifier: ^5.0.3
|
|
1847
1847
|
version: link:modules/pay-stripe
|
|
1848
1848
|
|
|
1849
1849
|
src/suite-vendor/a-pay/modules/a-pay:
|
|
@@ -1922,7 +1922,7 @@ importers:
|
|
|
1922
1922
|
specifier: ^5.0.8
|
|
1923
1923
|
version: link:modules/test-file
|
|
1924
1924
|
vona-module-test-pay:
|
|
1925
|
-
specifier: ^5.0.
|
|
1925
|
+
specifier: ^5.0.2
|
|
1926
1926
|
version: link:modules/test-pay
|
|
1927
1927
|
|
|
1928
1928
|
src/suite-vendor/a-test/modules/test-auth:
|
|
@@ -2756,7 +2756,7 @@ importers:
|
|
|
2756
2756
|
dependencies:
|
|
2757
2757
|
bullmq:
|
|
2758
2758
|
specifier: ^5.74.1
|
|
2759
|
-
version: 5.79.1
|
|
2759
|
+
version: 5.79.1
|
|
2760
2760
|
devDependencies:
|
|
2761
2761
|
clean-package:
|
|
2762
2762
|
specifier: ^2.2.0
|
|
@@ -2778,7 +2778,7 @@ importers:
|
|
|
2778
2778
|
dependencies:
|
|
2779
2779
|
ioredis:
|
|
2780
2780
|
specifier: ^5.10.1
|
|
2781
|
-
version: 5.11.1
|
|
2781
|
+
version: 5.11.1
|
|
2782
2782
|
devDependencies:
|
|
2783
2783
|
clean-package:
|
|
2784
2784
|
specifier: ^2.2.0
|
|
@@ -8962,26 +8962,6 @@ snapshots:
|
|
|
8962
8962
|
transitivePeerDependencies:
|
|
8963
8963
|
- supports-color
|
|
8964
8964
|
|
|
8965
|
-
'@babel/core@7.29.7(supports-color@5.5.0)':
|
|
8966
|
-
dependencies:
|
|
8967
|
-
'@babel/code-frame': 7.29.7
|
|
8968
|
-
'@babel/generator': 7.29.7
|
|
8969
|
-
'@babel/helper-compilation-targets': 7.29.7
|
|
8970
|
-
'@babel/helper-module-transforms': 7.29.7(@babel/core@7.29.7(supports-color@5.5.0))
|
|
8971
|
-
'@babel/helpers': 7.29.7
|
|
8972
|
-
'@babel/parser': 7.29.7
|
|
8973
|
-
'@babel/template': 7.29.7
|
|
8974
|
-
'@babel/traverse': 7.29.7
|
|
8975
|
-
'@babel/types': 7.29.7
|
|
8976
|
-
'@jridgewell/remapping': 2.3.5
|
|
8977
|
-
convert-source-map: 2.0.0
|
|
8978
|
-
debug: 4.4.3(supports-color@5.5.0)
|
|
8979
|
-
gensync: 1.0.0-beta.2
|
|
8980
|
-
json5: 2.2.3
|
|
8981
|
-
semver: 6.3.1
|
|
8982
|
-
transitivePeerDependencies:
|
|
8983
|
-
- supports-color
|
|
8984
|
-
|
|
8985
8965
|
'@babel/generator@7.29.7':
|
|
8986
8966
|
dependencies:
|
|
8987
8967
|
'@babel/parser': 7.29.7
|
|
@@ -9031,15 +9011,6 @@ snapshots:
|
|
|
9031
9011
|
transitivePeerDependencies:
|
|
9032
9012
|
- supports-color
|
|
9033
9013
|
|
|
9034
|
-
'@babel/helper-module-transforms@7.29.7(@babel/core@7.29.7(supports-color@5.5.0))':
|
|
9035
|
-
dependencies:
|
|
9036
|
-
'@babel/core': 7.29.7(supports-color@5.5.0)
|
|
9037
|
-
'@babel/helper-module-imports': 7.29.7
|
|
9038
|
-
'@babel/helper-validator-identifier': 7.29.7
|
|
9039
|
-
'@babel/traverse': 7.29.7
|
|
9040
|
-
transitivePeerDependencies:
|
|
9041
|
-
- supports-color
|
|
9042
|
-
|
|
9043
9014
|
'@babel/helper-module-transforms@7.29.7(@babel/core@7.29.7)':
|
|
9044
9015
|
dependencies:
|
|
9045
9016
|
'@babel/core': 7.29.7
|
|
@@ -10006,7 +9977,7 @@ snapshots:
|
|
|
10006
9977
|
|
|
10007
9978
|
'@sesamecare-oss/redlock@1.4.0(ioredis@5.11.1)':
|
|
10008
9979
|
dependencies:
|
|
10009
|
-
ioredis: 5.11.1
|
|
9980
|
+
ioredis: 5.11.1
|
|
10010
9981
|
|
|
10011
9982
|
'@sindresorhus/merge-streams@2.3.0': {}
|
|
10012
9983
|
|
|
@@ -10912,10 +10883,10 @@ snapshots:
|
|
|
10912
10883
|
base64-js: 1.5.1
|
|
10913
10884
|
ieee754: 1.2.1
|
|
10914
10885
|
|
|
10915
|
-
bullmq@5.79.1
|
|
10886
|
+
bullmq@5.79.1:
|
|
10916
10887
|
dependencies:
|
|
10917
10888
|
cron-parser: 4.9.0
|
|
10918
|
-
ioredis: 5.10.1
|
|
10889
|
+
ioredis: 5.10.1
|
|
10919
10890
|
msgpackr: 2.0.2
|
|
10920
10891
|
node-abort-controller: 3.1.1
|
|
10921
10892
|
semver: 7.8.1
|
|
@@ -12061,7 +12032,7 @@ snapshots:
|
|
|
12061
12032
|
|
|
12062
12033
|
interpret@2.2.0: {}
|
|
12063
12034
|
|
|
12064
|
-
ioredis@5.10.1
|
|
12035
|
+
ioredis@5.10.1:
|
|
12065
12036
|
dependencies:
|
|
12066
12037
|
'@ioredis/commands': 1.5.1
|
|
12067
12038
|
cluster-key-slot: 1.1.2
|
|
@@ -12075,7 +12046,7 @@ snapshots:
|
|
|
12075
12046
|
transitivePeerDependencies:
|
|
12076
12047
|
- supports-color
|
|
12077
12048
|
|
|
12078
|
-
ioredis@5.11.1
|
|
12049
|
+
ioredis@5.11.1:
|
|
12079
12050
|
dependencies:
|
|
12080
12051
|
'@ioredis/commands': 1.10.0
|
|
12081
12052
|
cluster-key-slot: 1.1.1
|
|
@@ -142,9 +142,14 @@ declare module 'vona' {
|
|
|
142
142
|
import type { IModelGetOptions, IModelMethodOptions, IModelSelectParams, TypeModelSelectAndCount, TypeModelRelationResult, TypeModelWhere, IModelInsertOptions, TypeModelMutateRelationData, IModelDeleteOptions, IModelUpdateOptions, IModelMutateOptions, IModelSelectCountParams, IModelIncrementParams, IModelSelectAggrParams, TypeModelAggrRelationResult, IModelSelectGroupParams, TypeModelGroupRelationResult } from 'vona-module-a-orm';
|
|
143
143
|
import { SymbolKeyEntity, SymbolKeyEntityMeta, SymbolKeyModelOptions } from 'vona-module-a-orm';
|
|
144
144
|
declare module 'vona-module-commerce-catalog' {
|
|
145
|
-
export interface
|
|
145
|
+
export interface IModelOptionsCategory {
|
|
146
146
|
relations: {
|
|
147
|
-
|
|
147
|
+
parent: IModelRelationBelongsTo<'commerce-catalog:category', 'commerce-catalog:category', false, 'id'|'name'>;
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
export interface IModelOptionsProduct {
|
|
151
|
+
relations: {
|
|
152
|
+
category: IModelRelationBelongsTo<'commerce-catalog:product', 'commerce-catalog:category', false, 'id'|'name'|'published'>;
|
|
148
153
|
skus: IModelRelationHasMany<'commerce-catalog:sku', 'productId', false, '*', undefined, undefined, undefined>;
|
|
149
154
|
skuAvailables: IModelRelationHasMany<'commerce-catalog:sku', 'productId', false, 'id'|'code'|'productId'|'priceCents', ['commerce-trade:stockBalance'], undefined, undefined>;
|
|
150
155
|
};
|
|
@@ -159,7 +164,17 @@ export interface IModelOptionsSku {
|
|
|
159
164
|
[SymbolKeyEntityMeta]: EntityCategoryMeta;
|
|
160
165
|
[SymbolKeyModelOptions]: IModelOptionsCategory;
|
|
161
166
|
get<T extends IModelGetOptions<EntityCategory,ModelCategory>>(where: TypeModelWhere<EntityCategory>, options?: T): Promise<TypeModelRelationResult<EntityCategory, ModelCategory, T> | undefined>;
|
|
167
|
+
/**
|
|
168
|
+
* Retrieves one matching primary row with a pessimistic FOR UPDATE lock.
|
|
169
|
+
* Requires an active transaction. The lock is released when that transaction completes.
|
|
170
|
+
* Entity and query caches are bypassed.
|
|
171
|
+
*/
|
|
162
172
|
getForUpdate<T extends IModelGetOptions<EntityCategory,ModelCategory>>(where: TypeModelWhere<EntityCategory>, options?: T): Promise<TypeModelRelationResult<EntityCategory, ModelCategory, T> | undefined>;
|
|
173
|
+
/**
|
|
174
|
+
* Retrieves a primary row by ID with the same pessimistic FOR UPDATE lock semantics.
|
|
175
|
+
* Requires an active transaction. The lock is released when that transaction completes.
|
|
176
|
+
* Entity and query caches are bypassed.
|
|
177
|
+
*/
|
|
163
178
|
getByIdForUpdate<T extends IModelGetOptions<EntityCategory,ModelCategory>>(id: TableIdentity, options?: T): Promise<TypeModelRelationResult<EntityCategory, ModelCategory, T> | undefined>;
|
|
164
179
|
mget<T extends IModelGetOptions<EntityCategory,ModelCategory>>(ids: TableIdentity[], options?: T): Promise<TypeModelRelationResult<EntityCategory, ModelCategory, T>[]>;
|
|
165
180
|
selectAndCount<T extends IModelSelectParams<EntityCategory,ModelCategory,ModelJoins>, ModelJoins extends TypeModelsClassLikeGeneral | undefined = undefined>(params?: T, options?: IModelMethodOptions, modelJoins?: ModelJoins): Promise<TypeModelSelectAndCount<EntityCategory, ModelCategory, T>>;
|
|
@@ -190,7 +205,17 @@ export interface ModelProduct {
|
|
|
190
205
|
[SymbolKeyEntityMeta]: EntityProductMeta;
|
|
191
206
|
[SymbolKeyModelOptions]: IModelOptionsProduct;
|
|
192
207
|
get<T extends IModelGetOptions<EntityProduct,ModelProduct>>(where: TypeModelWhere<EntityProduct>, options?: T): Promise<TypeModelRelationResult<EntityProduct, ModelProduct, T> | undefined>;
|
|
208
|
+
/**
|
|
209
|
+
* Retrieves one matching primary row with a pessimistic FOR UPDATE lock.
|
|
210
|
+
* Requires an active transaction. The lock is released when that transaction completes.
|
|
211
|
+
* Entity and query caches are bypassed.
|
|
212
|
+
*/
|
|
193
213
|
getForUpdate<T extends IModelGetOptions<EntityProduct,ModelProduct>>(where: TypeModelWhere<EntityProduct>, options?: T): Promise<TypeModelRelationResult<EntityProduct, ModelProduct, T> | undefined>;
|
|
214
|
+
/**
|
|
215
|
+
* Retrieves a primary row by ID with the same pessimistic FOR UPDATE lock semantics.
|
|
216
|
+
* Requires an active transaction. The lock is released when that transaction completes.
|
|
217
|
+
* Entity and query caches are bypassed.
|
|
218
|
+
*/
|
|
194
219
|
getByIdForUpdate<T extends IModelGetOptions<EntityProduct,ModelProduct>>(id: TableIdentity, options?: T): Promise<TypeModelRelationResult<EntityProduct, ModelProduct, T> | undefined>;
|
|
195
220
|
mget<T extends IModelGetOptions<EntityProduct,ModelProduct>>(ids: TableIdentity[], options?: T): Promise<TypeModelRelationResult<EntityProduct, ModelProduct, T>[]>;
|
|
196
221
|
selectAndCount<T extends IModelSelectParams<EntityProduct,ModelProduct,ModelJoins>, ModelJoins extends TypeModelsClassLikeGeneral | undefined = undefined>(params?: T, options?: IModelMethodOptions, modelJoins?: ModelJoins): Promise<TypeModelSelectAndCount<EntityProduct, ModelProduct, T>>;
|
|
@@ -217,7 +242,17 @@ export interface ModelSku {
|
|
|
217
242
|
[SymbolKeyEntityMeta]: EntitySkuMeta;
|
|
218
243
|
[SymbolKeyModelOptions]: IModelOptionsSku;
|
|
219
244
|
get<T extends IModelGetOptions<EntitySku,ModelSku>>(where: TypeModelWhere<EntitySku>, options?: T): Promise<TypeModelRelationResult<EntitySku, ModelSku, T> | undefined>;
|
|
245
|
+
/**
|
|
246
|
+
* Retrieves one matching primary row with a pessimistic FOR UPDATE lock.
|
|
247
|
+
* Requires an active transaction. The lock is released when that transaction completes.
|
|
248
|
+
* Entity and query caches are bypassed.
|
|
249
|
+
*/
|
|
220
250
|
getForUpdate<T extends IModelGetOptions<EntitySku,ModelSku>>(where: TypeModelWhere<EntitySku>, options?: T): Promise<TypeModelRelationResult<EntitySku, ModelSku, T> | undefined>;
|
|
251
|
+
/**
|
|
252
|
+
* Retrieves a primary row by ID with the same pessimistic FOR UPDATE lock semantics.
|
|
253
|
+
* Requires an active transaction. The lock is released when that transaction completes.
|
|
254
|
+
* Entity and query caches are bypassed.
|
|
255
|
+
*/
|
|
221
256
|
getByIdForUpdate<T extends IModelGetOptions<EntitySku,ModelSku>>(id: TableIdentity, options?: T): Promise<TypeModelRelationResult<EntitySku, ModelSku, T> | undefined>;
|
|
222
257
|
mget<T extends IModelGetOptions<EntitySku,ModelSku>>(ids: TableIdentity[], options?: T): Promise<TypeModelRelationResult<EntitySku, ModelSku, T>[]>;
|
|
223
258
|
selectAndCount<T extends IModelSelectParams<EntitySku,ModelSku,ModelJoins>, ModelJoins extends TypeModelsClassLikeGeneral | undefined = undefined>(params?: T, options?: IModelMethodOptions, modelJoins?: ModelJoins): Promise<TypeModelSelectAndCount<EntitySku, ModelSku, T>>;
|
package/vona/src/suite/a-commerce/modules/commerce-catalog/src/dto/categorySelectResItem.tsx
CHANGED
|
@@ -46,7 +46,9 @@ export interface IDtoOptionsCategorySelectResItem extends IDecoratorDtoOptions {
|
|
|
46
46
|
}),
|
|
47
47
|
],
|
|
48
48
|
})
|
|
49
|
-
export class DtoCategorySelectResItem extends $Dto.get(() => ModelCategory
|
|
49
|
+
export class DtoCategorySelectResItem extends $Dto.get(() => ModelCategory, {
|
|
50
|
+
include: { parent: true },
|
|
51
|
+
}) {
|
|
50
52
|
@Api.field(
|
|
51
53
|
v.title($locale('Operations')),
|
|
52
54
|
ZovaRender.order(1, 'max'),
|
|
@@ -22,4 +22,6 @@ export interface IDtoOptionsCategoryView extends IDecoratorDtoOptions {}
|
|
|
22
22
|
}),
|
|
23
23
|
],
|
|
24
24
|
})
|
|
25
|
-
export class DtoCategoryView extends $Dto.get(() => ModelCategory
|
|
25
|
+
export class DtoCategoryView extends $Dto.get(() => ModelCategory, {
|
|
26
|
+
include: { parent: true },
|
|
27
|
+
}) {}
|
|
@@ -46,7 +46,9 @@ export interface IDtoOptionsProductSelectResItem extends IDecoratorDtoOptions {}
|
|
|
46
46
|
}),
|
|
47
47
|
],
|
|
48
48
|
})
|
|
49
|
-
export class DtoProductSelectResItem extends $Dto.get(() => ModelProduct
|
|
49
|
+
export class DtoProductSelectResItem extends $Dto.get(() => ModelProduct, {
|
|
50
|
+
include: { category: true },
|
|
51
|
+
}) {
|
|
50
52
|
@Api.field(
|
|
51
53
|
v.title($locale('Operations')),
|
|
52
54
|
ZovaRender.order(1, 'max'),
|
|
@@ -22,4 +22,6 @@ export interface IDtoOptionsProductView extends IDecoratorDtoOptions {}
|
|
|
22
22
|
}),
|
|
23
23
|
],
|
|
24
24
|
})
|
|
25
|
-
export class DtoProductView extends $Dto.get(() => ModelProduct
|
|
25
|
+
export class DtoProductView extends $Dto.get(() => ModelProduct, {
|
|
26
|
+
include: { category: true },
|
|
27
|
+
}) {}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { TableIdentity } from 'table-identity';
|
|
2
2
|
import type { IDecoratorEntityOptions } from 'vona-module-a-orm';
|
|
3
3
|
|
|
4
|
-
import { $makeMetadata, Api, v } from 'vona-module-a-openapiutils';
|
|
4
|
+
import { $makeMetadata, $resourceName, Api, v } from 'vona-module-a-openapiutils';
|
|
5
5
|
import { Entity, EntityBase } from 'vona-module-a-orm';
|
|
6
6
|
import { ZovaRender } from 'zova-rest-cabloy-basic-admin';
|
|
7
7
|
|
|
@@ -9,6 +9,11 @@ import { $locale } from '../.metadata/locales.ts';
|
|
|
9
9
|
|
|
10
10
|
export interface IEntityOptionsCategory extends IDecoratorEntityOptions {}
|
|
11
11
|
|
|
12
|
+
export const categoryPublicationItems = [
|
|
13
|
+
{ value: false, title: $locale('Unpublished') },
|
|
14
|
+
{ value: true, title: $locale('Published') },
|
|
15
|
+
];
|
|
16
|
+
|
|
12
17
|
@Entity<IEntityOptionsCategory>('commerceCatalogCategory', {
|
|
13
18
|
openapi: { title: $locale('Category') },
|
|
14
19
|
fields: {
|
|
@@ -41,11 +46,25 @@ export class EntityCategory extends EntityBase {
|
|
|
41
46
|
v.title($locale('ParentCategory')),
|
|
42
47
|
v.optional(),
|
|
43
48
|
ZovaRender.order(2),
|
|
49
|
+
ZovaRender.field('basic-resource:formFieldResourcePicker', {
|
|
50
|
+
resource: $resourceName('commerce-catalog:category'),
|
|
51
|
+
relationName: 'parent',
|
|
52
|
+
}),
|
|
53
|
+
ZovaRender.cell('basic-resource:resourcePicker', {
|
|
54
|
+
resource: $resourceName('commerce-catalog:category'),
|
|
55
|
+
relationName: 'parent',
|
|
56
|
+
}),
|
|
44
57
|
v.tableIdentity(),
|
|
45
58
|
)
|
|
46
59
|
parentId?: TableIdentity;
|
|
47
60
|
|
|
48
|
-
@Api.field(
|
|
61
|
+
@Api.field(
|
|
62
|
+
v.title($locale('Published')),
|
|
63
|
+
v.default(false),
|
|
64
|
+
ZovaRender.order(3),
|
|
65
|
+
ZovaRender.field('basic-select:formFieldSelect', { items: categoryPublicationItems }),
|
|
66
|
+
ZovaRender.cell('basic-select:select', { items: categoryPublicationItems }),
|
|
67
|
+
)
|
|
49
68
|
published: boolean;
|
|
50
69
|
|
|
51
70
|
@Api.field(v.title($locale('Description')), v.optional(), ZovaRender.order(4))
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { TableIdentity } from 'table-identity';
|
|
2
2
|
import type { IDecoratorEntityOptions } from 'vona-module-a-orm';
|
|
3
3
|
|
|
4
|
-
import { $makeMetadata, Api, v } from 'vona-module-a-openapiutils';
|
|
4
|
+
import { $makeMetadata, $resourceName, Api, v } from 'vona-module-a-openapiutils';
|
|
5
5
|
import { Entity, EntityBase } from 'vona-module-a-orm';
|
|
6
6
|
import { ZovaRender } from 'zova-rest-cabloy-basic-admin';
|
|
7
7
|
|
|
8
8
|
import { $locale } from '../.metadata/locales.ts';
|
|
9
|
+
import { categoryPublicationItems } from './category.tsx';
|
|
9
10
|
|
|
10
11
|
export interface IEntityOptionsProduct extends IDecoratorEntityOptions {}
|
|
11
12
|
|
|
@@ -37,10 +38,29 @@ export class EntityProduct extends EntityBase {
|
|
|
37
38
|
)
|
|
38
39
|
title: string;
|
|
39
40
|
|
|
40
|
-
@Api.field(
|
|
41
|
+
@Api.field(
|
|
42
|
+
v.title($locale('Category')),
|
|
43
|
+
v.required(),
|
|
44
|
+
ZovaRender.order(2),
|
|
45
|
+
ZovaRender.field('basic-resource:formFieldResourcePicker', {
|
|
46
|
+
resource: $resourceName('commerce-catalog:category'),
|
|
47
|
+
relationName: 'category',
|
|
48
|
+
}),
|
|
49
|
+
ZovaRender.cell('basic-resource:resourcePicker', {
|
|
50
|
+
resource: $resourceName('commerce-catalog:category'),
|
|
51
|
+
relationName: 'category',
|
|
52
|
+
}),
|
|
53
|
+
v.tableIdentity(),
|
|
54
|
+
)
|
|
41
55
|
categoryId: TableIdentity;
|
|
42
56
|
|
|
43
|
-
@Api.field(
|
|
57
|
+
@Api.field(
|
|
58
|
+
v.title($locale('Published')),
|
|
59
|
+
v.default(false),
|
|
60
|
+
ZovaRender.order(3),
|
|
61
|
+
ZovaRender.field('basic-select:formFieldSelect', { items: categoryPublicationItems }),
|
|
62
|
+
ZovaRender.cell('basic-select:select', { items: categoryPublicationItems }),
|
|
63
|
+
)
|
|
44
64
|
published: boolean;
|
|
45
65
|
|
|
46
66
|
@Api.field(v.title($locale('Description')), v.optional(), ZovaRender.order(4))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IDecoratorModelOptions } from 'vona-module-a-orm';
|
|
2
2
|
|
|
3
|
-
import { BeanModelBase, Model } from 'vona-module-a-orm';
|
|
3
|
+
import { $relation, BeanModelBase, Model } from 'vona-module-a-orm';
|
|
4
4
|
|
|
5
5
|
import { EntityCategory } from '../entity/category.tsx';
|
|
6
6
|
|
|
@@ -8,6 +8,16 @@ export interface IModelOptionsCategory extends IDecoratorModelOptions<EntityCate
|
|
|
8
8
|
|
|
9
9
|
@Model<IModelOptionsCategory>({
|
|
10
10
|
entity: EntityCategory,
|
|
11
|
+
relations: {
|
|
12
|
+
parent: $relation.belongsTo(
|
|
13
|
+
'commerce-catalog:category',
|
|
14
|
+
'commerce-catalog:category',
|
|
15
|
+
'parentId',
|
|
16
|
+
{
|
|
17
|
+
columns: ['id', 'name'],
|
|
18
|
+
},
|
|
19
|
+
),
|
|
20
|
+
},
|
|
11
21
|
cache: {
|
|
12
22
|
modelsClear: 'commerce-catalog:product',
|
|
13
23
|
},
|
|
@@ -13,6 +13,7 @@ export interface IModelOptionsProduct extends IDecoratorModelOptions<EntityProdu
|
|
|
13
13
|
'commerce-catalog:product',
|
|
14
14
|
'commerce-catalog:category',
|
|
15
15
|
'categoryId',
|
|
16
|
+
{ columns: ['id', 'name', 'published'] },
|
|
16
17
|
),
|
|
17
18
|
skus: $relation.hasMany('commerce-catalog:sku', 'productId'),
|
|
18
19
|
skuAvailables: $relation.hasMany(
|
|
@@ -19,11 +19,16 @@ export class ServiceCategory extends BeanBase {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
async select(params?: IQueryParams<ModelCategory>): Promise<DtoCategorySelectRes> {
|
|
22
|
-
return await this.scope.model.category.selectAndCount(
|
|
22
|
+
return await this.scope.model.category.selectAndCount({
|
|
23
|
+
...params,
|
|
24
|
+
include: { parent: true },
|
|
25
|
+
});
|
|
23
26
|
}
|
|
24
27
|
|
|
25
28
|
async view(id: TableIdentity): Promise<DtoCategoryView | undefined> {
|
|
26
|
-
return await this.scope.model.category.getById(id
|
|
29
|
+
return await this.scope.model.category.getById(id, {
|
|
30
|
+
include: { parent: true },
|
|
31
|
+
});
|
|
27
32
|
}
|
|
28
33
|
|
|
29
34
|
async update(id: TableIdentity, category: DtoCategoryUpdate) {
|
|
@@ -22,7 +22,10 @@ export class ServiceProduct extends BeanBase {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
async select(params?: IQueryParams<ModelProduct>): Promise<DtoProductSelectRes> {
|
|
25
|
-
return await this.scope.model.product.selectAndCount(
|
|
25
|
+
return await this.scope.model.product.selectAndCount({
|
|
26
|
+
...params,
|
|
27
|
+
include: { ...params?.include, category: true },
|
|
28
|
+
});
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
async selectPublic(params: IQueryParams<ModelProduct>): Promise<DtoProductPublicSelectRes> {
|
|
@@ -50,7 +53,9 @@ export class ServiceProduct extends BeanBase {
|
|
|
50
53
|
}
|
|
51
54
|
|
|
52
55
|
async view(id: TableIdentity): Promise<DtoProductView | undefined> {
|
|
53
|
-
return await this.scope.model.product.getById(id
|
|
56
|
+
return await this.scope.model.product.getById(id, {
|
|
57
|
+
include: { category: true },
|
|
58
|
+
});
|
|
54
59
|
}
|
|
55
60
|
|
|
56
61
|
async viewPublic(id: TableIdentity): Promise<DtoProductPublic | undefined> {
|