@things-factory/product-base 4.3.660 → 4.3.671

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.
Files changed (111) hide show
  1. package/package.json +4 -4
  2. package/dist-server/constants/index.js +0 -18
  3. package/dist-server/constants/index.js.map +0 -1
  4. package/dist-server/constants/product.js +0 -25
  5. package/dist-server/constants/product.js.map +0 -1
  6. package/dist-server/controllers/index.js +0 -1
  7. package/dist-server/controllers/index.js.map +0 -1
  8. package/dist-server/index.js +0 -19
  9. package/dist-server/index.js.map +0 -1
  10. package/dist-server/middlewares/index.js +0 -1
  11. package/dist-server/middlewares/index.js.map +0 -1
  12. package/dist-server/migrations/index.js +0 -12
  13. package/dist-server/migrations/index.js.map +0 -1
  14. package/dist-server/service/index.js +0 -74
  15. package/dist-server/service/index.js.map +0 -1
  16. package/dist-server/service/product/index.js +0 -10
  17. package/dist-server/service/product/index.js.map +0 -1
  18. package/dist-server/service/product/product-mutation.js +0 -408
  19. package/dist-server/service/product/product-mutation.js.map +0 -1
  20. package/dist-server/service/product/product-query.js +0 -373
  21. package/dist-server/service/product/product-query.js.map +0 -1
  22. package/dist-server/service/product/product-types.js +0 -618
  23. package/dist-server/service/product/product-types.js.map +0 -1
  24. package/dist-server/service/product/product.js +0 -615
  25. package/dist-server/service/product/product.js.map +0 -1
  26. package/dist-server/service/product/validate-product.js +0 -26
  27. package/dist-server/service/product/validate-product.js.map +0 -1
  28. package/dist-server/service/product-barcode/index.js +0 -9
  29. package/dist-server/service/product-barcode/index.js.map +0 -1
  30. package/dist-server/service/product-barcode/product-barcode-mutation.js +0 -120
  31. package/dist-server/service/product-barcode/product-barcode-mutation.js.map +0 -1
  32. package/dist-server/service/product-barcode/product-barcode-query.js +0 -87
  33. package/dist-server/service/product-barcode/product-barcode-query.js.map +0 -1
  34. package/dist-server/service/product-barcode/product-barcode-type.js +0 -63
  35. package/dist-server/service/product-barcode/product-barcode-type.js.map +0 -1
  36. package/dist-server/service/product-barcode/product-barcode.js +0 -104
  37. package/dist-server/service/product-barcode/product-barcode.js.map +0 -1
  38. package/dist-server/service/product-bundle/index.js +0 -9
  39. package/dist-server/service/product-bundle/index.js.map +0 -1
  40. package/dist-server/service/product-bundle/product-bundle-mutation.js +0 -130
  41. package/dist-server/service/product-bundle/product-bundle-mutation.js.map +0 -1
  42. package/dist-server/service/product-bundle/product-bundle-query.js +0 -128
  43. package/dist-server/service/product-bundle/product-bundle-query.js.map +0 -1
  44. package/dist-server/service/product-bundle/product-bundle-types.js +0 -85
  45. package/dist-server/service/product-bundle/product-bundle-types.js.map +0 -1
  46. package/dist-server/service/product-bundle/product-bundle.js +0 -128
  47. package/dist-server/service/product-bundle/product-bundle.js.map +0 -1
  48. package/dist-server/service/product-bundle-setting/index.js +0 -9
  49. package/dist-server/service/product-bundle-setting/index.js.map +0 -1
  50. package/dist-server/service/product-bundle-setting/product-bundle-setting-mutation.js +0 -165
  51. package/dist-server/service/product-bundle-setting/product-bundle-setting-mutation.js.map +0 -1
  52. package/dist-server/service/product-bundle-setting/product-bundle-setting-query.js +0 -113
  53. package/dist-server/service/product-bundle-setting/product-bundle-setting-query.js.map +0 -1
  54. package/dist-server/service/product-bundle-setting/product-bundle-setting-types.js +0 -69
  55. package/dist-server/service/product-bundle-setting/product-bundle-setting-types.js.map +0 -1
  56. package/dist-server/service/product-bundle-setting/product-bundle-setting.js +0 -63
  57. package/dist-server/service/product-bundle-setting/product-bundle-setting.js.map +0 -1
  58. package/dist-server/service/product-combination/index.js +0 -9
  59. package/dist-server/service/product-combination/index.js.map +0 -1
  60. package/dist-server/service/product-combination/product-combination-mutation.js +0 -137
  61. package/dist-server/service/product-combination/product-combination-mutation.js.map +0 -1
  62. package/dist-server/service/product-combination/product-combination-query.js +0 -86
  63. package/dist-server/service/product-combination/product-combination-query.js.map +0 -1
  64. package/dist-server/service/product-combination/product-combination-type.js +0 -83
  65. package/dist-server/service/product-combination/product-combination-type.js.map +0 -1
  66. package/dist-server/service/product-combination/product-combination.js +0 -133
  67. package/dist-server/service/product-combination/product-combination.js.map +0 -1
  68. package/dist-server/service/product-combination-setting/index.js +0 -9
  69. package/dist-server/service/product-combination-setting/index.js.map +0 -1
  70. package/dist-server/service/product-combination-setting/product-combination-setting-mutation.js +0 -221
  71. package/dist-server/service/product-combination-setting/product-combination-setting-mutation.js.map +0 -1
  72. package/dist-server/service/product-combination-setting/product-combination-setting-query.js +0 -177
  73. package/dist-server/service/product-combination-setting/product-combination-setting-query.js.map +0 -1
  74. package/dist-server/service/product-combination-setting/product-combination-setting-type.js +0 -75
  75. package/dist-server/service/product-combination-setting/product-combination-setting-type.js.map +0 -1
  76. package/dist-server/service/product-combination-setting/product-combination-setting.js +0 -105
  77. package/dist-server/service/product-combination-setting/product-combination-setting.js.map +0 -1
  78. package/dist-server/service/product-detail/index.js +0 -9
  79. package/dist-server/service/product-detail/index.js.map +0 -1
  80. package/dist-server/service/product-detail/product-detail-mutation.js +0 -374
  81. package/dist-server/service/product-detail/product-detail-mutation.js.map +0 -1
  82. package/dist-server/service/product-detail/product-detail-query.js +0 -223
  83. package/dist-server/service/product-detail/product-detail-query.js.map +0 -1
  84. package/dist-server/service/product-detail/product-detail-types.js +0 -392
  85. package/dist-server/service/product-detail/product-detail-types.js.map +0 -1
  86. package/dist-server/service/product-detail/product-detail.js +0 -444
  87. package/dist-server/service/product-detail/product-detail.js.map +0 -1
  88. package/dist-server/service/product-detail-bizplace-setting/index.js +0 -9
  89. package/dist-server/service/product-detail-bizplace-setting/index.js.map +0 -1
  90. package/dist-server/service/product-detail-bizplace-setting/product-detail-bizplace-setting-mutation.js +0 -118
  91. package/dist-server/service/product-detail-bizplace-setting/product-detail-bizplace-setting-mutation.js.map +0 -1
  92. package/dist-server/service/product-detail-bizplace-setting/product-detail-bizplace-setting-query.js +0 -107
  93. package/dist-server/service/product-detail-bizplace-setting/product-detail-bizplace-setting-query.js.map +0 -1
  94. package/dist-server/service/product-detail-bizplace-setting/product-detail-bizplace-setting-types.js +0 -99
  95. package/dist-server/service/product-detail-bizplace-setting/product-detail-bizplace-setting-types.js.map +0 -1
  96. package/dist-server/service/product-detail-bizplace-setting/product-detail-bizplace-setting.js +0 -120
  97. package/dist-server/service/product-detail-bizplace-setting/product-detail-bizplace-setting.js.map +0 -1
  98. package/dist-server/service/product-set/index.js +0 -9
  99. package/dist-server/service/product-set/index.js.map +0 -1
  100. package/dist-server/service/product-set/product-set-mutation.js +0 -146
  101. package/dist-server/service/product-set/product-set-mutation.js.map +0 -1
  102. package/dist-server/service/product-set/product-set-query.js +0 -136
  103. package/dist-server/service/product-set/product-set-query.js.map +0 -1
  104. package/dist-server/service/product-set/product-set-types.js +0 -77
  105. package/dist-server/service/product-set/product-set-types.js.map +0 -1
  106. package/dist-server/service/product-set/product-set.js +0 -118
  107. package/dist-server/service/product-set/product-set.js.map +0 -1
  108. package/dist-server/utils/index.js +0 -18
  109. package/dist-server/utils/index.js.map +0 -1
  110. package/dist-server/utils/product-util.js +0 -16
  111. package/dist-server/utils/product-util.js.map +0 -1
