@things-factory/product-base 4.3.671 → 4.3.673

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/dist-server/constants/index.js +18 -0
  2. package/dist-server/constants/index.js.map +1 -0
  3. package/dist-server/constants/product.js +25 -0
  4. package/dist-server/constants/product.js.map +1 -0
  5. package/dist-server/controllers/index.js +1 -0
  6. package/dist-server/controllers/index.js.map +1 -0
  7. package/dist-server/index.js +19 -0
  8. package/dist-server/index.js.map +1 -0
  9. package/dist-server/middlewares/index.js +1 -0
  10. package/dist-server/middlewares/index.js.map +1 -0
  11. package/dist-server/migrations/index.js +12 -0
  12. package/dist-server/migrations/index.js.map +1 -0
  13. package/dist-server/service/index.js +74 -0
  14. package/dist-server/service/index.js.map +1 -0
  15. package/dist-server/service/product/index.js +10 -0
  16. package/dist-server/service/product/index.js.map +1 -0
  17. package/dist-server/service/product/product-mutation.js +408 -0
  18. package/dist-server/service/product/product-mutation.js.map +1 -0
  19. package/dist-server/service/product/product-query.js +373 -0
  20. package/dist-server/service/product/product-query.js.map +1 -0
  21. package/dist-server/service/product/product-types.js +618 -0
  22. package/dist-server/service/product/product-types.js.map +1 -0
  23. package/dist-server/service/product/product.js +615 -0
  24. package/dist-server/service/product/product.js.map +1 -0
  25. package/dist-server/service/product/validate-product.js +26 -0
  26. package/dist-server/service/product/validate-product.js.map +1 -0
  27. package/dist-server/service/product-barcode/index.js +9 -0
  28. package/dist-server/service/product-barcode/index.js.map +1 -0
  29. package/dist-server/service/product-barcode/product-barcode-mutation.js +120 -0
  30. package/dist-server/service/product-barcode/product-barcode-mutation.js.map +1 -0
  31. package/dist-server/service/product-barcode/product-barcode-query.js +87 -0
  32. package/dist-server/service/product-barcode/product-barcode-query.js.map +1 -0
  33. package/dist-server/service/product-barcode/product-barcode-type.js +63 -0
  34. package/dist-server/service/product-barcode/product-barcode-type.js.map +1 -0
  35. package/dist-server/service/product-barcode/product-barcode.js +104 -0
  36. package/dist-server/service/product-barcode/product-barcode.js.map +1 -0
  37. package/dist-server/service/product-bundle/index.js +9 -0
  38. package/dist-server/service/product-bundle/index.js.map +1 -0
  39. package/dist-server/service/product-bundle/product-bundle-mutation.js +130 -0
  40. package/dist-server/service/product-bundle/product-bundle-mutation.js.map +1 -0
  41. package/dist-server/service/product-bundle/product-bundle-query.js +128 -0
  42. package/dist-server/service/product-bundle/product-bundle-query.js.map +1 -0
  43. package/dist-server/service/product-bundle/product-bundle-types.js +85 -0
  44. package/dist-server/service/product-bundle/product-bundle-types.js.map +1 -0
  45. package/dist-server/service/product-bundle/product-bundle.js +128 -0
  46. package/dist-server/service/product-bundle/product-bundle.js.map +1 -0
  47. package/dist-server/service/product-bundle-setting/index.js +9 -0
  48. package/dist-server/service/product-bundle-setting/index.js.map +1 -0
  49. package/dist-server/service/product-bundle-setting/product-bundle-setting-mutation.js +165 -0
  50. package/dist-server/service/product-bundle-setting/product-bundle-setting-mutation.js.map +1 -0
  51. package/dist-server/service/product-bundle-setting/product-bundle-setting-query.js +113 -0
  52. package/dist-server/service/product-bundle-setting/product-bundle-setting-query.js.map +1 -0
  53. package/dist-server/service/product-bundle-setting/product-bundle-setting-types.js +69 -0
  54. package/dist-server/service/product-bundle-setting/product-bundle-setting-types.js.map +1 -0
  55. package/dist-server/service/product-bundle-setting/product-bundle-setting.js +63 -0
  56. package/dist-server/service/product-bundle-setting/product-bundle-setting.js.map +1 -0
  57. package/dist-server/service/product-combination/index.js +9 -0
  58. package/dist-server/service/product-combination/index.js.map +1 -0
  59. package/dist-server/service/product-combination/product-combination-mutation.js +137 -0
  60. package/dist-server/service/product-combination/product-combination-mutation.js.map +1 -0
  61. package/dist-server/service/product-combination/product-combination-query.js +86 -0
  62. package/dist-server/service/product-combination/product-combination-query.js.map +1 -0
  63. package/dist-server/service/product-combination/product-combination-type.js +83 -0
  64. package/dist-server/service/product-combination/product-combination-type.js.map +1 -0
  65. package/dist-server/service/product-combination/product-combination.js +133 -0
  66. package/dist-server/service/product-combination/product-combination.js.map +1 -0
  67. package/dist-server/service/product-combination-setting/index.js +9 -0
  68. package/dist-server/service/product-combination-setting/index.js.map +1 -0
  69. package/dist-server/service/product-combination-setting/product-combination-setting-mutation.js +221 -0
  70. package/dist-server/service/product-combination-setting/product-combination-setting-mutation.js.map +1 -0
  71. package/dist-server/service/product-combination-setting/product-combination-setting-query.js +177 -0
  72. package/dist-server/service/product-combination-setting/product-combination-setting-query.js.map +1 -0
  73. package/dist-server/service/product-combination-setting/product-combination-setting-type.js +75 -0
  74. package/dist-server/service/product-combination-setting/product-combination-setting-type.js.map +1 -0
  75. package/dist-server/service/product-combination-setting/product-combination-setting.js +105 -0
  76. package/dist-server/service/product-combination-setting/product-combination-setting.js.map +1 -0
  77. package/dist-server/service/product-detail/index.js +9 -0
  78. package/dist-server/service/product-detail/index.js.map +1 -0
  79. package/dist-server/service/product-detail/product-detail-mutation.js +374 -0
  80. package/dist-server/service/product-detail/product-detail-mutation.js.map +1 -0
  81. package/dist-server/service/product-detail/product-detail-query.js +223 -0
  82. package/dist-server/service/product-detail/product-detail-query.js.map +1 -0
  83. package/dist-server/service/product-detail/product-detail-types.js +392 -0
  84. package/dist-server/service/product-detail/product-detail-types.js.map +1 -0
  85. package/dist-server/service/product-detail/product-detail.js +444 -0
  86. package/dist-server/service/product-detail/product-detail.js.map +1 -0
  87. package/dist-server/service/product-detail-bizplace-setting/index.js +9 -0
  88. package/dist-server/service/product-detail-bizplace-setting/index.js.map +1 -0
  89. package/dist-server/service/product-detail-bizplace-setting/product-detail-bizplace-setting-mutation.js +118 -0
  90. package/dist-server/service/product-detail-bizplace-setting/product-detail-bizplace-setting-mutation.js.map +1 -0
  91. package/dist-server/service/product-detail-bizplace-setting/product-detail-bizplace-setting-query.js +107 -0
  92. package/dist-server/service/product-detail-bizplace-setting/product-detail-bizplace-setting-query.js.map +1 -0
  93. package/dist-server/service/product-detail-bizplace-setting/product-detail-bizplace-setting-types.js +99 -0
  94. package/dist-server/service/product-detail-bizplace-setting/product-detail-bizplace-setting-types.js.map +1 -0
  95. package/dist-server/service/product-detail-bizplace-setting/product-detail-bizplace-setting.js +120 -0
  96. package/dist-server/service/product-detail-bizplace-setting/product-detail-bizplace-setting.js.map +1 -0
  97. package/dist-server/service/product-set/index.js +9 -0
  98. package/dist-server/service/product-set/index.js.map +1 -0
  99. package/dist-server/service/product-set/product-set-mutation.js +146 -0
  100. package/dist-server/service/product-set/product-set-mutation.js.map +1 -0
  101. package/dist-server/service/product-set/product-set-query.js +136 -0
  102. package/dist-server/service/product-set/product-set-query.js.map +1 -0
  103. package/dist-server/service/product-set/product-set-types.js +77 -0
  104. package/dist-server/service/product-set/product-set-types.js.map +1 -0
  105. package/dist-server/service/product-set/product-set.js +118 -0
  106. package/dist-server/service/product-set/product-set.js.map +1 -0
  107. package/dist-server/utils/index.js +18 -0
  108. package/dist-server/utils/index.js.map +1 -0
  109. package/dist-server/utils/product-util.js +16 -0
  110. package/dist-server/utils/product-util.js.map +1 -0
  111. package/package.json +4 -4
