cabloy 5.1.113 → 5.1.115
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/.claude/skills/cabloy-backend-scaffold/references/follow-up-checklist.md +4 -0
- package/.github/workflows/vona-test-mysql.yml +12 -0
- package/.github/workflows/vona-test-pg.yml +5 -1
- package/CHANGELOG.md +20 -0
- package/CLAUDE.md +4 -0
- package/cabloy-docs/backend/internal-aop-guide.md +35 -0
- package/cabloy-docs/backend/unit-testing.md +72 -1
- package/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-cli/cli-set-api/toolsIsolate/test.ts +26 -13
- package/vona/packages-utils/compose/package.json +1 -1
- package/vona/packages-utils/compose/src/index.ts +19 -11
- 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/beanContainer.ts +15 -3
- package/vona/packages-vona/vona-mock/package.json +1 -1
- package/vona/pnpm-lock.yaml +143 -12
- package/vona/pnpm-workspace.yaml +1 -1
- package/vona/src/suite/a-commerce/modules/commerce-catalog/src/.metadata/index.ts +8 -0
- package/vona/src/suite/a-commerce/modules/commerce-catalog/src/bean/meta.version.ts +1 -0
- package/vona/src/suite/a-commerce/modules/commerce-catalog/src/config/locale/en-us.ts +3 -0
- package/vona/src/suite/a-commerce/modules/commerce-catalog/src/config/locale/zh-cn.ts +3 -0
- package/vona/src/suite/a-commerce/modules/commerce-catalog/src/dto/skuAttribute.tsx +17 -0
- package/vona/src/suite/a-commerce/modules/commerce-catalog/src/entity/sku.tsx +10 -1
- package/vona/src/suite/a-commerce/modules/commerce-catalog/test/catalog.test.ts +1 -1
- package/vona/src/suite/a-commerce/modules/commerce-member/test/addressOwnership.test.ts +6 -1
- package/vona/src/suite/a-commerce/modules/commerce-payment/package.json +2 -1
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/.metadata/index.ts +228 -0
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/bean/meta.index.ts +15 -0
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/bean/meta.version.ts +35 -0
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/dto/paymentAttemptView.tsx +26 -0
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/entity/paymentAttempt.tsx +34 -0
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/model/paymentAttempt.ts +10 -0
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/service/paymentAttempt.ts +41 -0
- package/vona/src/suite/a-commerce/modules/commerce-payment/test/paymentAttempt.test.ts +33 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/package.json +4 -2
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/.metadata/index.ts +533 -2
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/.metadata/locales.ts +18 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/bean/meta.index.ts +24 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/bean/meta.version.ts +137 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/bean/ssrMenu.couponTemplate.ts +30 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/config/locale/en-us.ts +37 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/config/locale/zh-cn.ts +37 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/controller/coupon.ts +37 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/controller/couponTemplate.ts +65 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/dto/couponIssue.tsx +22 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/dto/couponMineItem.tsx +32 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/dto/couponTemplateCreate.tsx +43 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/dto/couponTemplateSelectReq.tsx +28 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/dto/couponTemplateSelectRes.tsx +11 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/dto/couponTemplateSelectResItem.tsx +39 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/dto/couponTemplateUpdate.tsx +19 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/dto/couponTemplateView.tsx +25 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/entity/couponAudit.tsx +73 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/entity/couponGrant.tsx +83 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/entity/couponTemplate.tsx +82 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/index.ts +1 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/model/couponAudit.ts +10 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/model/couponGrant.ts +10 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/model/couponTemplate.ts +10 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/service/coupon.ts +397 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/src/service/couponTemplate.ts +52 -0
- package/vona/src/suite/a-commerce/modules/commerce-promotion/test/couponReservation.test.ts +162 -0
- package/vona/src/suite/a-commerce/modules/commerce-seed/src/bean/meta.version.ts +8 -10
- package/vona/src/suite/a-commerce/modules/commerce-trade/package.json +4 -1
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/.metadata/index.ts +277 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/bean/bean.scheduleOrderExpiry.ts +26 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/bean/meta.index.ts +9 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/bean/meta.version.ts +75 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/config/locale/en-us.ts +11 -2
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/config/locale/zh-cn.ts +11 -2
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/controller/checkout.ts +19 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/dto/checkoutCreate.tsx +19 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/dto/checkoutResult.tsx +32 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/dto/orderAddressSnapshot.tsx +33 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/dto/orderCouponSnapshot.tsx +35 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/dto/orderLineSkuAttributeSnapshot.tsx +15 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/entity/order.tsx +90 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/entity/orderAudit.tsx +36 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/entity/orderLine.tsx +52 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/entity/stockReservation.tsx +4 -1
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/model/order.ts +15 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/model/orderAudit.ts +10 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/model/orderLine.ts +10 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/service/order.ts +556 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/service/stockBalance.ts +15 -20
- package/vona/src/suite/a-commerce/modules/commerce-trade/test/cartOwnership.test.ts +8 -3
- package/vona/src/suite/a-commerce/modules/commerce-trade/test/checkoutReservation.test.ts +158 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/test/orderSnapshot.test.ts +203 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/test/reservationExpiry.test.ts +163 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/test/stockBalance.test.ts +11 -6
- package/vona/src/suite/a-commerce/modules/commerce-trade/test/stockReservation.test.ts +11 -6
- package/vona/src/suite-vendor/a-image/modules/image-cloudflare/package.json +1 -1
- package/vona/src/suite-vendor/a-image/modules/image-cloudflare/src/service/imageCloudflare.ts +10 -7
- package/vona/src/suite-vendor/a-image/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-aspect/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-aspect/src/types/aopMethod.ts +16 -3
- package/vona/src/suite-vendor/a-vona/modules/a-core/package.json +4 -2
- package/vona/src/suite-vendor/a-vona/modules/a-core/src/bean/bean.core.ts +6 -0
- package/vona/src/suite-vendor/a-vona/modules/a-core/src/index.ts +1 -0
- package/vona/src/suite-vendor/a-vona/modules/a-core/src/lib/core.ts +6 -0
- package/vona/src/suite-vendor/a-vona/modules/a-core/src/types/fetch.ts +7 -0
- package/vona/src/suite-vendor/a-vona/modules/a-core/src/types/index.ts +1 -0
- package/vona/src/suite-vendor/a-vona/modules/a-executor/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/modules/a-executor/src/lib/utils.ts +5 -3
- package/vona/src/suite-vendor/a-vona/modules/a-retryable/package.json +50 -0
- package/vona/src/suite-vendor/a-vona/modules/a-retryable/src/.metadata/index.ts +55 -0
- package/vona/src/suite-vendor/a-vona/modules/a-retryable/src/.metadata/this.ts +2 -0
- package/vona/src/suite-vendor/a-vona/modules/a-retryable/src/bean/aopMethod.retryable.ts +45 -0
- package/vona/src/suite-vendor/a-vona/modules/a-retryable/src/index.ts +1 -0
- package/vona/src/suite-vendor/a-vona/modules/a-retryable/tsconfig.build.json +11 -0
- package/vona/src/suite-vendor/a-vona/modules/a-retryable/tsconfig.json +7 -0
- package/vona/src/suite-vendor/a-vona/modules/a-vona/package.json +2 -1
- package/vona/src/suite-vendor/a-vona/package.json +2 -1
- package/vona/src/suite-vendor/a-vona/tsconfig.json +3 -0
- package/zova/packages-utils/zova-jsx/package.json +3 -3
- package/zova/packages-zova/zova/package.json +3 -3
- package/zova/packages-zova/zova-core/package.json +2 -2
- package/zova/pnpm-lock.yaml +31 -31
- package/zova/src/suite/a-commerce/modules/commerce-promotion/cli/openapi.config.ts +9 -0
- package/zova/src/suite/a-commerce/modules/commerce-promotion/package.json +2 -1
- package/zova/src/suite/a-commerce/modules/commerce-promotion/src/.metadata/index.ts +115 -1
- package/zova/src/suite/a-commerce/modules/commerce-promotion/src/api/commercePromotionCoupon.ts +24 -0
- package/zova/src/suite/a-commerce/modules/commerce-promotion/src/api/openapi/baseURL.ts +5 -0
- package/zova/src/suite/a-commerce/modules/commerce-promotion/src/api/openapi/index.ts +3 -0
- package/zova/src/suite/a-commerce/modules/commerce-promotion/src/api/openapi/schemas.ts +478 -0
- package/zova/src/suite/a-commerce/modules/commerce-promotion/src/api/openapi/types.ts +8187 -0
- package/zova/src/suite/a-commerce/modules/commerce-promotion/src/apiSchema/commercePromotionCoupon.ts +13 -0
- package/zova/src/suite/a-commerce/modules/commerce-promotion/src/model/coupon.ts +19 -0
- 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/.metadata/index.ts +30 -0
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/api/commerceTradeCheckout.ts +27 -0
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/api/openapi/schemas.ts +92 -52
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/api/openapi/types.ts +1389 -848
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/apiSchema/commerceTradeCheckout.ts +13 -0
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/model/cart.ts +13 -0
- package/zova/src/suite-vendor/a-zova/modules/a-zova/package.json +3 -3
- package/zova/src/suite-vendor/a-zova/package.json +2 -2
- /package/vona/patches/{zova-core@5.1.78.patch → zova-core@5.1.79.patch} +0 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import type { IMetaVersionUpdate, IMetaVersionUpdateOptions } from 'vona-module-a-version';
|
|
2
|
+
|
|
3
|
+
import { BeanBase } from 'vona';
|
|
4
|
+
import { Meta } from 'vona-module-a-meta';
|
|
5
|
+
|
|
6
|
+
@Meta()
|
|
7
|
+
export class MetaVersion extends BeanBase implements IMetaVersionUpdate {
|
|
8
|
+
async update(options: IMetaVersionUpdateOptions) {
|
|
9
|
+
if (options.version !== 1) return;
|
|
10
|
+
|
|
11
|
+
const entityCouponTemplate = this.scope.entity.couponTemplate;
|
|
12
|
+
await this.bean.model.createTable(entityCouponTemplate.$table, table => {
|
|
13
|
+
table.comment(entityCouponTemplate.$comment.$table);
|
|
14
|
+
table.basicFields();
|
|
15
|
+
table.string(entityCouponTemplate.name, 100).comment(entityCouponTemplate.$comment.name);
|
|
16
|
+
table.string(entityCouponTemplate.state, 20).comment(entityCouponTemplate.$comment.state);
|
|
17
|
+
table
|
|
18
|
+
.string(entityCouponTemplate.currency, 3)
|
|
19
|
+
.comment(entityCouponTemplate.$comment.currency);
|
|
20
|
+
table
|
|
21
|
+
.integer(entityCouponTemplate.discountCents)
|
|
22
|
+
.comment(entityCouponTemplate.$comment.discountCents);
|
|
23
|
+
table
|
|
24
|
+
.integer(entityCouponTemplate.minSpendCents)
|
|
25
|
+
.comment(entityCouponTemplate.$comment.minSpendCents);
|
|
26
|
+
table
|
|
27
|
+
.dateTime(entityCouponTemplate.validFrom)
|
|
28
|
+
.comment(entityCouponTemplate.$comment.validFrom);
|
|
29
|
+
table
|
|
30
|
+
.dateTime(entityCouponTemplate.validUntil)
|
|
31
|
+
.comment(entityCouponTemplate.$comment.validUntil);
|
|
32
|
+
table
|
|
33
|
+
.integer(entityCouponTemplate.totalIssueLimit)
|
|
34
|
+
.nullable()
|
|
35
|
+
.comment(entityCouponTemplate.$comment.totalIssueLimit);
|
|
36
|
+
table
|
|
37
|
+
.integer(entityCouponTemplate.totalUsageLimit)
|
|
38
|
+
.nullable()
|
|
39
|
+
.comment(entityCouponTemplate.$comment.totalUsageLimit);
|
|
40
|
+
table
|
|
41
|
+
.integer(entityCouponTemplate.perCustomerIssueLimit)
|
|
42
|
+
.nullable()
|
|
43
|
+
.comment(entityCouponTemplate.$comment.perCustomerIssueLimit);
|
|
44
|
+
table
|
|
45
|
+
.int0(entityCouponTemplate.issuedCount)
|
|
46
|
+
.comment(entityCouponTemplate.$comment.issuedCount);
|
|
47
|
+
table
|
|
48
|
+
.int0(entityCouponTemplate.redeemedCount)
|
|
49
|
+
.comment(entityCouponTemplate.$comment.redeemedCount);
|
|
50
|
+
table
|
|
51
|
+
.string(entityCouponTemplate.description, 255)
|
|
52
|
+
.nullable()
|
|
53
|
+
.comment(entityCouponTemplate.$comment.description);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const entityCouponGrant = this.scope.entity.couponGrant;
|
|
57
|
+
await this.bean.model.createTable(entityCouponGrant.$table, table => {
|
|
58
|
+
table.comment(entityCouponGrant.$comment.$table);
|
|
59
|
+
table.basicFields();
|
|
60
|
+
table
|
|
61
|
+
.tableIdentity(entityCouponGrant.templateId)
|
|
62
|
+
.comment(entityCouponGrant.$comment.templateId);
|
|
63
|
+
table.userId(entityCouponGrant.userId).comment(entityCouponGrant.$comment.userId);
|
|
64
|
+
table.string(entityCouponGrant.couponCode, 80).comment(entityCouponGrant.$comment.couponCode);
|
|
65
|
+
table.string(entityCouponGrant.state, 20).comment(entityCouponGrant.$comment.state);
|
|
66
|
+
table
|
|
67
|
+
.string(entityCouponGrant.templateNameSnapshot, 100)
|
|
68
|
+
.comment(entityCouponGrant.$comment.templateNameSnapshot);
|
|
69
|
+
table
|
|
70
|
+
.string(entityCouponGrant.currencySnapshot, 3)
|
|
71
|
+
.comment(entityCouponGrant.$comment.currencySnapshot);
|
|
72
|
+
table
|
|
73
|
+
.integer(entityCouponGrant.discountCentsSnapshot)
|
|
74
|
+
.comment(entityCouponGrant.$comment.discountCentsSnapshot);
|
|
75
|
+
table
|
|
76
|
+
.integer(entityCouponGrant.minSpendCentsSnapshot)
|
|
77
|
+
.comment(entityCouponGrant.$comment.minSpendCentsSnapshot);
|
|
78
|
+
table
|
|
79
|
+
.dateTime(entityCouponGrant.validFromSnapshot)
|
|
80
|
+
.comment(entityCouponGrant.$comment.validFromSnapshot);
|
|
81
|
+
table
|
|
82
|
+
.dateTime(entityCouponGrant.validUntilSnapshot)
|
|
83
|
+
.comment(entityCouponGrant.$comment.validUntilSnapshot);
|
|
84
|
+
table
|
|
85
|
+
.tableIdentity(entityCouponGrant.reservationOrderId)
|
|
86
|
+
.nullable()
|
|
87
|
+
.comment(entityCouponGrant.$comment.reservationOrderId);
|
|
88
|
+
table
|
|
89
|
+
.string(entityCouponGrant.reservationCorrelationId, 100)
|
|
90
|
+
.nullable()
|
|
91
|
+
.comment(entityCouponGrant.$comment.reservationCorrelationId);
|
|
92
|
+
table
|
|
93
|
+
.dateTime(entityCouponGrant.reservedAt)
|
|
94
|
+
.nullable()
|
|
95
|
+
.comment(entityCouponGrant.$comment.reservedAt);
|
|
96
|
+
table
|
|
97
|
+
.tableIdentity(entityCouponGrant.redeemedOrderId)
|
|
98
|
+
.nullable()
|
|
99
|
+
.comment(entityCouponGrant.$comment.redeemedOrderId);
|
|
100
|
+
table
|
|
101
|
+
.dateTime(entityCouponGrant.redeemedAt)
|
|
102
|
+
.nullable()
|
|
103
|
+
.comment(entityCouponGrant.$comment.redeemedAt);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
const entityCouponAudit = this.scope.entity.couponAudit;
|
|
107
|
+
await this.bean.model.createTable(entityCouponAudit.$table, table => {
|
|
108
|
+
table.comment(entityCouponAudit.$comment.$table);
|
|
109
|
+
table.basicFields();
|
|
110
|
+
table
|
|
111
|
+
.tableIdentity(entityCouponAudit.couponGrantId)
|
|
112
|
+
.comment(entityCouponAudit.$comment.couponGrantId);
|
|
113
|
+
table
|
|
114
|
+
.tableIdentity(entityCouponAudit.templateId)
|
|
115
|
+
.comment(entityCouponAudit.$comment.templateId);
|
|
116
|
+
table.userId(entityCouponAudit.userId).comment(entityCouponAudit.$comment.userId);
|
|
117
|
+
table
|
|
118
|
+
.userId(entityCouponAudit.actorId)
|
|
119
|
+
.nullable()
|
|
120
|
+
.comment(entityCouponAudit.$comment.actorId);
|
|
121
|
+
table
|
|
122
|
+
.tableIdentity(entityCouponAudit.orderId)
|
|
123
|
+
.nullable()
|
|
124
|
+
.comment(entityCouponAudit.$comment.orderId);
|
|
125
|
+
table.string(entityCouponAudit.operation, 20).comment(entityCouponAudit.$comment.operation);
|
|
126
|
+
table
|
|
127
|
+
.string(entityCouponAudit.fromState, 20)
|
|
128
|
+
.nullable()
|
|
129
|
+
.comment(entityCouponAudit.$comment.fromState);
|
|
130
|
+
table.string(entityCouponAudit.toState, 20).comment(entityCouponAudit.$comment.toState);
|
|
131
|
+
table.string(entityCouponAudit.reason, 255).comment(entityCouponAudit.$comment.reason);
|
|
132
|
+
table
|
|
133
|
+
.string(entityCouponAudit.correlationId, 100)
|
|
134
|
+
.comment(entityCouponAudit.$comment.correlationId);
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
package/vona/src/suite/a-commerce/modules/commerce-promotion/src/bean/ssrMenu.couponTemplate.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { IDecoratorSsrMenuOptions } from 'vona-module-a-ssr';
|
|
2
|
+
import type { ISsrSiteOptionsCommerceAdmin } from 'vona-module-commerce-siteadmin';
|
|
3
|
+
|
|
4
|
+
import { BeanBase } from 'vona';
|
|
5
|
+
import { $order } from 'vona-module-a-openapiutils';
|
|
6
|
+
import { SsrMenu } from 'vona-module-a-ssr';
|
|
7
|
+
|
|
8
|
+
import { $locale } from '../.metadata/locales.ts';
|
|
9
|
+
|
|
10
|
+
export interface ISsrMenuOptionsCouponTemplate extends IDecoratorSsrMenuOptions<ISsrSiteOptionsCommerceAdmin> {}
|
|
11
|
+
|
|
12
|
+
@SsrMenu<ISsrMenuOptionsCouponTemplate>({
|
|
13
|
+
items: {
|
|
14
|
+
couponTemplate: {
|
|
15
|
+
title: $locale('CouponTemplate'),
|
|
16
|
+
order: $order(1),
|
|
17
|
+
icon: undefined,
|
|
18
|
+
link: 'presetResource',
|
|
19
|
+
meta: {
|
|
20
|
+
params: {
|
|
21
|
+
resource: 'commerce-promotion:couponTemplate',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
group: 'commerce-siteadmin:catalog',
|
|
25
|
+
roles: ['systemAdmin'],
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
site: ['commerce-siteadmin:commerceAdmin'],
|
|
29
|
+
})
|
|
30
|
+
export class SsrMenuCouponTemplate extends BeanBase {}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
ActorId: 'Actor ID',
|
|
3
|
+
CouponAudit: 'Coupon Audit',
|
|
4
|
+
CouponCode: 'Coupon Code',
|
|
5
|
+
CouponGrant: 'Coupon Grant',
|
|
6
|
+
CouponGrantId: 'Coupon Grant ID',
|
|
7
|
+
CouponGrantState: 'Coupon State',
|
|
8
|
+
CouponOperation: 'Coupon Operation',
|
|
9
|
+
CouponTemplate: 'Coupon Template',
|
|
10
|
+
CouponTemplateId: 'Coupon Template ID',
|
|
11
|
+
CouponTemplateState: 'Template State',
|
|
12
|
+
CorrelationId: 'Correlation ID',
|
|
13
|
+
Currency: 'Currency',
|
|
14
|
+
Description: 'Description',
|
|
15
|
+
DiscountCents: 'Fixed Discount (Cents)',
|
|
16
|
+
FromState: 'Previous State',
|
|
17
|
+
IssuedCount: 'Issued Count',
|
|
18
|
+
MinSpendCents: 'Minimum Spend (Cents)',
|
|
19
|
+
Name: 'Name',
|
|
20
|
+
Operations: 'Operations',
|
|
21
|
+
OrderId: 'Order ID',
|
|
22
|
+
PerCustomerIssueLimit: 'Per-customer Issue Limit',
|
|
23
|
+
Reason: 'Reason',
|
|
24
|
+
RedeemedAt: 'Redeemed At',
|
|
25
|
+
RedeemedCount: 'Redeemed Count',
|
|
26
|
+
RedeemedOrderId: 'Redeemed Order ID',
|
|
27
|
+
ReservationCorrelationId: 'Reservation Correlation ID',
|
|
28
|
+
ReservationOrderId: 'Reservation Order ID',
|
|
29
|
+
ReservedAt: 'Reserved At',
|
|
30
|
+
TemplateNameSnapshot: 'Template Name Snapshot',
|
|
31
|
+
ToState: 'New State',
|
|
32
|
+
TotalIssueLimit: 'Total Issue Limit',
|
|
33
|
+
TotalUsageLimit: 'Total Usage Limit',
|
|
34
|
+
UserId: 'User ID',
|
|
35
|
+
ValidFrom: 'Valid From',
|
|
36
|
+
ValidUntil: 'Valid Until',
|
|
37
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
ActorId: '操作人 ID',
|
|
3
|
+
CouponAudit: '优惠券审计',
|
|
4
|
+
CouponCode: '优惠券代码',
|
|
5
|
+
CouponGrant: '优惠券发放',
|
|
6
|
+
CouponGrantId: '优惠券发放 ID',
|
|
7
|
+
CouponGrantState: '优惠券状态',
|
|
8
|
+
CouponOperation: '优惠券操作',
|
|
9
|
+
CouponTemplate: '优惠券模板',
|
|
10
|
+
CouponTemplateId: '优惠券模板 ID',
|
|
11
|
+
CouponTemplateState: '模板状态',
|
|
12
|
+
CorrelationId: '关联 ID',
|
|
13
|
+
Currency: '币种',
|
|
14
|
+
Description: '描述',
|
|
15
|
+
DiscountCents: '固定优惠(分)',
|
|
16
|
+
FromState: '原状态',
|
|
17
|
+
IssuedCount: '已发放数',
|
|
18
|
+
MinSpendCents: '最低消费(分)',
|
|
19
|
+
Name: '名称',
|
|
20
|
+
Operations: '操作',
|
|
21
|
+
OrderId: '订单 ID',
|
|
22
|
+
PerCustomerIssueLimit: '每客户发放上限',
|
|
23
|
+
Reason: '原因',
|
|
24
|
+
RedeemedAt: '核销时间',
|
|
25
|
+
RedeemedCount: '已核销数',
|
|
26
|
+
RedeemedOrderId: '核销订单 ID',
|
|
27
|
+
ReservationCorrelationId: '保留关联 ID',
|
|
28
|
+
ReservationOrderId: '保留订单 ID',
|
|
29
|
+
ReservedAt: '保留时间',
|
|
30
|
+
TemplateNameSnapshot: '模板名称快照',
|
|
31
|
+
ToState: '新状态',
|
|
32
|
+
TotalIssueLimit: '总发放上限',
|
|
33
|
+
TotalUsageLimit: '总使用上限',
|
|
34
|
+
UserId: '用户 ID',
|
|
35
|
+
ValidFrom: '开始时间',
|
|
36
|
+
ValidUntil: '结束时间',
|
|
37
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { TableIdentity } from 'table-identity';
|
|
2
|
+
import type { IDecoratorControllerOptions } from 'vona-module-a-web';
|
|
3
|
+
|
|
4
|
+
import { BeanBase } from 'vona';
|
|
5
|
+
import { Api, v } from 'vona-module-a-openapiutils';
|
|
6
|
+
import { Passport } from 'vona-module-a-user';
|
|
7
|
+
import { Arg, Controller, Web } from 'vona-module-a-web';
|
|
8
|
+
|
|
9
|
+
import { DtoCouponIssue } from '../dto/couponIssue.tsx';
|
|
10
|
+
import { DtoCouponMineItem } from '../dto/couponMineItem.tsx';
|
|
11
|
+
|
|
12
|
+
export interface IControllerOptionsCoupon extends IDecoratorControllerOptions {}
|
|
13
|
+
|
|
14
|
+
@Controller<IControllerOptionsCoupon>('coupon')
|
|
15
|
+
export class ControllerCoupon extends BeanBase {
|
|
16
|
+
@Web.get('mine')
|
|
17
|
+
@Api.body(v.array(DtoCouponMineItem))
|
|
18
|
+
async mine(): Promise<DtoCouponMineItem[]> {
|
|
19
|
+
const grants = await this.scope.service.coupon.mine();
|
|
20
|
+
return grants.map(grant => ({
|
|
21
|
+
id: grant.id,
|
|
22
|
+
couponCode: grant.couponCode,
|
|
23
|
+
templateName: grant.templateNameSnapshot,
|
|
24
|
+
currency: grant.currencySnapshot,
|
|
25
|
+
discountCents: grant.discountCentsSnapshot,
|
|
26
|
+
minSpendCents: grant.minSpendCentsSnapshot,
|
|
27
|
+
validUntil: grant.validUntilSnapshot,
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@Web.post('issue')
|
|
32
|
+
@Api.body(v.tableIdentity())
|
|
33
|
+
@Passport.systemAdmin()
|
|
34
|
+
async issue(@Arg.body() command: DtoCouponIssue): Promise<TableIdentity> {
|
|
35
|
+
return (await this.scope.service.coupon.issue(command)).id;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { TableIdentity } from 'table-identity';
|
|
2
|
+
import type { IQueryParams } from 'vona-module-a-orm';
|
|
3
|
+
import type { IDecoratorControllerOptions } from 'vona-module-a-web';
|
|
4
|
+
|
|
5
|
+
import { BeanBase } from 'vona';
|
|
6
|
+
import { Api, Resource, v } from 'vona-module-a-openapiutils';
|
|
7
|
+
import { Passport } from 'vona-module-a-user';
|
|
8
|
+
import { Arg, Controller, Web } from 'vona-module-a-web';
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
|
|
11
|
+
import type { ModelCouponTemplate } from '../model/couponTemplate.ts';
|
|
12
|
+
|
|
13
|
+
import { DtoCouponTemplateCreate } from '../dto/couponTemplateCreate.tsx';
|
|
14
|
+
import { DtoCouponTemplateSelectReq } from '../dto/couponTemplateSelectReq.tsx';
|
|
15
|
+
import { DtoCouponTemplateSelectRes } from '../dto/couponTemplateSelectRes.tsx';
|
|
16
|
+
import { DtoCouponTemplateUpdate } from '../dto/couponTemplateUpdate.tsx';
|
|
17
|
+
import { DtoCouponTemplateView } from '../dto/couponTemplateView.tsx';
|
|
18
|
+
|
|
19
|
+
export interface IControllerOptionsCouponTemplate extends IDecoratorControllerOptions {}
|
|
20
|
+
|
|
21
|
+
@Controller<IControllerOptionsCouponTemplate>('couponTemplate')
|
|
22
|
+
@Resource()
|
|
23
|
+
export class ControllerCouponTemplate extends BeanBase {
|
|
24
|
+
@Web.post()
|
|
25
|
+
@Api.body(v.tableIdentity())
|
|
26
|
+
@Passport.systemAdmin()
|
|
27
|
+
async create(@Arg.body() couponTemplate: DtoCouponTemplateCreate): Promise<TableIdentity> {
|
|
28
|
+
return (await this.scope.service.couponTemplate.create(couponTemplate)).id;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@Web.get()
|
|
32
|
+
@Api.body(DtoCouponTemplateSelectRes)
|
|
33
|
+
@Passport.systemAdmin()
|
|
34
|
+
async select(
|
|
35
|
+
@Arg.filter(DtoCouponTemplateSelectReq) params: IQueryParams<ModelCouponTemplate>,
|
|
36
|
+
): Promise<DtoCouponTemplateSelectRes> {
|
|
37
|
+
return await this.scope.service.couponTemplate.select(params);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@Web.get(':id')
|
|
41
|
+
@Api.body(v.optional(), v.object(DtoCouponTemplateView))
|
|
42
|
+
@Passport.systemAdmin()
|
|
43
|
+
async view(
|
|
44
|
+
@Arg.param('id', v.tableIdentity()) id: TableIdentity,
|
|
45
|
+
): Promise<DtoCouponTemplateView | undefined> {
|
|
46
|
+
return await this.scope.service.couponTemplate.view(id);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@Web.patch(':id')
|
|
50
|
+
@Api.body(z.null())
|
|
51
|
+
@Passport.systemAdmin()
|
|
52
|
+
async update(
|
|
53
|
+
@Arg.param('id', v.tableIdentity()) id: TableIdentity,
|
|
54
|
+
@Arg.body() couponTemplate: DtoCouponTemplateUpdate,
|
|
55
|
+
): Promise<void> {
|
|
56
|
+
await this.scope.service.couponTemplate.update(id, couponTemplate);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@Web.delete(':id')
|
|
60
|
+
@Api.body(z.null())
|
|
61
|
+
@Passport.systemAdmin()
|
|
62
|
+
async delete(@Arg.param('id', v.tableIdentity()) id: TableIdentity): Promise<void> {
|
|
63
|
+
await this.scope.service.couponTemplate.delete(id);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { TableIdentity } from 'table-identity';
|
|
2
|
+
import type { IDecoratorDtoOptions } from 'vona-module-a-web';
|
|
3
|
+
|
|
4
|
+
import { Api, v } from 'vona-module-a-openapiutils';
|
|
5
|
+
import { Dto } from 'vona-module-a-web';
|
|
6
|
+
|
|
7
|
+
export interface IDtoOptionsCouponIssue extends IDecoratorDtoOptions {}
|
|
8
|
+
|
|
9
|
+
@Dto<IDtoOptionsCouponIssue>()
|
|
10
|
+
export class DtoCouponIssue {
|
|
11
|
+
@Api.field(v.required(), v.tableIdentity())
|
|
12
|
+
templateId: TableIdentity;
|
|
13
|
+
|
|
14
|
+
@Api.field(v.required(), v.tableIdentity())
|
|
15
|
+
userId: TableIdentity;
|
|
16
|
+
|
|
17
|
+
@Api.field(v.required(), v.min(1), v.max(100))
|
|
18
|
+
correlationId: string;
|
|
19
|
+
|
|
20
|
+
@Api.field(v.required(), v.min(1), v.max(255))
|
|
21
|
+
reason: string;
|
|
22
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { TableIdentity } from 'table-identity';
|
|
2
|
+
import type { IDecoratorDtoOptions } from 'vona-module-a-web';
|
|
3
|
+
|
|
4
|
+
import { Api, v } from 'vona-module-a-openapiutils';
|
|
5
|
+
import { Dto } from 'vona-module-a-web';
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
|
|
8
|
+
export interface IDtoOptionsCouponMineItem extends IDecoratorDtoOptions {}
|
|
9
|
+
|
|
10
|
+
@Dto<IDtoOptionsCouponMineItem>()
|
|
11
|
+
export class DtoCouponMineItem {
|
|
12
|
+
@Api.field(v.required(), v.tableIdentity())
|
|
13
|
+
id: TableIdentity;
|
|
14
|
+
|
|
15
|
+
@Api.field(v.required(), v.min(1), v.max(80))
|
|
16
|
+
couponCode: string;
|
|
17
|
+
|
|
18
|
+
@Api.field(v.required(), v.min(1), v.max(100))
|
|
19
|
+
templateName: string;
|
|
20
|
+
|
|
21
|
+
@Api.field(v.required(), z.literal('USD'))
|
|
22
|
+
currency: 'USD';
|
|
23
|
+
|
|
24
|
+
@Api.field(v.required(), z.number().int().positive())
|
|
25
|
+
discountCents: number;
|
|
26
|
+
|
|
27
|
+
@Api.field(v.required(), z.number().int().nonnegative())
|
|
28
|
+
minSpendCents: number;
|
|
29
|
+
|
|
30
|
+
@Api.field(v.required())
|
|
31
|
+
validUntil: Date;
|
|
32
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { IDecoratorDtoOptions } from 'vona-module-a-web';
|
|
2
|
+
|
|
3
|
+
import { Api, v } from 'vona-module-a-openapiutils';
|
|
4
|
+
import { Dto } from 'vona-module-a-web';
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
|
|
7
|
+
export interface IDtoOptionsCouponTemplateCreate extends IDecoratorDtoOptions {}
|
|
8
|
+
|
|
9
|
+
@Dto<IDtoOptionsCouponTemplateCreate>()
|
|
10
|
+
export class DtoCouponTemplateCreate {
|
|
11
|
+
@Api.field(v.required(), v.min(2), v.max(100))
|
|
12
|
+
name: string;
|
|
13
|
+
|
|
14
|
+
@Api.field(v.required(), z.enum(['draft', 'active']))
|
|
15
|
+
state: 'draft' | 'active';
|
|
16
|
+
|
|
17
|
+
@Api.field(v.required(), z.literal('USD'))
|
|
18
|
+
currency: 'USD';
|
|
19
|
+
|
|
20
|
+
@Api.field(v.required(), z.number().int().positive())
|
|
21
|
+
discountCents: number;
|
|
22
|
+
|
|
23
|
+
@Api.field(v.required(), z.number().int().nonnegative())
|
|
24
|
+
minSpendCents: number;
|
|
25
|
+
|
|
26
|
+
@Api.field(v.required())
|
|
27
|
+
validFrom: Date;
|
|
28
|
+
|
|
29
|
+
@Api.field(v.required())
|
|
30
|
+
validUntil: Date;
|
|
31
|
+
|
|
32
|
+
@Api.field(v.optional(), z.number().int().positive())
|
|
33
|
+
totalIssueLimit?: number;
|
|
34
|
+
|
|
35
|
+
@Api.field(v.optional(), z.number().int().positive())
|
|
36
|
+
totalUsageLimit?: number;
|
|
37
|
+
|
|
38
|
+
@Api.field(v.optional(), z.number().int().positive())
|
|
39
|
+
perCustomerIssueLimit?: number;
|
|
40
|
+
|
|
41
|
+
@Api.field(v.optional(), v.max(255))
|
|
42
|
+
description?: string;
|
|
43
|
+
}
|
package/vona/src/suite/a-commerce/modules/commerce-promotion/src/dto/couponTemplateSelectReq.tsx
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { IDecoratorDtoOptions } from 'vona-module-a-web';
|
|
2
|
+
|
|
3
|
+
import { $makeSchema, v } from 'vona-module-a-openapiutils';
|
|
4
|
+
import { $Dto } from 'vona-module-a-orm';
|
|
5
|
+
import { Dto } from 'vona-module-a-web';
|
|
6
|
+
import z from 'zod';
|
|
7
|
+
import { ZovaRender } from 'zova-rest-cabloy-basic-admin';
|
|
8
|
+
|
|
9
|
+
import { EntityCouponTemplate } from '../entity/couponTemplate.tsx';
|
|
10
|
+
|
|
11
|
+
export interface IDtoOptionsCouponTemplateSelectReq extends IDecoratorDtoOptions {}
|
|
12
|
+
|
|
13
|
+
@Dto<IDtoOptionsCouponTemplateSelectReq>({
|
|
14
|
+
openapi: { filter: { table: 'commercePromotionCouponTemplate' } },
|
|
15
|
+
fields: {
|
|
16
|
+
name: $makeSchema(v.optional(), z.string()),
|
|
17
|
+
createdAt: $makeSchema(
|
|
18
|
+
ZovaRender.field('basic-date:formFieldDateRange'),
|
|
19
|
+
v.filterTransform('a-web:dateRange'),
|
|
20
|
+
v.optional(),
|
|
21
|
+
z.string(),
|
|
22
|
+
),
|
|
23
|
+
},
|
|
24
|
+
})
|
|
25
|
+
export class DtoCouponTemplateSelectReq extends $Dto.queryPage(EntityCouponTemplate, [
|
|
26
|
+
'name',
|
|
27
|
+
'createdAt',
|
|
28
|
+
]) {}
|
package/vona/src/suite/a-commerce/modules/commerce-promotion/src/dto/couponTemplateSelectRes.tsx
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { IDecoratorDtoOptions } from 'vona-module-a-web';
|
|
2
|
+
|
|
3
|
+
import { $Dto } from 'vona-module-a-orm';
|
|
4
|
+
import { Dto } from 'vona-module-a-web';
|
|
5
|
+
|
|
6
|
+
import { DtoCouponTemplateSelectResItem } from './couponTemplateSelectResItem.tsx';
|
|
7
|
+
|
|
8
|
+
export interface IDtoOptionsCouponTemplateSelectRes extends IDecoratorDtoOptions {}
|
|
9
|
+
|
|
10
|
+
@Dto<IDtoOptionsCouponTemplateSelectRes>()
|
|
11
|
+
export class DtoCouponTemplateSelectRes extends $Dto.listAndCount(DtoCouponTemplateSelectResItem) {}
|
package/vona/src/suite/a-commerce/modules/commerce-promotion/src/dto/couponTemplateSelectResItem.tsx
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { IDecoratorDtoOptions } from 'vona-module-a-web';
|
|
2
|
+
|
|
3
|
+
import { Api, v } from 'vona-module-a-openapiutils';
|
|
4
|
+
import { $Dto } from 'vona-module-a-orm';
|
|
5
|
+
import { Dto } from 'vona-module-a-web';
|
|
6
|
+
import { ZovaRender } from 'zova-rest-cabloy-basic-admin';
|
|
7
|
+
|
|
8
|
+
import { $locale } from '../.metadata/locales.ts';
|
|
9
|
+
import { ModelCouponTemplate } from '../model/couponTemplate.ts';
|
|
10
|
+
|
|
11
|
+
export interface IDtoOptionsCouponTemplateSelectResItem extends IDecoratorDtoOptions {}
|
|
12
|
+
|
|
13
|
+
@Dto<IDtoOptionsCouponTemplateSelectResItem>({
|
|
14
|
+
blocks: [
|
|
15
|
+
ZovaRender.block('basic-page:blockPage', {
|
|
16
|
+
blocks: [
|
|
17
|
+
ZovaRender.block('basic-page:blockFilter'),
|
|
18
|
+
ZovaRender.block('basic-page:blockToolbarBulk', {
|
|
19
|
+
actions: [ZovaRender.tableActionBulk('basic-table:actionCreate')],
|
|
20
|
+
}),
|
|
21
|
+
ZovaRender.block('basic-page:blockTable'),
|
|
22
|
+
ZovaRender.block('basic-page:blockPager'),
|
|
23
|
+
],
|
|
24
|
+
}),
|
|
25
|
+
],
|
|
26
|
+
})
|
|
27
|
+
export class DtoCouponTemplateSelectResItem extends $Dto.get(() => ModelCouponTemplate) {
|
|
28
|
+
@Api.field(
|
|
29
|
+
v.title($locale('Operations')),
|
|
30
|
+
ZovaRender.order(1, 'max'),
|
|
31
|
+
ZovaRender.cell('basic-table:actionOperationsRow', {
|
|
32
|
+
actions: [
|
|
33
|
+
ZovaRender.tableActionRow('basic-table:actionUpdate'),
|
|
34
|
+
ZovaRender.tableActionRow('basic-table:actionDelete'),
|
|
35
|
+
],
|
|
36
|
+
}),
|
|
37
|
+
)
|
|
38
|
+
_operationsRow?: unknown;
|
|
39
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { IDecoratorDtoOptions } from 'vona-module-a-web';
|
|
2
|
+
|
|
3
|
+
import { Api, v } from 'vona-module-a-openapiutils';
|
|
4
|
+
import { Dto } from 'vona-module-a-web';
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
|
|
7
|
+
export interface IDtoOptionsCouponTemplateUpdate extends IDecoratorDtoOptions {}
|
|
8
|
+
|
|
9
|
+
@Dto<IDtoOptionsCouponTemplateUpdate>()
|
|
10
|
+
export class DtoCouponTemplateUpdate {
|
|
11
|
+
@Api.field(v.optional(), v.min(2), v.max(100))
|
|
12
|
+
name?: string;
|
|
13
|
+
|
|
14
|
+
@Api.field(v.optional(), z.enum(['draft', 'active', 'disabled']))
|
|
15
|
+
state?: 'draft' | 'active' | 'disabled';
|
|
16
|
+
|
|
17
|
+
@Api.field(v.optional(), v.max(255))
|
|
18
|
+
description?: string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { IDecoratorDtoOptions } from 'vona-module-a-web';
|
|
2
|
+
|
|
3
|
+
import { $Dto } from 'vona-module-a-orm';
|
|
4
|
+
import { Dto } from 'vona-module-a-web';
|
|
5
|
+
import { ZovaRender } from 'zova-rest-cabloy-basic-admin';
|
|
6
|
+
|
|
7
|
+
import { ModelCouponTemplate } from '../model/couponTemplate.ts';
|
|
8
|
+
|
|
9
|
+
export interface IDtoOptionsCouponTemplateView extends IDecoratorDtoOptions {}
|
|
10
|
+
|
|
11
|
+
@Dto<IDtoOptionsCouponTemplateView>({
|
|
12
|
+
blocks: [
|
|
13
|
+
ZovaRender.block('basic-pageentry:blockPageEntry', {
|
|
14
|
+
blocks: [
|
|
15
|
+
ZovaRender.block('basic-pageentry:blockForm'),
|
|
16
|
+
ZovaRender.block('basic-pageentry:blockToolbarRow', {
|
|
17
|
+
actions: [
|
|
18
|
+
ZovaRender.formActionRow('basic-form:actionBack', { permission: { public: true } }),
|
|
19
|
+
],
|
|
20
|
+
}),
|
|
21
|
+
],
|
|
22
|
+
}),
|
|
23
|
+
],
|
|
24
|
+
})
|
|
25
|
+
export class DtoCouponTemplateView extends $Dto.get(() => ModelCouponTemplate) {}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { TableIdentity } from 'table-identity';
|
|
2
|
+
import type { IDecoratorEntityOptions } from 'vona-module-a-orm';
|
|
3
|
+
|
|
4
|
+
import { $makeMetadata, Api, v } from 'vona-module-a-openapiutils';
|
|
5
|
+
import { Entity, EntityBase } from 'vona-module-a-orm';
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
import { ZovaRender } from 'zova-rest-cabloy-basic-admin';
|
|
8
|
+
|
|
9
|
+
import type { TypeCouponGrantState } from './couponGrant.tsx';
|
|
10
|
+
|
|
11
|
+
import { $locale } from '../.metadata/locales.ts';
|
|
12
|
+
|
|
13
|
+
export type TypeCouponAuditOperation = 'issue' | 'reserve' | 'release' | 'redeem' | 'expire';
|
|
14
|
+
|
|
15
|
+
export interface IEntityOptionsCouponAudit extends IDecoratorEntityOptions {}
|
|
16
|
+
|
|
17
|
+
@Entity<IEntityOptionsCouponAudit>('commercePromotionCouponAudit', {
|
|
18
|
+
openapi: { title: $locale('CouponAudit') },
|
|
19
|
+
fields: {
|
|
20
|
+
id: $makeMetadata(ZovaRender.order(1, 'core')),
|
|
21
|
+
iid: $makeMetadata(ZovaRender.visible(false)),
|
|
22
|
+
deleted: $makeMetadata(ZovaRender.visible(false)),
|
|
23
|
+
createdAt: $makeMetadata(
|
|
24
|
+
ZovaRender.order(-2, 'max'),
|
|
25
|
+
ZovaRender.field('basic-date:formFieldDate'),
|
|
26
|
+
ZovaRender.cell('basic-date:date'),
|
|
27
|
+
),
|
|
28
|
+
updatedAt: $makeMetadata(ZovaRender.visible(false)),
|
|
29
|
+
},
|
|
30
|
+
})
|
|
31
|
+
export class EntityCouponAudit extends EntityBase {
|
|
32
|
+
@Api.field(v.title($locale('CouponGrantId')), v.required(), v.tableIdentity())
|
|
33
|
+
couponGrantId: TableIdentity;
|
|
34
|
+
|
|
35
|
+
@Api.field(v.title($locale('CouponTemplateId')), v.required(), v.tableIdentity())
|
|
36
|
+
templateId: TableIdentity;
|
|
37
|
+
|
|
38
|
+
@Api.field(v.title($locale('UserId')), v.required(), v.tableIdentity())
|
|
39
|
+
userId: TableIdentity;
|
|
40
|
+
|
|
41
|
+
@Api.field(v.title($locale('OrderId')), v.optional(), v.tableIdentity())
|
|
42
|
+
orderId?: TableIdentity;
|
|
43
|
+
|
|
44
|
+
@Api.field(v.title($locale('ActorId')), v.optional(), v.tableIdentity())
|
|
45
|
+
actorId?: TableIdentity;
|
|
46
|
+
|
|
47
|
+
@Api.field(
|
|
48
|
+
v.title($locale('CouponOperation')),
|
|
49
|
+
v.required(),
|
|
50
|
+
z.enum(['issue', 'reserve', 'release', 'redeem', 'expire']),
|
|
51
|
+
)
|
|
52
|
+
operation: TypeCouponAuditOperation;
|
|
53
|
+
|
|
54
|
+
@Api.field(
|
|
55
|
+
v.title($locale('FromState')),
|
|
56
|
+
v.optional(),
|
|
57
|
+
z.enum(['available', 'reserved', 'redeemed', 'expired']),
|
|
58
|
+
)
|
|
59
|
+
fromState?: TypeCouponGrantState;
|
|
60
|
+
|
|
61
|
+
@Api.field(
|
|
62
|
+
v.title($locale('ToState')),
|
|
63
|
+
v.required(),
|
|
64
|
+
z.enum(['available', 'reserved', 'redeemed', 'expired']),
|
|
65
|
+
)
|
|
66
|
+
toState: TypeCouponGrantState;
|
|
67
|
+
|
|
68
|
+
@Api.field(v.title($locale('Reason')), v.required(), v.min(1), v.max(255))
|
|
69
|
+
reason: string;
|
|
70
|
+
|
|
71
|
+
@Api.field(v.title($locale('CorrelationId')), v.required(), v.min(1), v.max(100))
|
|
72
|
+
correlationId: string;
|
|
73
|
+
}
|