@@ -1,128 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- var __param = (this && this.__param) || function (paramIndex, decorator) {
12
- return function (target, key) { decorator(target, key, paramIndex); }
13
- };
14
- var _a, _b;
15
- Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.ProductBundleQuery = void 0;
17
- const type_graphql_1 = require("type-graphql");
18
- const typeorm_1 = require("typeorm");
19
- const auth_base_1 = require("@things-factory/auth-base");
20
- const biz_base_1 = require("@things-factory/biz-base");
21
- const shell_1 = require("@things-factory/shell");
22
- const constants_1 = require("../../constants");
23
- const product_bundle_1 = require("./product-bundle");
24
- const product_bundle_types_1 = require("./product-bundle-types");
25
- let ProductBundleQuery = class ProductBundleQuery {
26
- async myBizplaceProductBundles(params, context) {
27
- const { domain } = context.state;
28
- const qb = (0, typeorm_1.getRepository)(product_bundle_1.ProductBundle).createQueryBuilder();
29
- const productBundleFilter = params.filters.find(x => x.name == 'product_info');
30
- const productFilterColumns = ['sku', 'name', 'description'];
31
- let filters = params.filters.filter(x => x.name != 'product_info');
32
- // add status filter to prevent user to see DELETED product bundles
33
- filters = [...filters, { name: 'status', operator: 'noteq', value: constants_1.PRODUCT_BUNDLE_STATUS.DELETED }];
34
- if (!params.filters.find(filter => filter.name === 'bizplace_id')) {
35
- let bizplace = await (0, typeorm_1.getRepository)(biz_base_1.Bizplace).findOne({ where: { domain } });
36
- params.filters = [...filters, { name: 'bizplace_id', operator: 'in', value: [bizplace.id] }];
37
- }
38
- (0, shell_1.buildQuery)(qb, params, context, false);
39
- if (productBundleFilter) {
40
- qb.andWhere(new typeorm_1.Brackets(qb2 => {
41
- productFilterColumns.forEach(filter => {
42
- const condition = (0, shell_1.buildCondition)(qb.alias, filter, productBundleFilter.operator, productBundleFilter.value, productBundleFilter.relation, Object.keys(qb.getParameters()).length);
43
- qb2.orWhere(condition.clause, condition.parameters);
44
- });
45
- }));
46
- }
47
- const [items, total] = await qb
48
- .leftJoinAndSelect('ProductBundle.productBundleSettings', 'ProductBundleSetting')
49
- .leftJoinAndSelect('ProductBundleSetting.product', 'Product')
50
- .leftJoinAndSelect('ProductBundleSetting.productDetail', 'ProductDetail')
51
- .leftJoinAndSelect('ProductBundle.bizplace', 'Bizplace')
52
- .leftJoinAndSelect('ProductBundle.creator', 'Creator')
53
- .leftJoinAndSelect('ProductBundle.updater', 'Updater')
54
- .getManyAndCount();
55
- return { items, total };
56
- }
57
- async productBundles(params, context) {
58
- const convertedParams = (0, shell_1.convertListParams)(params);
59
- const [items, total] = await (0, typeorm_1.getRepository)(product_bundle_1.ProductBundle).findAndCount(Object.assign({}, convertedParams));
60
- return { items, total };
61
- }
62
- async productBundle(name, context) {
63
- const { domain, user } = context.state;
64
- const repository = (0, typeorm_1.getRepository)(product_bundle_1.ProductBundle);
65
- return await repository.findOne({
66
- where: { domain, name }
67
- });
68
- }
69
- async domain(productBundle) {
70
- return await (0, typeorm_1.getRepository)(shell_1.Domain).findOne(productBundle.domainId);
71
- }
72
- async creator(productBundle) {
73
- return await (0, typeorm_1.getRepository)(auth_base_1.User).findOne(productBundle.creatorId);
74
- }
75
- async updater(productBundle) {
76
- return await (0, typeorm_1.getRepository)(auth_base_1.User).findOne(productBundle.updaterId);
77
- }
78
- };
79
- __decorate([
80
- (0, type_graphql_1.Query)(returns => product_bundle_types_1.ProductBundleList),
81
- __param(0, (0, type_graphql_1.Args)()),
82
- __param(1, (0, type_graphql_1.Ctx)()),
83
- __metadata("design:type", Function),
84
- __metadata("design:paramtypes", [typeof (_a = typeof shell_1.ListParam !== "undefined" && shell_1.ListParam) === "function" ? _a : Object, Object]),
85
- __metadata("design:returntype", Promise)
86
- ], ProductBundleQuery.prototype, "myBizplaceProductBundles", null);
87
- __decorate([
88
- (0, type_graphql_1.Query)(returns => product_bundle_types_1.ProductBundleList),
89
- __param(0, (0, type_graphql_1.Args)()),
90
- __param(1, (0, type_graphql_1.Ctx)()),
91
- __metadata("design:type", Function),
92
- __metadata("design:paramtypes", [typeof (_b = typeof shell_1.ListParam !== "undefined" && shell_1.ListParam) === "function" ? _b : Object, Object]),
93
- __metadata("design:returntype", Promise)
94
- ], ProductBundleQuery.prototype, "productBundles", null);
95
- __decorate([
96
- (0, type_graphql_1.Query)(returns => product_bundle_1.ProductBundle),
97
- __param(0, (0, type_graphql_1.Arg)('name')),
98
- __param(1, (0, type_graphql_1.Ctx)()),
99
- __metadata("design:type", Function),
100
- __metadata("design:paramtypes", [String, Object]),
101
- __metadata("design:returntype", Promise)
102
- ], ProductBundleQuery.prototype, "productBundle", null);
103
- __decorate([
104
- (0, type_graphql_1.FieldResolver)(type => shell_1.Domain),
105
- __param(0, (0, type_graphql_1.Root)()),
106
- __metadata("design:type", Function),
107
- __metadata("design:paramtypes", [product_bundle_1.ProductBundle]),
108
- __metadata("design:returntype", Promise)
109
- ], ProductBundleQuery.prototype, "domain", null);
110
- __decorate([
111
- (0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
112
- __param(0, (0, type_graphql_1.Root)()),
113
- __metadata("design:type", Function),
114
- __metadata("design:paramtypes", [product_bundle_1.ProductBundle]),
115
- __metadata("design:returntype", Promise)
116
- ], ProductBundleQuery.prototype, "creator", null);
117
- __decorate([
118
- (0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
119
- __param(0, (0, type_graphql_1.Root)()),
120
- __metadata("design:type", Function),
121
- __metadata("design:paramtypes", [product_bundle_1.ProductBundle]),
122
- __metadata("design:returntype", Promise)
123
- ], ProductBundleQuery.prototype, "updater", null);
124
- ProductBundleQuery = __decorate([
125
- (0, type_graphql_1.Resolver)(product_bundle_1.ProductBundle)
126
- ], ProductBundleQuery);
127
- exports.ProductBundleQuery = ProductBundleQuery;
128
- //# sourceMappingURL=product-bundle-query.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"product-bundle-query.js","sourceRoot":"","sources":["../../../server/service/product-bundle/product-bundle-query.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAAmF;AACnF,qCAAqE;AAErE,yDAAgD;AAChD,uDAAmD;AACnD,iDAAwG;AAExG,+CAAuD;AACvD,qDAAgD;AAChD,iEAA0D;AAGnD,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAEvB,AAAN,KAAK,CAAC,wBAAwB,CAAS,MAAiB,EAAS,OAAY;QAC3E,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,WAAA,IAAA,kBAAG,GAAE,CAAA;;;;uDAOpD;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IAChB,WAAA,IAAA,mBAAI,GAAE,CAAA;;qCAAgB,8BAAa;;gDAEhD;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,WAAA,IAAA,mBAAI,GAAE,CAAA;;qCAAgB,8BAAa;;iDAEjD;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,WAAA,IAAA,mBAAI,GAAE,CAAA;;qCAAgB,8BAAa;;iDAEjD;AApFU,kBAAkB;IAD9B,IAAA,uBAAQ,EAAC,8BAAa,CAAC;GACX,kBAAkB,CAqF9B;AArFY,gDAAkB"}
@@ -1,85 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.ProductBundlePatch = exports.ProductBundleList = exports.NewProductBundle = void 0;
13
- const type_graphql_1 = require("type-graphql");
14
- const product_bundle_1 = require("./product-bundle");
15
- let NewProductBundle = class NewProductBundle {
16
- };
17
- __decorate([
18
- (0, type_graphql_1.Field)(),
19
- __metadata("design:type", String)
20
- ], NewProductBundle.prototype, "name", void 0);
21
- __decorate([
22
- (0, type_graphql_1.Field)({ nullable: true }),
23
- __metadata("design:type", String)
24
- ], NewProductBundle.prototype, "description", void 0);
25
- NewProductBundle = __decorate([
26
- (0, type_graphql_1.InputType)()
27
- ], NewProductBundle);
28
- exports.NewProductBundle = NewProductBundle;
29
- let ProductBundleList = class ProductBundleList {
30
- };
31
- __decorate([
32
- (0, type_graphql_1.Field)(type => [product_bundle_1.ProductBundle], { nullable: true }),
33
- __metadata("design:type", Array)
34
- ], ProductBundleList.prototype, "items", void 0);
35
- __decorate([
36
- (0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true }),
37
- __metadata("design:type", Number)
38
- ], ProductBundleList.prototype, "total", void 0);
39
- ProductBundleList = __decorate([
40
- (0, type_graphql_1.ObjectType)()
41
- ], ProductBundleList);
42
- exports.ProductBundleList = ProductBundleList;
43
- let ProductBundlePatch = class ProductBundlePatch {
44
- };
45
- __decorate([
46
- (0, type_graphql_1.Field)({ nullable: true }),
47
- __metadata("design:type", String)
48
- ], ProductBundlePatch.prototype, "id", void 0);
49
- __decorate([
50
- (0, type_graphql_1.Field)({ nullable: true }),
51
- __metadata("design:type", String)
52
- ], ProductBundlePatch.prototype, "sku", void 0);
53
- __decorate([
54
- (0, type_graphql_1.Field)({ nullable: true }),
55
- __metadata("design:type", String)
56
- ], ProductBundlePatch.prototype, "name", void 0);
57
- __decorate([
58
- (0, type_graphql_1.Field)({ nullable: true }),
59
- __metadata("design:type", String)
60
- ], ProductBundlePatch.prototype, "description", void 0);
61
- __decorate([
62
- (0, type_graphql_1.Field)({ nullable: true }),
63
- __metadata("design:type", String)
64
- ], ProductBundlePatch.prototype, "refCode", void 0);
65
- __decorate([
66
- (0, type_graphql_1.Field)({ nullable: true }),
67
- __metadata("design:type", String)
68
- ], ProductBundlePatch.prototype, "type", void 0);
69
- __decorate([
70
- (0, type_graphql_1.Field)({ nullable: true }),
71
- __metadata("design:type", String)
72
- ], ProductBundlePatch.prototype, "status", void 0);
73
- __decorate([
74
- (0, type_graphql_1.Field)({ nullable: true }),
75
- __metadata("design:type", String)
76
- ], ProductBundlePatch.prototype, "packingType", void 0);
77
- __decorate([
78
- (0, type_graphql_1.Field)({ nullable: true }),
79
- __metadata("design:type", String)
80
- ], ProductBundlePatch.prototype, "cuFlag", void 0);
81
- ProductBundlePatch = __decorate([
82
- (0, type_graphql_1.InputType)()
83
- ], ProductBundlePatch);
84
- exports.ProductBundlePatch = ProductBundlePatch;
85
- //# sourceMappingURL=product-bundle-types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"product-bundle-types.js","sourceRoot":"","sources":["../../../server/service/product-bundle/product-bundle-types.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAAgE;AAEhE,qDAAgD;AAGzC,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAM5B,CAAA;AALC;IAAC,IAAA,oBAAK,GAAE;;8CACI;AAEZ;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDACN;AALT,gBAAgB;IAD5B,IAAA,wBAAS,GAAE;GACC,gBAAgB,CAM5B;AANY,4CAAgB;AAStB,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;CAM7B,CAAA;AALC;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,8BAAa,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDAC5B;AAEvB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACzB;AALH,iBAAiB;IAD7B,IAAA,yBAAU,GAAE;GACA,iBAAiB,CAM7B;AANY,8CAAiB;AASvB,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;CA2B9B,CAAA;AA1BC;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACf;AAEX;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACd;AAEZ;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACb;AAEb;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uDACN;AAEpB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACV;AAEhB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACb;AAEb;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDACX;AAEf;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uDACN;AAEpB;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kDACX;AA1BJ,kBAAkB;IAD9B,IAAA,wBAAS,GAAE;GACC,kBAAkB,CA2B9B;AA3BY,gDAAkB"}
@@ -1,128 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- var _a, _b, _c, _d;
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.ProductBundle = void 0;
14
- const auth_base_1 = require("@things-factory/auth-base");
15
- const biz_base_1 = require("@things-factory/biz-base");
16
- const shell_1 = require("@things-factory/shell");
17
- const type_graphql_1 = require("type-graphql");
18
- const typeorm_1 = require("typeorm");
19
- const product_bundle_setting_1 = require("../product-bundle-setting/product-bundle-setting");
20
- let ProductBundle = class ProductBundle {
21
- };
22
- __decorate([
23
- (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
24
- (0, type_graphql_1.Field)(type => type_graphql_1.ID),
25
- __metadata("design:type", String)
26
- ], ProductBundle.prototype, "id", void 0);
27
- __decorate([
28
- (0, typeorm_1.ManyToOne)(type => shell_1.Domain),
29
- (0, type_graphql_1.Field)(),
30
- __metadata("design:type", typeof (_a = typeof shell_1.Domain !== "undefined" && shell_1.Domain) === "function" ? _a : Object)
31
- ], ProductBundle.prototype, "domain", void 0);
32
- __decorate([
33
- (0, typeorm_1.RelationId)((productBundle) => productBundle.domain),
34
- __metadata("design:type", String)
35
- ], ProductBundle.prototype, "domainId", void 0);
36
- __decorate([
37
- (0, typeorm_1.ManyToOne)(type => biz_base_1.Bizplace, {
38
- nullable: false
39
- }),
40
- (0, type_graphql_1.Field)({ nullable: true }),
41
- __metadata("design:type", typeof (_b = typeof biz_base_1.Bizplace !== "undefined" && biz_base_1.Bizplace) === "function" ? _b : Object)
42
- ], ProductBundle.prototype, "bizplace", void 0);
43
- __decorate([
44
- (0, typeorm_1.OneToMany)(type => product_bundle_setting_1.ProductBundleSetting, productBundleSetting => productBundleSetting.productBundle),
45
- (0, type_graphql_1.Field)(type => [product_bundle_setting_1.ProductBundleSetting]),
46
- __metadata("design:type", Array)
47
- ], ProductBundle.prototype, "productBundleSettings", void 0);
48
- __decorate([
49
- (0, typeorm_1.Column)(),
50
- (0, type_graphql_1.Field)(),
51
- __metadata("design:type", String)
52
- ], ProductBundle.prototype, "sku", void 0);
53
- __decorate([
54
- (0, typeorm_1.Column)({ nullable: true }),
55
- (0, type_graphql_1.Field)({ nullable: true }),
56
- __metadata("design:type", String)
57
- ], ProductBundle.prototype, "refCode", void 0);
58
- __decorate([
59
- (0, typeorm_1.Column)(),
60
- (0, type_graphql_1.Field)(),
61
- __metadata("design:type", String)
62
- ], ProductBundle.prototype, "name", void 0);
63
- __decorate([
64
- (0, typeorm_1.Column)({ nullable: true }),
65
- (0, type_graphql_1.Field)({ nullable: true }),
66
- __metadata("design:type", String)
67
- ], ProductBundle.prototype, "description", void 0);
68
- __decorate([
69
- (0, typeorm_1.Column)({ nullable: true }),
70
- (0, type_graphql_1.Field)({ nullable: true }),
71
- __metadata("design:type", String)
72
- ], ProductBundle.prototype, "type", void 0);
73
- __decorate([
74
- (0, typeorm_1.Column)(),
75
- (0, type_graphql_1.Field)(),
76
- __metadata("design:type", String)
77
- ], ProductBundle.prototype, "status", void 0);
78
- __decorate([
79
- (0, typeorm_1.Column)(),
80
- (0, type_graphql_1.Field)(),
81
- __metadata("design:type", String)
82
- ], ProductBundle.prototype, "packingType", void 0);
83
- __decorate([
84
- (0, typeorm_1.Column)({ type: 'float', default: 1 }),
85
- (0, type_graphql_1.Field)(),
86
- __metadata("design:type", Number)
87
- ], ProductBundle.prototype, "packingSize", void 0);
88
- __decorate([
89
- (0, typeorm_1.CreateDateColumn)(),
90
- (0, type_graphql_1.Field)({ nullable: true }),
91
- __metadata("design:type", Date)
92
- ], ProductBundle.prototype, "createdAt", void 0);
93
- __decorate([
94
- (0, typeorm_1.UpdateDateColumn)(),
95
- (0, type_graphql_1.Field)({ nullable: true }),
96
- __metadata("design:type", Date)
97
- ], ProductBundle.prototype, "updatedAt", void 0);
98
- __decorate([
99
- (0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
100
- nullable: true
101
- }),
102
- (0, type_graphql_1.Field)({ nullable: true }),
103
- __metadata("design:type", typeof (_c = typeof auth_base_1.User !== "undefined" && auth_base_1.User) === "function" ? _c : Object)
104
- ], ProductBundle.prototype, "creator", void 0);
105
- __decorate([
106
- (0, typeorm_1.RelationId)((productBundle) => productBundle.creator),
107
- __metadata("design:type", String)
108
- ], ProductBundle.prototype, "creatorId", void 0);
109
- __decorate([
110
- (0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
111
- nullable: true
112
- }),
113
- (0, type_graphql_1.Field)({ nullable: true }),
114
- __metadata("design:type", typeof (_d = typeof auth_base_1.User !== "undefined" && auth_base_1.User) === "function" ? _d : Object)
115
- ], ProductBundle.prototype, "updater", void 0);
116
- __decorate([
117
- (0, typeorm_1.RelationId)((productBundle) => productBundle.updater),
118
- __metadata("design:type", String)
119
- ], ProductBundle.prototype, "updaterId", void 0);
120
- ProductBundle = __decorate([
121
- (0, typeorm_1.Entity)(),
122
- (0, typeorm_1.Index)('ix_product_bundle_0', (productBundle) => [productBundle.domain, productBundle.id], {
123
- unique: true
124
- }),
125
- (0, type_graphql_1.ObjectType)()
126
- ], ProductBundle);
127
- exports.ProductBundle = ProductBundle;
128
- //# sourceMappingURL=product-bundle.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"product-bundle.js","sourceRoot":"","sources":["../../../server/service/product-bundle/product-bundle.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,yDAAgD;AAChD,uDAAmD;AACnD,iDAA8C;AAC9C,+CAAoD;AACpD,qCAUgB;AAChB,6FAAuF;AAOhF,IAAM,aAAa,GAAnB,MAAM,aAAa;CA+EzB,CAAA;AA9EC;IAAC,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;yCACC;AAEnB;IAAC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IACzB,IAAA,oBAAK,GAAE;kDACA,cAAM,oBAAN,cAAM;6CAAA;AAEd;IAAC,IAAA,oBAAU,EAAC,CAAC,aAA4B,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,CAAC;;+CACnD;AAEhB;IAAC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,mBAAQ,EAAE;QAC3B,QAAQ,EAAE,KAAK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;AAEf;IAAC,IAAA,0BAAgB,GAAE;IAClB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;8BACf,IAAI;gDAAA;AAEf;IAAC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE;QACvB,QAAQ,EAAE,IAAI;KACf,CAAC;IACD,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;kDACjB,gBAAI,oBAAJ,gBAAI;8CAAA;AAEb;IAAC,IAAA,oBAAU,EAAC,CAAC,aAA4B,EAAE,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC;;gDACnD;AAEjB;IAAC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE;QACvB,QAAQ,EAAE,IAAI;KACf,CAAC;IACD,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;kDACjB,gBAAI,oBAAJ,gBAAI;8CAAA;AAEb;IAAC,IAAA,oBAAU,EAAC,CAAC,aAA4B,EAAE,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC;;gDACnD;AA9EN,aAAa;IALzB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,qBAAqB,EAAE,CAAC,aAA4B,EAAE,EAAE,CAAC,CAAC,aAAa,CAAC,MAAM,EAAE,aAAa,CAAC,EAAE,CAAC,EAAE;QACxG,MAAM,EAAE,IAAI;KACb,CAAC;IACD,IAAA,yBAAU,GAAE;GACA,aAAa,CA+EzB;AA/EY,sCAAa"}
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolvers = exports.entities = void 0;
4
- const product_bundle_setting_1 = require("./product-bundle-setting");
5
- const product_bundle_setting_mutation_1 = require("./product-bundle-setting-mutation");
6
- const product_bundle_setting_query_1 = require("./product-bundle-setting-query");
7
- exports.entities = [product_bundle_setting_1.ProductBundleSetting];
8
- exports.resolvers = [product_bundle_setting_query_1.ProductBundleSettingQuery, product_bundle_setting_mutation_1.ProductBundleSettingMutation];
9
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/product-bundle-setting/index.ts"],"names":[],"mappings":";;;AAAA,qEAA+D;AAC/D,uFAAgF;AAChF,iFAA0E;AAE7D,QAAA,QAAQ,GAAG,CAAC,6CAAoB,CAAC,CAAA;AACjC,QAAA,SAAS,GAAG,CAAC,wDAAyB,EAAE,8DAA4B,CAAC,CAAA"}
@@ -1,165 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- var __param = (this && this.__param) || function (paramIndex, decorator) {
12
- return function (target, key) { decorator(target, key, paramIndex); }
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.updateMultipleProductBundleSetting = exports.ProductBundleSettingMutation = void 0;
16
- const type_graphql_1 = require("type-graphql");
17
- const typeorm_1 = require("typeorm");
18
- const product_bundle_setting_1 = require("./product-bundle-setting");
19
- const product_bundle_setting_types_1 = require("./product-bundle-setting-types");
20
- const debug = require('debug')('things-factory:product-base:productBundle');
21
- let ProductBundleSettingMutation = class ProductBundleSettingMutation {
22
- async updateMultipleProductBundleSetting(patches, context) {
23
- return await updateMultipleProductBundleSetting(patches);
24
- }
25
- async deleteProductBundleSetting(id, context) {
26
- await (0, typeorm_1.getRepository)(product_bundle_setting_1.ProductBundleSetting).delete({ id });
27
- return true;
28
- }
29
- async deleteProductBundleSettings(ids, context) {
30
- await (0, typeorm_1.getRepository)(product_bundle_setting_1.ProductBundleSetting).delete({
31
- product: (0, typeorm_1.In)(ids)
32
- });
33
- return true;
34
- }
35
- async linkProductBundle(productBundleId, patches, context) {
36
- try {
37
- const { domain, tx } = context.state;
38
- // const existingBundleLink: ProductBundleSetting[] = await tx.getRepository(ProductBundleSetting).find({
39
- // where: { productBundle: productBundleId },
40
- // relations: ['product', 'productDetail', 'productBundle']
41
- // })
42
- const qb = tx
43
- .getRepository(product_bundle_setting_1.ProductBundleSetting)
44
- .createQueryBuilder('pbs')
45
- .innerJoinAndSelect('pbs.product', 'prd')
46
- .innerJoinAndSelect('pbs.productDetail', 'pd')
47
- .innerJoinAndSelect('pbs.productBundle', 'pb')
48
- .where('pb.id = :productBundleId', { productBundleId })
49
- .andWhere('pb.domain_id = :domainId', { domainId: domain.id });
50
- const existingBundleLink = await qb.getMany();
51
- let newBundleLink = patches.reduce((acc, curr) => {
52
- if (!existingBundleLink.find(item => item.product.id === curr.product.id && item.productDetail.id === curr.productDetail.id)) {
53
- acc.push({
54
- productBundle: { id: productBundleId },
55
- product: { id: curr.product.id },
56
- productDetail: { id: curr.productDetail.id },
57
- bundleQty: curr.bundleQty,
58
- cuFlag: '+'
59
- });
60
- }
61
- // check if there is existing bundle link but changes in bundle qty
62
- else if (existingBundleLink.find(item => item.product.id === curr.product.id &&
63
- item.productDetail.id === curr.productDetail.id &&
64
- item.bundleQty !== curr.bundleQty)) {
65
- acc.push({
66
- id: curr.id,
67
- productBundle: { id: productBundleId },
68
- product: { id: curr.product.id },
69
- productDetail: { id: curr.productDetail.id },
70
- bundleQty: curr.bundleQty,
71
- cuFlag: 'M'
72
- });
73
- }
74
- return acc;
75
- }, []);
76
- let removeBundleLink = existingBundleLink.reduce((acc, curr) => {
77
- if (!patches.find(item => item.id == curr.id)) {
78
- acc.push({
79
- id: curr.id,
80
- productBundle: { id: productBundleId },
81
- product: { id: curr.product.id },
82
- productDetail: { id: curr.productDetail.id },
83
- bundleQty: curr.bundleQty
84
- });
85
- }
86
- return acc;
87
- }, []);
88
- if (newBundleLink.length > 0) {
89
- await updateMultipleProductBundleSetting(newBundleLink, tx);
90
- }
91
- if (removeBundleLink.length > 0) {
92
- await tx.getRepository(product_bundle_setting_1.ProductBundleSetting).delete({
93
- id: (0, typeorm_1.In)(removeBundleLink.map(bundleLink => bundleLink.id))
94
- });
95
- }
96
- return true;
97
- }
98
- catch (error) {
99
- debug('link-product-bundle', error);
100
- throw error;
101
- }
102
- }
103
- };
104
- __decorate([
105
- (0, type_graphql_1.Mutation)(returns => [product_bundle_setting_1.ProductBundleSetting]),
106
- __param(0, (0, type_graphql_1.Arg)('patches', type => [product_bundle_setting_types_1.ProductBundleSettingPatch])),
107
- __param(1, (0, type_graphql_1.Ctx)()),
108
- __metadata("design:type", Function),
109
- __metadata("design:paramtypes", [Array, Object]),
110
- __metadata("design:returntype", Promise)
111
- ], ProductBundleSettingMutation.prototype, "updateMultipleProductBundleSetting", null);
112
- __decorate([
113
- (0, type_graphql_1.Mutation)(returns => Boolean),
114
- __param(0, (0, type_graphql_1.Arg)('id')),
115
- __param(1, (0, type_graphql_1.Ctx)()),
116
- __metadata("design:type", Function),
117
- __metadata("design:paramtypes", [String, Object]),
118
- __metadata("design:returntype", Promise)
119
- ], ProductBundleSettingMutation.prototype, "deleteProductBundleSetting", null);
120
- __decorate([
121
- (0, type_graphql_1.Mutation)(returns => Boolean),
122
- __param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
123
- __param(1, (0, type_graphql_1.Ctx)()),
124
- __metadata("design:type", Function),
125
- __metadata("design:paramtypes", [Array, Object]),
126
- __metadata("design:returntype", Promise)
127
- ], ProductBundleSettingMutation.prototype, "deleteProductBundleSettings", null);
128
- __decorate([
129
- (0, type_graphql_1.Directive)('@transaction'),
130
- (0, type_graphql_1.Mutation)(returns => Boolean),
131
- __param(0, (0, type_graphql_1.Arg)('productBundleId')),
132
- __param(1, (0, type_graphql_1.Arg)('patches', type => [product_bundle_setting_types_1.ProductBundleSettingPatch])),
133
- __param(2, (0, type_graphql_1.Ctx)()),
134
- __metadata("design:type", Function),
135
- __metadata("design:paramtypes", [String, Array, Object]),
136
- __metadata("design:returntype", Promise)
137
- ], ProductBundleSettingMutation.prototype, "linkProductBundle", null);
138
- ProductBundleSettingMutation = __decorate([
139
- (0, type_graphql_1.Resolver)(product_bundle_setting_1.ProductBundleSetting)
140
- ], ProductBundleSettingMutation);
141
- exports.ProductBundleSettingMutation = ProductBundleSettingMutation;
142
- async function updateMultipleProductBundleSetting(patches, tx) {
143
- let results = [];
144
- const _createRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === '+');
145
- const _updateRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === 'M');
146
- const productBundleSettingRepo = tx.getRepository(product_bundle_setting_1.ProductBundleSetting);
147
- if (_createRecords.length > 0) {
148
- for (let i = 0; i < _createRecords.length; i++) {
149
- const newRecord = _createRecords[i];
150
- const result = await productBundleSettingRepo.save(Object.assign({}, newRecord));
151
- results.push(Object.assign(Object.assign({}, result), { cuFlag: '+' }));
152
- }
153
- }
154
- if (_updateRecords.length > 0) {
155
- for (let i = 0; i < _updateRecords.length; i++) {
156
- const newRecord = _updateRecords[i];
157
- const productBundleSetting = await productBundleSettingRepo.findOne({ id: newRecord.id });
158
- const result = await productBundleSettingRepo.save(Object.assign(Object.assign({}, productBundleSetting), newRecord));
159
- results.push(Object.assign(Object.assign({}, result), { cuFlag: 'M' }));
160
- }
161
- }
162
- return results;
163
- }
164
- exports.updateMultipleProductBundleSetting = updateMultipleProductBundleSetting;
165
- //# sourceMappingURL=product-bundle-setting-mutation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"product-bundle-setting-mutation.js","sourceRoot":"","sources":["../../../server/service/product-bundle-setting/product-bundle-setting-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