@@ -0,0 +1,107 @@
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;
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.ProductDetailBizplaceSettingQuery = void 0;
17
+ const auth_base_1 = require("@things-factory/auth-base");
18
+ const shell_1 = require("@things-factory/shell");
19
+ const type_graphql_1 = require("type-graphql");
20
+ const typeorm_1 = require("typeorm");
21
+ const product_detail_1 = require("../product-detail/product-detail");
22
+ const product_detail_bizplace_setting_1 = require("./product-detail-bizplace-setting");
23
+ const product_detail_bizplace_setting_types_1 = require("./product-detail-bizplace-setting-types");
24
+ let ProductDetailBizplaceSettingQuery = class ProductDetailBizplaceSettingQuery {
25
+ async productDetailBizplaceSetting(name, context) {
26
+ const { domain } = context.state;
27
+ const repository = (0, typeorm_1.getRepository)(product_detail_bizplace_setting_1.ProductDetailBizplaceSetting);
28
+ return await repository.findOne({
29
+ where: { domain, name }
30
+ });
31
+ }
32
+ async productDetailBizplaceSettings(params, context) {
33
+ const { domain, user: updater } = context.state;
34
+ const queryBuilder = (0, typeorm_1.getRepository)(product_detail_1.ProductDetail).createQueryBuilder('productDetail');
35
+ (0, shell_1.buildQuery)(queryBuilder, params, context, false);
36
+ let qb = queryBuilder
37
+ .leftJoinAndSelect('productDetail.productDetailBizplaceSettings', 'pdbs', '"pdbs"."product_detail_id"="productDetail"."id"')
38
+ .leftJoinAndSelect('productDetail.domain', 'domain')
39
+ .leftJoinAndSelect('productDetail.creator', 'creator')
40
+ .leftJoinAndSelect('productDetail.updater', 'updater');
41
+ // qb.andWhere('pdbs.bizplace_id = :bizplaceId', { bizplaceId: bizplace.id })
42
+ const [items, total] = await qb.getManyAndCount();
43
+ return {
44
+ items: items.map(itm => {
45
+ let productDetailBizplaceSetting = itm.productDetailBizplaceSettings[0];
46
+ return Object.assign({ requirePacking: false, bufferQty: 0, minQty: 0, maxQty: 0, productDetail: itm }, productDetailBizplaceSetting);
47
+ }),
48
+ total
49
+ };
50
+ // const convertedParams = convertListParams(params)
51
+ // const [items, total] = await getRepository(ProductDetailBizplaceSettingEntity).findAndCount({
52
+ // ...convertedParams
53
+ // })
54
+ // return { items, total }
55
+ }
56
+ async domain(productDetailBizplaceSetting) {
57
+ return await (0, typeorm_1.getRepository)(shell_1.Domain).findOne(productDetailBizplaceSetting.domain.id);
58
+ }
59
+ async updater(productDetailBizplaceSetting) {
60
+ return await (0, typeorm_1.getRepository)(auth_base_1.User).findOne(productDetailBizplaceSetting.updater.id);
61
+ }
62
+ async creator(productDetailBizplaceSetting) {
63
+ return await (0, typeorm_1.getRepository)(auth_base_1.User).findOne(productDetailBizplaceSetting.creator.id);
64
+ }
65
+ };
66
+ __decorate([
67
+ (0, type_graphql_1.Query)(returns => product_detail_bizplace_setting_1.ProductDetailBizplaceSetting),
68
+ __param(0, (0, type_graphql_1.Arg)('name')),
69
+ __param(1, (0, type_graphql_1.Ctx)()),
70
+ __metadata("design:type", Function),
71
+ __metadata("design:paramtypes", [String, Object]),
72
+ __metadata("design:returntype", Promise)
73
+ ], ProductDetailBizplaceSettingQuery.prototype, "productDetailBizplaceSetting", null);
74
+ __decorate([
75
+ (0, type_graphql_1.Query)(returns => product_detail_bizplace_setting_types_1.ProductDetailBizplaceSettingList),
76
+ __param(0, (0, type_graphql_1.Args)()),
77
+ __param(1, (0, type_graphql_1.Ctx)()),
78
+ __metadata("design:type", Function),
79
+ __metadata("design:paramtypes", [typeof (_a = typeof shell_1.ListParam !== "undefined" && shell_1.ListParam) === "function" ? _a : Object, Object]),
80
+ __metadata("design:returntype", Promise)
81
+ ], ProductDetailBizplaceSettingQuery.prototype, "productDetailBizplaceSettings", null);
82
+ __decorate([
83
+ (0, type_graphql_1.FieldResolver)(type => shell_1.Domain),
84
+ __param(0, (0, type_graphql_1.Root)()),
85
+ __metadata("design:type", Function),
86
+ __metadata("design:paramtypes", [product_detail_bizplace_setting_1.ProductDetailBizplaceSetting]),
87
+ __metadata("design:returntype", Promise)
88
+ ], ProductDetailBizplaceSettingQuery.prototype, "domain", null);
89
+ __decorate([
90
+ (0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
91
+ __param(0, (0, type_graphql_1.Root)()),
92
+ __metadata("design:type", Function),
93
+ __metadata("design:paramtypes", [product_detail_bizplace_setting_1.ProductDetailBizplaceSetting]),
94
+ __metadata("design:returntype", Promise)
95
+ ], ProductDetailBizplaceSettingQuery.prototype, "updater", null);
96
+ __decorate([
97
+ (0, type_graphql_1.FieldResolver)(type => auth_base_1.User),
98
+ __param(0, (0, type_graphql_1.Root)()),
99
+ __metadata("design:type", Function),
100
+ __metadata("design:paramtypes", [product_detail_bizplace_setting_1.ProductDetailBizplaceSetting]),
101
+ __metadata("design:returntype", Promise)
102
+ ], ProductDetailBizplaceSettingQuery.prototype, "creator", null);
103
+ ProductDetailBizplaceSettingQuery = __decorate([
104
+ (0, type_graphql_1.Resolver)(product_detail_bizplace_setting_1.ProductDetailBizplaceSetting)
105
+ ], ProductDetailBizplaceSettingQuery);
106
+ exports.ProductDetailBizplaceSettingQuery = ProductDetailBizplaceSettingQuery;
107
+ //# sourceMappingURL=product-detail-bizplace-setting-query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-detail-bizplace-setting-query.js","sourceRoot":"","sources":["../../../server/service/product-detail-bizplace-setting/product-detail-bizplace-setting-query.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAgD;AAChD,iDAAqE;AACrE,+CAAmF;AACnF,qCAAuC;AACvC,qEAAgE;AAChE,uFAAgF;AAChF,mGAA0F;AAGnF,IAAM,iCAAiC,GAAvC,MAAM,iCAAiC;IAEtC,AAAN,KAAK,CAAC,4BAA4B,CACnB,IAAY,EAClB,OAAY;QAEnB,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAChC,MAAM,UAAU,GAAG,IAAA,uBAAa,EAAC,8DAA4B,CAAC,CAAA;QAE9D,OAAO,MAAM,UAAU,CAAC,OAAO,CAAC;YAC9B,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;SACxB,CAAC,CAAA;IACJ,CAAC;IAGK,AAAN,KAAK,CAAC,6BAA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(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;
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.ProductDetailBizplaceSettingPatch = exports.ProductDetailBizplaceSettingList = exports.NewProductDetailBizplaceSetting = void 0;
14
+ const type_graphql_1 = require("type-graphql");
15
+ const shell_1 = require("@things-factory/shell");
16
+ const product_detail_bizplace_setting_1 = require("./product-detail-bizplace-setting");
17
+ let NewProductDetailBizplaceSetting = class NewProductDetailBizplaceSetting {
18
+ };
19
+ __decorate([
20
+ (0, type_graphql_1.Field)(),
21
+ __metadata("design:type", String)
22
+ ], NewProductDetailBizplaceSetting.prototype, "name", void 0);
23
+ __decorate([
24
+ (0, type_graphql_1.Field)({ nullable: true }),
25
+ __metadata("design:type", typeof (_a = typeof shell_1.ObjectRef !== "undefined" && shell_1.ObjectRef) === "function" ? _a : Object)
26
+ ], NewProductDetailBizplaceSetting.prototype, "productDetail", void 0);
27
+ __decorate([
28
+ (0, type_graphql_1.Field)({ nullable: true }),
29
+ __metadata("design:type", Boolean)
30
+ ], NewProductDetailBizplaceSetting.prototype, "requirePacking", void 0);
31
+ __decorate([
32
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true }),
33
+ __metadata("design:type", Number)
34
+ ], NewProductDetailBizplaceSetting.prototype, "bufferQty", void 0);
35
+ __decorate([
36
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true }),
37
+ __metadata("design:type", Number)
38
+ ], NewProductDetailBizplaceSetting.prototype, "minQty", void 0);
39
+ __decorate([
40
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true }),
41
+ __metadata("design:type", Number)
42
+ ], NewProductDetailBizplaceSetting.prototype, "maxQty", void 0);
43
+ NewProductDetailBizplaceSetting = __decorate([
44
+ (0, type_graphql_1.InputType)()
45
+ ], NewProductDetailBizplaceSetting);
46
+ exports.NewProductDetailBizplaceSetting = NewProductDetailBizplaceSetting;
47
+ let ProductDetailBizplaceSettingList = class ProductDetailBizplaceSettingList {
48
+ };
49
+ __decorate([
50
+ (0, type_graphql_1.Field)(type => [product_detail_bizplace_setting_1.ProductDetailBizplaceSetting], { nullable: true }),
51
+ __metadata("design:type", Array)
52
+ ], ProductDetailBizplaceSettingList.prototype, "items", void 0);
53
+ __decorate([
54
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true }),
55
+ __metadata("design:type", Number)
56
+ ], ProductDetailBizplaceSettingList.prototype, "total", void 0);
57
+ ProductDetailBizplaceSettingList = __decorate([
58
+ (0, type_graphql_1.ObjectType)()
59
+ ], ProductDetailBizplaceSettingList);
60
+ exports.ProductDetailBizplaceSettingList = ProductDetailBizplaceSettingList;
61
+ let ProductDetailBizplaceSettingPatch = class ProductDetailBizplaceSettingPatch {
62
+ };
63
+ __decorate([
64
+ (0, type_graphql_1.Field)({ nullable: true }),
65
+ __metadata("design:type", String)
66
+ ], ProductDetailBizplaceSettingPatch.prototype, "id", void 0);
67
+ __decorate([
68
+ (0, type_graphql_1.Field)({ nullable: true }),
69
+ __metadata("design:type", String)
70
+ ], ProductDetailBizplaceSettingPatch.prototype, "name", void 0);
71
+ __decorate([
72
+ (0, type_graphql_1.Field)({ nullable: true }),
73
+ __metadata("design:type", typeof (_b = typeof shell_1.ObjectRef !== "undefined" && shell_1.ObjectRef) === "function" ? _b : Object)
74
+ ], ProductDetailBizplaceSettingPatch.prototype, "productDetail", void 0);
75
+ __decorate([
76
+ (0, type_graphql_1.Field)({ nullable: true }),
77
+ __metadata("design:type", Boolean)
78
+ ], ProductDetailBizplaceSettingPatch.prototype, "requirePacking", void 0);
79
+ __decorate([
80
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true }),
81
+ __metadata("design:type", Number)
82
+ ], ProductDetailBizplaceSettingPatch.prototype, "bufferQty", void 0);
83
+ __decorate([
84
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true }),
85
+ __metadata("design:type", Number)
86
+ ], ProductDetailBizplaceSettingPatch.prototype, "minQty", void 0);
87
+ __decorate([
88
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true }),
89
+ __metadata("design:type", Number)
90
+ ], ProductDetailBizplaceSettingPatch.prototype, "maxQty", void 0);
91
+ __decorate([
92
+ (0, type_graphql_1.Field)({ nullable: true }),
93
+ __metadata("design:type", String)
94
+ ], ProductDetailBizplaceSettingPatch.prototype, "cuFlag", void 0);
95
+ ProductDetailBizplaceSettingPatch = __decorate([
96
+ (0, type_graphql_1.InputType)()
97
+ ], ProductDetailBizplaceSettingPatch);
98
+ exports.ProductDetailBizplaceSettingPatch = ProductDetailBizplaceSettingPatch;
99
+ //# sourceMappingURL=product-detail-bizplace-setting-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-detail-bizplace-setting-types.js","sourceRoot":"","sources":["../../../server/service/product-detail-bizplace-setting/product-detail-bizplace-setting-types.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,+CAAgE;AAEhE,iDAAiD;AAEjD,uFAAgF;AAGzE,IAAM,+BAA+B,GAArC,MAAM,+BAA+B;CAkB3C,CAAA;AAjBC;IAAC,IAAA,oBAAK,GAAE;;6DACI;AAEZ;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;kDACV,iBAAS,oBAAT,iBAAS;sEAAA;AAEzB;IAAC,IAAA,o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AAC;;yEACF;AAExB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;oEACrB;AAElB;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iEACxB;AAEf;IAAC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iEACxB;AAEf;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iEACX;AAvBJ,iCAAiC;IAD7C,IAAA,wBAAS,GAAE;GACC,iCAAiC,CAwB7C;AAxBY,8EAAiC"}
@@ -0,0 +1,120 @@
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;
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.ProductDetailBizplaceSetting = void 0;
14
+ const auth_base_1 = require("@things-factory/auth-base");
15
+ const shell_1 = require("@things-factory/shell");
16
+ const type_graphql_1 = require("type-graphql");
17
+ const typeorm_1 = require("typeorm");
18
+ const product_detail_1 = require("../product-detail/product-detail");
19
+ /**
20
+ * @prop {string} id - Primary Key.
21
+ * @prop {Object} domain - Foreign field. Relation to Domain Entity / Table.
22
+ * @prop {Object} productDetail - Foreign field. Relation to Product Detail Entity / Table.
23
+ * @prop {string} name - Product Detail Name.
24
+ * @prop {boolean} requirePacking - Default SKU info.
25
+ * @prop {?number} bufferQty - Quantity for reservation.
26
+ * @prop {?number} minQty - Minimum Quantity targetted in inventory. For reporting purposes.
27
+ * @prop {?number} maxQty - Maximum Quantity targetted in inventory. For reporting purposes.
28
+ * @prop {Date} createdAt - Created Date and Time.
29
+ * @prop {Date} updatedAt - Updated Date and Time.
30
+ * @prop {?Object} creator - Foreign field. Relation to User Entity / Table.
31
+ * @prop {?Object} updater - Foreign field. Relation to User Entity / Table.
32
+ **/
33
+ let ProductDetailBizplaceSetting = class ProductDetailBizplaceSetting {
34
+ };
35
+ __decorate([
36
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
37
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID),
38
+ __metadata("design:type", String)
39
+ ], ProductDetailBizplaceSetting.prototype, "id", void 0);
40
+ __decorate([
41
+ (0, typeorm_1.ManyToOne)(type => shell_1.Domain),
42
+ (0, type_graphql_1.Field)(),
43
+ __metadata("design:type", typeof (_a = typeof shell_1.Domain !== "undefined" && shell_1.Domain) === "function" ? _a : Object)
44
+ ], ProductDetailBizplaceSetting.prototype, "domain", void 0);
45
+ __decorate([
46
+ (0, typeorm_1.RelationId)((productDetailBizplaceSetting) => productDetailBizplaceSetting.domain),
47
+ __metadata("design:type", String)
48
+ ], ProductDetailBizplaceSetting.prototype, "domainId", void 0);
49
+ __decorate([
50
+ (0, typeorm_1.ManyToOne)(type => product_detail_1.ProductDetail),
51
+ (0, type_graphql_1.Field)(type => product_detail_1.ProductDetail),
52
+ __metadata("design:type", product_detail_1.ProductDetail)
53
+ ], ProductDetailBizplaceSetting.prototype, "productDetail", void 0);
54
+ __decorate([
55
+ (0, typeorm_1.Column)(),
56
+ (0, type_graphql_1.Field)(),
57
+ __metadata("design:type", String)
58
+ ], ProductDetailBizplaceSetting.prototype, "name", void 0);
59
+ __decorate([
60
+ (0, typeorm_1.Column)({ default: false }),
61
+ (0, type_graphql_1.Field)(),
62
+ __metadata("design:type", Boolean)
63
+ ], ProductDetailBizplaceSetting.prototype, "requirePacking", void 0);
64
+ __decorate([
65
+ (0, typeorm_1.Column)({ default: 0 }),
66
+ (0, type_graphql_1.Field)(),
67
+ __metadata("design:type", Number)
68
+ ], ProductDetailBizplaceSetting.prototype, "bufferQty", void 0);
69
+ __decorate([
70
+ (0, typeorm_1.Column)({ default: 0 }),
71
+ (0, type_graphql_1.Field)(),
72
+ __metadata("design:type", Number)
73
+ ], ProductDetailBizplaceSetting.prototype, "minQty", void 0);
74
+ __decorate([
75
+ (0, typeorm_1.Column)({ default: 0 }),
76
+ (0, type_graphql_1.Field)(),
77
+ __metadata("design:type", Number)
78
+ ], ProductDetailBizplaceSetting.prototype, "maxQty", void 0);
79
+ __decorate([
80
+ (0, typeorm_1.CreateDateColumn)(),
81
+ (0, type_graphql_1.Field)({ nullable: true }),
82
+ __metadata("design:type", Date)
83
+ ], ProductDetailBizplaceSetting.prototype, "createdAt", void 0);
84
+ __decorate([
85
+ (0, typeorm_1.UpdateDateColumn)(),
86
+ (0, type_graphql_1.Field)({ nullable: true }),
87
+ __metadata("design:type", Date)
88
+ ], ProductDetailBizplaceSetting.prototype, "updatedAt", void 0);
89
+ __decorate([
90
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
91
+ nullable: true
92
+ }),
93
+ (0, type_graphql_1.Field)({ nullable: true }),
94
+ __metadata("design:type", typeof (_b = typeof auth_base_1.User !== "undefined" && auth_base_1.User) === "function" ? _b : Object)
95
+ ], ProductDetailBizplaceSetting.prototype, "creator", void 0);
96
+ __decorate([
97
+ (0, typeorm_1.RelationId)((productDetailBizplaceSetting) => productDetailBizplaceSetting.creator),
98
+ __metadata("design:type", String)
99
+ ], ProductDetailBizplaceSetting.prototype, "creatorId", void 0);
100
+ __decorate([
101
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, {
102
+ nullable: true
103
+ }),
104
+ (0, type_graphql_1.Field)({ nullable: true }),
105
+ __metadata("design:type", typeof (_c = typeof auth_base_1.User !== "undefined" && auth_base_1.User) === "function" ? _c : Object)
106
+ ], ProductDetailBizplaceSetting.prototype, "updater", void 0);
107
+ __decorate([
108
+ (0, typeorm_1.RelationId)((productDetailBizplaceSetting) => productDetailBizplaceSetting.updater),
109
+ __metadata("design:type", String)
110
+ ], ProductDetailBizplaceSetting.prototype, "updaterId", void 0);
111
+ ProductDetailBizplaceSetting = __decorate([
112
+ (0, typeorm_1.Entity)(),
113
+ (0, typeorm_1.Index)('ix_product_detail_bizplace_setting_0', (productDetailBizplaceSetting) => [
114
+ productDetailBizplaceSetting.domain,
115
+ productDetailBizplaceSetting.productDetail
116
+ ], { unique: true }),
117
+ (0, type_graphql_1.ObjectType)()
118
+ ], ProductDetailBizplaceSetting);
119
+ exports.ProductDetailBizplaceSetting = ProductDetailBizplaceSetting;
120
+ //# sourceMappingURL=product-detail-bizplace-setting.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-detail-bizplace-setting.js","sourceRoot":"","sources":["../../../server/service/product-detail-bizplace-setting/product-detail-bizplace-setting.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,yDAAgD;AAChD,iDAA8C;AAC9C,+CAAoD;AACpD,qCASgB;AAChB,qEAAgE;AAEhE;;;;;;;;;;;;;IAaI;AAYG,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;CA6DxC,CAAA;AA5DC;IAAC,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;wDACC;AAEnB;IAAC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IACzB,IAAA,oBAAK,GAAE;kDACA,cAAM,oBAAN,cAAM;4DAAA;AAEd;IAAC,IAAA,oB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EjB;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;6DAAA;AAEb;IAAC,IAAA,oBAAU,EAAC,CAAC,4BAA0D,EAAE,EAAE,CAAC,4BAA4B,CAAC,OAAO,CAAC;;+DAChG;AA5DN,4BAA4B;IAVxC,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EACJ,sCAAsC,EACtC,CAAC,4BAA0D,EAAE,EAAE,CAAC;QAC9D,4BAA4B,CAAC,MAAM;QACnC,4BAA4B,CAAC,aAAa;KAC3C,EACD,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB;IACA,IAAA,yBAAU,GAAE;GACA,4BAA4B,CA6DxC;AA7DY,oEAA4B"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolvers = exports.entities = void 0;
4
+ const product_set_1 = require("./product-set");
5
+ const product_set_mutation_1 = require("./product-set-mutation");
6
+ const product_set_query_1 = require("./product-set-query");
7
+ exports.entities = [product_set_1.ProductSet];
8
+ exports.resolvers = [product_set_query_1.ProductSetQuery, product_set_mutation_1.ProductSetMutation];
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/product-set/index.ts"],"names":[],"mappings":";;;AAAA,+CAA0C;AAC1C,iEAA2D;AAC3D,2DAAqD;AAExC,QAAA,QAAQ,GAAG,CAAC,wBAAU,CAAC,CAAA;AACvB,QAAA,SAAS,GAAG,CAAC,mCAAe,EAAE,yCAAkB,CAAC,CAAA"}
@@ -0,0 +1,146 @@
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.updateProductSet = exports.createProductSet = exports.ProductSetMutation = void 0;
16
+ const type_graphql_1 = require("type-graphql");
17
+ const biz_base_1 = require("@things-factory/biz-base");
18
+ const constants_1 = require("../../constants");
19
+ const utils_1 = require("../../utils");
20
+ const product_set_1 = require("./product-set");
21
+ const product_set_types_1 = require("./product-set-types");
22
+ let ProductSetMutation = class ProductSetMutation {
23
+ async createProductSet(productSet, context) {
24
+ return await createProductSet(productSet, context);
25
+ }
26
+ async updateProductSet(id, patch, context) {
27
+ return await updateProductSet(id, patch, context);
28
+ }
29
+ async updateMultipleProductSet(patches, context) {
30
+ let results = [];
31
+ const _createRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === '+');
32
+ const _updateRecords = patches.filter((patch) => patch.cuFlag.toUpperCase() === 'M');
33
+ if (_createRecords.length > 0) {
34
+ for (let i = 0; i < _createRecords.length; i++) {
35
+ const patch = _createRecords[i];
36
+ const result = await createProductSet(patch, context);
37
+ results.push(Object.assign(Object.assign({}, result), { cuFlag: '+' }));
38
+ }
39
+ }
40
+ if (_updateRecords.length > 0) {
41
+ for (let i = 0; i < _updateRecords.length; i++) {
42
+ const patch = _updateRecords[i];
43
+ const result = await updateProductSet(patch.id, patch, context);
44
+ results.push(Object.assign(Object.assign({}, result), { cuFlag: 'M' }));
45
+ }
46
+ }
47
+ return results;
48
+ }
49
+ async deleteProductSet(id, context) {
50
+ const { tx, user } = context.state;
51
+ const productSetRepo = tx.getRepository(product_set_1.ProductSet);
52
+ const productSet = await productSetRepo.findOne(id);
53
+ await productSetRepo.save(Object.assign(Object.assign({}, productSet), { status: constants_1.PRODUCT_SET_STATUS.DELETED, updater: user }));
54
+ return true;
55
+ }
56
+ async deleteProductSets(ids, context) {
57
+ const { tx, user } = context.state;
58
+ const productSetRepo = tx.getRepository(product_set_1.ProductSet);
59
+ let results = [];
60
+ let productSets = productSetRepo.findByIds(ids);
61
+ for (let i = 0; i < (await productSets).length; i++) {
62
+ const productSet = productSets[i];
63
+ const result = await productSetRepo.save(Object.assign(Object.assign({}, productSet), { status: constants_1.PRODUCT_SET_STATUS.DELETED, updater: user }));
64
+ results.push(Object.assign({}, result));
65
+ }
66
+ return true;
67
+ }
68
+ };
69
+ __decorate([
70
+ (0, type_graphql_1.Directive)('@privilege(category: "order", privilege: "mutation")'),
71
+ (0, type_graphql_1.Directive)('@transaction'),
72
+ (0, type_graphql_1.Mutation)(returns => product_set_1.ProductSet),
73
+ __param(0, (0, type_graphql_1.Arg)('productSet')),
74
+ __param(1, (0, type_graphql_1.Ctx)()),
75
+ __metadata("design:type", Function),
76
+ __metadata("design:paramtypes", [product_set_types_1.NewProductSet, Object]),
77
+ __metadata("design:returntype", Promise)
78
+ ], ProductSetMutation.prototype, "createProductSet", null);
79
+ __decorate([
80
+ (0, type_graphql_1.Directive)('@privilege(category: "order", privilege: "mutation")'),
81
+ (0, type_graphql_1.Directive)('@transaction'),
82
+ (0, type_graphql_1.Mutation)(returns => product_set_1.ProductSet),
83
+ __param(0, (0, type_graphql_1.Arg)('id')),
84
+ __param(1, (0, type_graphql_1.Arg)('patch')),
85
+ __param(2, (0, type_graphql_1.Ctx)()),
86
+ __metadata("design:type", Function),
87
+ __metadata("design:paramtypes", [String, product_set_types_1.ProductSetPatch, Object]),
88
+ __metadata("design:returntype", Promise)
89
+ ], ProductSetMutation.prototype, "updateProductSet", null);
90
+ __decorate([
91
+ (0, type_graphql_1.Directive)('@privilege(category: "order", privilege: "mutation")'),
92
+ (0, type_graphql_1.Directive)('@transaction'),
93
+ (0, type_graphql_1.Mutation)(returns => [product_set_1.ProductSet]),
94
+ __param(0, (0, type_graphql_1.Arg)('patches', type => [product_set_types_1.ProductSetPatch])),
95
+ __param(1, (0, type_graphql_1.Ctx)()),
96
+ __metadata("design:type", Function),
97
+ __metadata("design:paramtypes", [Array, Object]),
98
+ __metadata("design:returntype", Promise)
99
+ ], ProductSetMutation.prototype, "updateMultipleProductSet", null);
100
+ __decorate([
101
+ (0, type_graphql_1.Directive)('@privilege(category: "order", privilege: "mutation")'),
102
+ (0, type_graphql_1.Directive)('@transaction'),
103
+ (0, type_graphql_1.Mutation)(returns => Boolean),
104
+ __param(0, (0, type_graphql_1.Arg)('id')),
105
+ __param(1, (0, type_graphql_1.Ctx)()),
106
+ __metadata("design:type", Function),
107
+ __metadata("design:paramtypes", [String, Object]),
108
+ __metadata("design:returntype", Promise)
109
+ ], ProductSetMutation.prototype, "deleteProductSet", null);
110
+ __decorate([
111
+ (0, type_graphql_1.Directive)('@privilege(category: "order", privilege: "mutation")'),
112
+ (0, type_graphql_1.Directive)('@transaction'),
113
+ (0, type_graphql_1.Mutation)(returns => Boolean),
114
+ __param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
115
+ __param(1, (0, type_graphql_1.Ctx)()),
116
+ __metadata("design:type", Function),
117
+ __metadata("design:paramtypes", [Array, Object]),
118
+ __metadata("design:returntype", Promise)
119
+ ], ProductSetMutation.prototype, "deleteProductSets", null);
120
+ ProductSetMutation = __decorate([
121
+ (0, type_graphql_1.Resolver)(product_set_1.ProductSet)
122
+ ], ProductSetMutation);
123
+ exports.ProductSetMutation = ProductSetMutation;
124
+ async function createProductSet(productSet, context) {
125
+ const { domain, user, tx } = context.state;
126
+ const productSetRepo = tx.getRepository(product_set_1.ProductSet);
127
+ const bizplaceRepo = tx.getRepository(biz_base_1.Bizplace);
128
+ let bizplace;
129
+ // if (productSet.bizplace?.id) {
130
+ // bizplace = await bizplaceRepo.findOne(productSet.bizplace.id)
131
+ // } else {
132
+ // bizplace = await bizplaceRepo.findOne({ where: { name: domain.name } })
133
+ // }
134
+ bizplace = await bizplaceRepo.findOne({ where: { name: domain.name } });
135
+ return await productSetRepo.save(Object.assign(Object.assign({}, productSet), { code: utils_1.ProductUtil.productSetCode(), bizplace, creator: user, updater: user }));
136
+ }
137
+ exports.createProductSet = createProductSet;
138
+ async function updateProductSet(id, patch, context) {
139
+ const { user, tx } = context.state;
140
+ const bizplaceRepo = tx.getRepository(biz_base_1.Bizplace);
141
+ const productRepo = tx.getRepository(product_set_1.ProductSet);
142
+ const productSet = await productRepo.findOne(id);
143
+ return productRepo.save(Object.assign(Object.assign(Object.assign({}, productSet), patch), { updater: user }));
144
+ }
145
+ exports.updateProductSet = updateProductSet;
146
+ //# sourceMappingURL=product-set-mutation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-set-mutation.js","sourceRoot":"","sources":["../../../server/service/product-set/product-set-mutation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+CAAsE;AAItE,uDAAmD;AAGnD,+CAAoD;AACpD,uCAAyC;AACzC,+CAA0C;AAC1C,2DAAoE;AAG7D,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAIvB,AAAN,KAAK,CAAC,gBAAgB,CAAoB,UAAyB,EAAS,OAAY;QACtF,OAAO,MAAM,gBAAgB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;IACpD,CAAC;IAKK,AAAN,KAAK,CAAC,gBAAgB,CACT,EAAU,EACP,KAAsB,EAC7B,OAAY;QAEnB,OAAO,MAAM,gBAAgB,CAAC,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,CAAA;IACnD,CAAC;IAKK,AAAN,KAAK,CAAC,wBAAwB,CACe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