@things-factory/product-base 6.2.170 → 6.2.178

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 (119) hide show
  1. package/dist-server/constants/index.d.ts +1 -0
  2. package/dist-server/constants/product.d.ts +21 -0
  3. package/dist-server/controllers/index.d.ts +0 -0
  4. package/dist-server/index.d.ts +2 -0
  5. package/dist-server/middlewares/index.d.ts +0 -0
  6. package/dist-server/migrations/index.d.ts +1 -0
  7. package/dist-server/service/index.d.ts +20 -0
  8. package/dist-server/service/product/index.d.ts +5 -0
  9. package/dist-server/service/product/product-mutation.d.ts +16 -0
  10. package/dist-server/service/product/product-mutation.js +6 -6
  11. package/dist-server/service/product/product-mutation.js.map +1 -1
  12. package/dist-server/service/product/product-query.d.ts +28 -0
  13. package/dist-server/service/product/product-query.js +2 -2
  14. package/dist-server/service/product/product-query.js.map +1 -1
  15. package/dist-server/service/product/product-types.d.ts +151 -0
  16. package/dist-server/service/product/product-types.js +7 -8
  17. package/dist-server/service/product/product-types.js.map +1 -1
  18. package/dist-server/service/product/product.d.ts +112 -0
  19. package/dist-server/service/product/product.js +10 -12
  20. package/dist-server/service/product/product.js.map +1 -1
  21. package/dist-server/service/product/validate-product.d.ts +2 -0
  22. package/dist-server/service/product/validate-product.js +1 -2
  23. package/dist-server/service/product/validate-product.js.map +1 -1
  24. package/dist-server/service/product-bundle/index.d.ts +5 -0
  25. package/dist-server/service/product-bundle/product-bundle-mutation.d.ts +9 -0
  26. package/dist-server/service/product-bundle/product-bundle-mutation.js +2 -2
  27. package/dist-server/service/product-bundle/product-bundle-mutation.js.map +1 -1
  28. package/dist-server/service/product-bundle/product-bundle-query.d.ts +12 -0
  29. package/dist-server/service/product-bundle/product-bundle-query.js +2 -2
  30. package/dist-server/service/product-bundle/product-bundle-query.js.map +1 -1
  31. package/dist-server/service/product-bundle/product-bundle-types.d.ts +20 -0
  32. package/dist-server/service/product-bundle/product-bundle-types.js +6 -6
  33. package/dist-server/service/product-bundle/product-bundle-types.js.map +1 -1
  34. package/dist-server/service/product-bundle/product-bundle.d.ts +25 -0
  35. package/dist-server/service/product-bundle/product-bundle.js +3 -4
  36. package/dist-server/service/product-bundle/product-bundle.js.map +1 -1
  37. package/dist-server/service/product-bundle-setting/index.d.ts +5 -0
  38. package/dist-server/service/product-bundle-setting/product-bundle-setting-mutation.d.ts +10 -0
  39. package/dist-server/service/product-bundle-setting/product-bundle-setting-mutation.js +4 -4
  40. package/dist-server/service/product-bundle-setting/product-bundle-setting-mutation.js.map +1 -1
  41. package/dist-server/service/product-bundle-setting/product-bundle-setting-query.d.ts +6 -0
  42. package/dist-server/service/product-bundle-setting/product-bundle-setting-query.js +2 -2
  43. package/dist-server/service/product-bundle-setting/product-bundle-setting-query.js.map +1 -1
  44. package/dist-server/service/product-bundle-setting/product-bundle-setting-types.d.ts +16 -0
  45. package/dist-server/service/product-bundle-setting/product-bundle-setting-types.js +4 -4
  46. package/dist-server/service/product-bundle-setting/product-bundle-setting-types.js.map +1 -1
  47. package/dist-server/service/product-bundle-setting/product-bundle-setting.d.ts +12 -0
  48. package/dist-server/service/product-bundle-setting/product-bundle-setting.js +2 -2
  49. package/dist-server/service/product-bundle-setting/product-bundle-setting.js.map +1 -1
  50. package/dist-server/service/product-combination/index.d.ts +5 -0
  51. package/dist-server/service/product-combination/product-combination-mutation.d.ts +9 -0
  52. package/dist-server/service/product-combination/product-combination-mutation.js +2 -2
  53. package/dist-server/service/product-combination/product-combination-mutation.js.map +1 -1
  54. package/dist-server/service/product-combination/product-combination-query.d.ts +11 -0
  55. package/dist-server/service/product-combination/product-combination-query.js +2 -2
  56. package/dist-server/service/product-combination/product-combination-query.js.map +1 -1
  57. package/dist-server/service/product-combination/product-combination-type.d.ts +20 -0
  58. package/dist-server/service/product-combination/product-combination-type.js +6 -6
  59. package/dist-server/service/product-combination/product-combination-type.js.map +1 -1
  60. package/dist-server/service/product-combination/product-combination.d.ts +33 -0
  61. package/dist-server/service/product-combination/product-combination.js +3 -3
  62. package/dist-server/service/product-combination/product-combination.js.map +1 -1
  63. package/dist-server/service/product-combination-setting/index.d.ts +5 -0
  64. package/dist-server/service/product-combination-setting/product-combination-setting-mutation.d.ts +11 -0
  65. package/dist-server/service/product-combination-setting/product-combination-setting-mutation.js +4 -4
  66. package/dist-server/service/product-combination-setting/product-combination-setting-mutation.js.map +1 -1
  67. package/dist-server/service/product-combination-setting/product-combination-setting-query.d.ts +14 -0
  68. package/dist-server/service/product-combination-setting/product-combination-setting-query.js +2 -2
  69. package/dist-server/service/product-combination-setting/product-combination-setting-query.js.map +1 -1
  70. package/dist-server/service/product-combination-setting/product-combination-setting-type.d.ts +18 -0
  71. package/dist-server/service/product-combination-setting/product-combination-setting-type.js +6 -6
  72. package/dist-server/service/product-combination-setting/product-combination-setting-type.js.map +1 -1
  73. package/dist-server/service/product-combination-setting/product-combination-setting.d.ts +22 -0
  74. package/dist-server/service/product-combination-setting/product-combination-setting.js +2 -2
  75. package/dist-server/service/product-combination-setting/product-combination-setting.js.map +1 -1
  76. package/dist-server/service/product-detail/index.d.ts +5 -0
  77. package/dist-server/service/product-detail/product-detail-mutation.d.ts +11 -0
  78. package/dist-server/service/product-detail/product-detail-mutation.js +18 -23
  79. package/dist-server/service/product-detail/product-detail-mutation.js.map +1 -1
  80. package/dist-server/service/product-detail/product-detail-query.d.ts +12 -0
  81. package/dist-server/service/product-detail/product-detail-query.js +2 -2
  82. package/dist-server/service/product-detail/product-detail-query.js.map +1 -1
  83. package/dist-server/service/product-detail/product-detail-types.d.ts +98 -0
  84. package/dist-server/service/product-detail/product-detail-types.js +6 -6
  85. package/dist-server/service/product-detail/product-detail-types.js.map +1 -1
  86. package/dist-server/service/product-detail/product-detail.d.ts +121 -0
  87. package/dist-server/service/product-detail/product-detail.js +7 -8
  88. package/dist-server/service/product-detail/product-detail.js.map +1 -1
  89. package/dist-server/service/product-detail-bizplace-setting/index.d.ts +5 -0
  90. package/dist-server/service/product-detail-bizplace-setting/product-detail-bizplace-setting-mutation.d.ts +8 -0
  91. package/dist-server/service/product-detail-bizplace-setting/product-detail-bizplace-setting-mutation.js +2 -2
  92. package/dist-server/service/product-detail-bizplace-setting/product-detail-bizplace-setting-mutation.js.map +1 -1
  93. package/dist-server/service/product-detail-bizplace-setting/product-detail-bizplace-setting-query.d.ts +11 -0
  94. package/dist-server/service/product-detail-bizplace-setting/product-detail-bizplace-setting-query.js +2 -2
  95. package/dist-server/service/product-detail-bizplace-setting/product-detail-bizplace-setting-query.js.map +1 -1
  96. package/dist-server/service/product-detail-bizplace-setting/product-detail-bizplace-setting-types.d.ts +24 -0
  97. package/dist-server/service/product-detail-bizplace-setting/product-detail-bizplace-setting-types.js +6 -6
  98. package/dist-server/service/product-detail-bizplace-setting/product-detail-bizplace-setting-types.js.map +1 -1
  99. package/dist-server/service/product-detail-bizplace-setting/product-detail-bizplace-setting.d.ts +34 -0
  100. package/dist-server/service/product-detail-bizplace-setting/product-detail-bizplace-setting.js +2 -2
  101. package/dist-server/service/product-detail-bizplace-setting/product-detail-bizplace-setting.js.map +1 -1
  102. package/dist-server/service/product-set/index.d.ts +5 -0
  103. package/dist-server/service/product-set/product-set-mutation.d.ts +39 -0
  104. package/dist-server/service/product-set/product-set-mutation.js +5 -5
  105. package/dist-server/service/product-set/product-set-mutation.js.map +1 -1
  106. package/dist-server/service/product-set/product-set-query.d.ts +12 -0
  107. package/dist-server/service/product-set/product-set-query.js +2 -2
  108. package/dist-server/service/product-set/product-set-query.js.map +1 -1
  109. package/dist-server/service/product-set/product-set-types.d.ts +18 -0
  110. package/dist-server/service/product-set/product-set-types.js +6 -6
  111. package/dist-server/service/product-set/product-set-types.js.map +1 -1
  112. package/dist-server/service/product-set/product-set.d.ts +22 -0
  113. package/dist-server/service/product-set/product-set.js +3 -4
  114. package/dist-server/service/product-set/product-set.js.map +1 -1
  115. package/dist-server/tsconfig.tsbuildinfo +1 -1
  116. package/dist-server/utils/index.d.ts +1 -0
  117. package/dist-server/utils/product-util.d.ts +3 -0
  118. package/package.json +4 -4
  119. package/server/service/product/product.ts +1 -1
@@ -0,0 +1,9 @@
1
+ import { ProductCombination } from './product-combination';
2
+ import { NewProductCombination, ProductCombinationPatch } from './product-combination-type';
3
+ export declare class ProductCombinationMutation {
4
+ createProductCombination(productCombination: NewProductCombination, context: ResolverContext): Promise<ProductCombination>;
5
+ updateProductCombination(id: string, patch: ProductCombinationPatch, context: ResolverContext): Promise<ProductCombination>;
6
+ updateMultipleProductCombination(productDetailId: string, patches: ProductCombinationPatch[], context: ResolverContext): Promise<ProductCombination[]>;
7
+ deleteProductCombination(id: string, context: ResolverContext): Promise<boolean>;
8
+ deleteProductCombinations(ids: string[], context: ResolverContext): Promise<boolean>;
9
+ }
@@ -75,6 +75,7 @@ let ProductCombinationMutation = class ProductCombinationMutation {
75
75
  return true;
76
76
  }
77
77
  };
78
+ exports.ProductCombinationMutation = ProductCombinationMutation;
78
79
  tslib_1.__decorate([
79
80
  (0, type_graphql_1.Directive)('@transaction'),
80
81
  (0, type_graphql_1.Mutation)(returns => product_combination_1.ProductCombination, { description: 'To create new ProductCombination' }),
@@ -122,8 +123,7 @@ tslib_1.__decorate([
122
123
  tslib_1.__metadata("design:paramtypes", [Array, Object]),
123
124
  tslib_1.__metadata("design:returntype", Promise)
124
125
  ], ProductCombinationMutation.prototype, "deleteProductCombinations", null);
125
- ProductCombinationMutation = tslib_1.__decorate([
126
+ exports.ProductCombinationMutation = ProductCombinationMutation = tslib_1.__decorate([
126
127
  (0, type_graphql_1.Resolver)(product_combination_1.ProductCombination)
127
128
  ], ProductCombinationMutation);
128
- exports.ProductCombinationMutation = ProductCombinationMutation;
129
129
  //# sourceMappingURL=product-combination-mutation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"product-combination-mutation.js","sourceRoot":"","sources":["../../../server/service/product-combination/product-combination-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAAwC;AAExC,qEAAgE;AAChE,+DAAoF;AAC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AAI,CAAC,EAAE,CAAC,CAAC,kDAAuB,CAAC,CAAC,CAAA;IACjD,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;kFA6DP;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,8BAA8B,EAAE,CAAC;IAC9C,mBAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IAAc,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;0EAK3D;AAIK;IAFL,IAAA,wBAAS,EAAC,cAAc,CAAC;IACzB,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,wCAAwC,EAAE,CAAC;IAErF,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;2EAmBP;AA1IU,0BAA0B;IADtC,IAAA,uBAAQ,EAAC,wCAAkB,CAAC;GAChB,0BAA0B,CA2ItC;AA3IY,gEAA0B","sourcesContent":["import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'\nimport { In, Repository } from 'typeorm'\n\nimport { ProductDetail } from '../product-detail/product-detail'\nimport { ProductCombination, ProductCombinationStatus } from './product-combination'\nimport { NewProductCombination, ProductCombinationPatch } from './product-combination-type'\n\n@Resolver(ProductCombination)\nexport class ProductCombinationMutation {\n @Directive('@transaction')\n @Mutation(returns => ProductCombination, { description: 'To create new ProductCombination' })\n async createProductCombination(\n @Arg('productCombination') productCombination: NewProductCombination,\n @Ctx() context: ResolverContext\n ): Promise<ProductCombination> {\n const { domain, user, tx } = context.state\n\n return await tx.getRepository(ProductCombination).save({\n ...productCombination,\n domain,\n creator: user,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => ProductCombination, { description: 'To modify ProductCombination information' })\n async updateProductCombination(\n @Arg('id') id: string,\n @Arg('patch') patch: ProductCombinationPatch,\n @Ctx() context: ResolverContext\n ): Promise<ProductCombination> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(ProductCombination)\n const productCombination = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n return await repository.save({\n ...productCombination,\n ...patch,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => [ProductCombination], { description: \"To modify multiple ProductCombinations' information\" })\n async updateMultipleProductCombination(\n @Arg('productDetailId', type => String) productDetailId: string,\n @Arg('patches', type => [ProductCombinationPatch]) patches: ProductCombinationPatch[],\n @Ctx() context: ResolverContext\n ): Promise<ProductCombination[]> {\n const { domain, user, tx } = context.state\n\n let results = []\n const _createRecords = patches.filter((patch: any) => !patch.id)\n const _updateRecords = patches.filter((patch: any) => patch.id)\n const productDetailRepo = tx.getRepository(ProductDetail)\n const productCombinationRepo = tx.getRepository(ProductCombination)\n\n if (_createRecords.length > 0) {\n for (let i = 0; i < _createRecords.length; i++) {\n let newRecord = _createRecords[i]\n const productDetail: ProductDetail = await productDetailRepo.findOne({\n where: { id: productDetailId },\n relations: ['product']\n })\n\n delete newRecord.id\n\n if (!newRecord?.status) {\n newRecord.status = ProductCombinationStatus.INACTIVE\n }\n\n const result = await productCombinationRepo.save({\n ...newRecord,\n domain,\n productDetail,\n product: productDetail.product,\n status: newRecord.status.toUpperCase(),\n creator: user,\n updater: user\n })\n\n results.push({ ...result, cuFlag: '+' })\n }\n }\n\n if (_updateRecords.length > 0) {\n for (let i = 0; i < _updateRecords.length; i++) {\n const newRecord = _updateRecords[i]\n const productCombination = await productCombinationRepo.findOneBy({\n domain: { id: domain.id },\n id: newRecord.id\n })\n\n if (newRecord.status) {\n newRecord.status = newRecord.status.toUpperCase()\n }\n\n const result = await productCombinationRepo.save({\n ...productCombination,\n ...newRecord,\n updater: user\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete ProductCombination' })\n async deleteProductCombination(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { user, tx } = context.state\n\n await tx.getRepository(ProductCombination).update({ id }, { deletedAt: new Date(), deletedBy: user })\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple productCombinations' })\n async deleteProductCombinations(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { user, tx } = context.state\n\n const productCombinationRepo: Repository<ProductCombination> = tx.getRepository(ProductCombination)\n\n let productCombinations = await productCombinationRepo.find({ where: { id: In(ids) } })\n\n for (let i = 0; i < productCombinations.length; i++) {\n const product = productCombinations[i]\n\n await productCombinationRepo.save({\n ...product,\n status: ProductCombinationStatus.DELETED,\n updater: user\n })\n }\n\n return true\n }\n}\n"]}
1
+ {"version":3,"file":"product-combination-mutation.js","sourceRoot":"","sources":["../../../server/service/product-combination/product-combination-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAAwC;AAExC,qEAAgE;AAChE,+DAAoF;AACpF,yEAA2F;AAGpF,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IAG/B,AAAN,KAAK,CAAC,wBAAwB,CACD,kBAAyC,EAC7D,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,OAAO,MAAM,EAAE,CAAC,aAAa,CAAC,wCAAkB,CAAC,CAAC,IAAI,iCACjD,kBAAkB,KACrB,MAAM,EACN,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,IAAI,IACb,CAAA;IACJ,CAAC;IAIK,AAAN,KAAK,CAAC,wBAAwB,CACjB,EAAU,EACP,KAA8B,EACrC,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CA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AA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,wCAAwC,EAAE,CAAC;IAErF,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAC5B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;2EAmBP;qCA1IU,0BAA0B;IADtC,IAAA,uBAAQ,EAAC,wCAAkB,CAAC;GAChB,0BAA0B,CA2ItC","sourcesContent":["import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'\nimport { In, Repository } from 'typeorm'\n\nimport { ProductDetail } from '../product-detail/product-detail'\nimport { ProductCombination, ProductCombinationStatus } from './product-combination'\nimport { NewProductCombination, ProductCombinationPatch } from './product-combination-type'\n\n@Resolver(ProductCombination)\nexport class ProductCombinationMutation {\n @Directive('@transaction')\n @Mutation(returns => ProductCombination, { description: 'To create new ProductCombination' })\n async createProductCombination(\n @Arg('productCombination') productCombination: NewProductCombination,\n @Ctx() context: ResolverContext\n ): Promise<ProductCombination> {\n const { domain, user, tx } = context.state\n\n return await tx.getRepository(ProductCombination).save({\n ...productCombination,\n domain,\n creator: user,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => ProductCombination, { description: 'To modify ProductCombination information' })\n async updateProductCombination(\n @Arg('id') id: string,\n @Arg('patch') patch: ProductCombinationPatch,\n @Ctx() context: ResolverContext\n ): Promise<ProductCombination> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(ProductCombination)\n const productCombination = await repository.findOne({\n where: { domain: { id: domain.id }, id }\n })\n\n return await repository.save({\n ...productCombination,\n ...patch,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => [ProductCombination], { description: \"To modify multiple ProductCombinations' information\" })\n async updateMultipleProductCombination(\n @Arg('productDetailId', type => String) productDetailId: string,\n @Arg('patches', type => [ProductCombinationPatch]) patches: ProductCombinationPatch[],\n @Ctx() context: ResolverContext\n ): Promise<ProductCombination[]> {\n const { domain, user, tx } = context.state\n\n let results = []\n const _createRecords = patches.filter((patch: any) => !patch.id)\n const _updateRecords = patches.filter((patch: any) => patch.id)\n const productDetailRepo = tx.getRepository(ProductDetail)\n const productCombinationRepo = tx.getRepository(ProductCombination)\n\n if (_createRecords.length > 0) {\n for (let i = 0; i < _createRecords.length; i++) {\n let newRecord = _createRecords[i]\n const productDetail: ProductDetail = await productDetailRepo.findOne({\n where: { id: productDetailId },\n relations: ['product']\n })\n\n delete newRecord.id\n\n if (!newRecord?.status) {\n newRecord.status = ProductCombinationStatus.INACTIVE\n }\n\n const result = await productCombinationRepo.save({\n ...newRecord,\n domain,\n productDetail,\n product: productDetail.product,\n status: newRecord.status.toUpperCase(),\n creator: user,\n updater: user\n })\n\n results.push({ ...result, cuFlag: '+' })\n }\n }\n\n if (_updateRecords.length > 0) {\n for (let i = 0; i < _updateRecords.length; i++) {\n const newRecord = _updateRecords[i]\n const productCombination = await productCombinationRepo.findOneBy({\n domain: { id: domain.id },\n id: newRecord.id\n })\n\n if (newRecord.status) {\n newRecord.status = newRecord.status.toUpperCase()\n }\n\n const result = await productCombinationRepo.save({\n ...productCombination,\n ...newRecord,\n updater: user\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete ProductCombination' })\n async deleteProductCombination(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { user, tx } = context.state\n\n await tx.getRepository(ProductCombination).update({ id }, { deletedAt: new Date(), deletedBy: user })\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple productCombinations' })\n async deleteProductCombinations(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { user, tx } = context.state\n\n const productCombinationRepo: Repository<ProductCombination> = tx.getRepository(ProductCombination)\n\n let productCombinations = await productCombinationRepo.find({ where: { id: In(ids) } })\n\n for (let i = 0; i < productCombinations.length; i++) {\n const product = productCombinations[i]\n\n await productCombinationRepo.save({\n ...product,\n status: ProductCombinationStatus.DELETED,\n updater: user\n })\n }\n\n return true\n }\n}\n"]}
@@ -0,0 +1,11 @@
1
+ import { User } from '@things-factory/auth-base';
2
+ import { Domain, ListParam } from '@things-factory/shell';
3
+ import { ProductCombination } from './product-combination';
4
+ import { ProductCombinationList } from './product-combination-type';
5
+ export declare class ProductCombinationQuery {
6
+ productCombination(name: string, context: ResolverContext): Promise<ProductCombination>;
7
+ productCombinations(params: ListParam, context: ResolverContext): Promise<ProductCombinationList>;
8
+ domain(productCombination: ProductCombination): Promise<Domain>;
9
+ updater(productCombination: ProductCombination): Promise<User>;
10
+ creator(productCombination: ProductCombination): Promise<User>;
11
+ }
@@ -29,6 +29,7 @@ let ProductCombinationQuery = class ProductCombinationQuery {
29
29
  return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: productCombination.creatorId });
30
30
  }
31
31
  };
32
+ exports.ProductCombinationQuery = ProductCombinationQuery;
32
33
  tslib_1.__decorate([
33
34
  (0, type_graphql_1.Query)(returns => product_combination_1.ProductCombination, { description: 'To fetch a ProductCombination' }),
34
35
  tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
@@ -66,8 +67,7 @@ tslib_1.__decorate([
66
67
  tslib_1.__metadata("design:paramtypes", [product_combination_1.ProductCombination]),
67
68
  tslib_1.__metadata("design:returntype", Promise)
68
69
  ], ProductCombinationQuery.prototype, "creator", null);
69
- ProductCombinationQuery = tslib_1.__decorate([
70
+ exports.ProductCombinationQuery = ProductCombinationQuery = tslib_1.__decorate([
70
71
  (0, type_graphql_1.Resolver)(product_combination_1.ProductCombination)
71
72
  ], ProductCombinationQuery);
72
- exports.ProductCombinationQuery = ProductCombinationQuery;
73
73
  //# sourceMappingURL=product-combination-query.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"product-combination-query.js","sourceRoot":"","sources":["../../../server/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AAC,OAAO,CAAS,kBAAsC;QAC1D,OAAO,MAAM,IAAA,qBAAa,EAAC,gBAAI,CAAC,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,kBAAkB,CAAC,SAAS,EAAE,CAAC,CAAA;IAClF,CAAC;CACF,CAAA;AApCO;IADL,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,wCAAkB,EAAE,EAAE,WAAW,EAAE,+BAA+B,EAAE,CAAC;IAC7D,mBAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IAAgB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;iEAMvD;AAGK;IADL,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,iDAAsB,EAAE,EAAE,WAAW,EAAE,uCAAuC,EAAE,CAAC;IAEhG,mBAAA,IAAA,mBAAI,GAAE,CAAA;IACN,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CADU,iBAAS;;kEAU1B;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAqB,wCAAkB;;qDAE1D;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAqB,wCAAkB;;sDAE3D;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAqB,wCAAkB;;sDAE3D;AArCU,uBAAuB;IADnC,IAAA,uBAAQ,EAAC,wCAAkB,CAAC;GAChB,uBAAuB,CAsCnC;AAtCY,0DAAuB","sourcesContent":["import { Arg, Args, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graphql'\n\nimport { User } from '@things-factory/auth-base'\nimport { convertListParams, Domain, getRepository, ListParam } from '@things-factory/shell'\n\nimport { ProductCombination } from './product-combination'\nimport { ProductCombinationList } from './product-combination-type'\n\n@Resolver(ProductCombination)\nexport class ProductCombinationQuery {\n @Query(returns => ProductCombination, { description: 'To fetch a ProductCombination' })\n async productCombination(@Arg('id') name: string, @Ctx() context: ResolverContext): Promise<ProductCombination> {\n const { domain, tx } = context.state\n\n return await tx.getRepository(ProductCombination).findOne({\n where: { domain: { id: domain.id }, name }\n })\n }\n\n @Query(returns => ProductCombinationList, { description: 'To fetch multiple ProductCombinations' })\n async productCombinations(\n @Args() params: ListParam,\n @Ctx() context: ResolverContext\n ): Promise<ProductCombinationList> {\n const convertedParams = convertListParams(params)\n const [items, total] = await getRepository(ProductCombination).findAndCount({\n ...convertedParams,\n relations: ['product', 'productDetail']\n })\n\n return { items, total }\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() productCombination: ProductCombination): Promise<Domain> {\n return await getRepository(Domain).findOneBy({ id: productCombination.domainId })\n }\n\n @FieldResolver(type => User)\n async updater(@Root() productCombination: ProductCombination): Promise<User> {\n return await getRepository(User).findOneBy({ id: productCombination.updaterId })\n }\n\n @FieldResolver(type => User)\n async creator(@Root() productCombination: ProductCombination): Promise<User> {\n return await getRepository(User).findOneBy({ id: productCombination.creatorId })\n }\n}\n"]}
1
+ {"version":3,"file":"product-combination-query.js","sourceRoot":"","sources":["../../../server/service/product-combination/product-combination-query.ts"],"names":[],"mappings":";;;;AAAA,+CAAmF;AAEnF,yDAAgD;AAChD,iDAA2F;AAE3F,+DAA0D;AAC1D,yEAAmE;AAG5D,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAE5B,AAAN,KAAK,CAAC,kBAAkB,CAAY,IAAY,EAAS,OAAwB;QAC/E,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEpC,OAAO,MAAM,EAAE,CAAC,aAAa,CAAC,wCAAkB,CAAC,CAAC,OAAO,CAAC;YACxD,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EA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A,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,iDAAsB,EAAE,EAAE,WAAW,EAAE,uCAAuC,EAAE,CAAC;IAEhG,mBAAA,IAAA,mBAAI,GAAE,CAAA;IACN,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CADU,iBAAS;;kEAU1B;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAqB,wCAAkB;;qDAE1D;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAqB,wCAAkB;;sDAE3D;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,CAAC;IACb,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAqB,wCAAkB;;sDAE3D;kCArCU,uBAAuB;IADnC,IAAA,uBAAQ,EAAC,wCAAkB,CAAC;GAChB,uBAAuB,CAsCnC","sourcesContent":["import { Arg, Args, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graphql'\n\nimport { User } from '@things-factory/auth-base'\nimport { convertListParams, Domain, getRepository, ListParam } from '@things-factory/shell'\n\nimport { ProductCombination } from './product-combination'\nimport { ProductCombinationList } from './product-combination-type'\n\n@Resolver(ProductCombination)\nexport class ProductCombinationQuery {\n @Query(returns => ProductCombination, { description: 'To fetch a ProductCombination' })\n async productCombination(@Arg('id') name: string, @Ctx() context: ResolverContext): Promise<ProductCombination> {\n const { domain, tx } = context.state\n\n return await tx.getRepository(ProductCombination).findOne({\n where: { domain: { id: domain.id }, name }\n })\n }\n\n @Query(returns => ProductCombinationList, { description: 'To fetch multiple ProductCombinations' })\n async productCombinations(\n @Args() params: ListParam,\n @Ctx() context: ResolverContext\n ): Promise<ProductCombinationList> {\n const convertedParams = convertListParams(params)\n const [items, total] = await getRepository(ProductCombination).findAndCount({\n ...convertedParams,\n relations: ['product', 'productDetail']\n })\n\n return { items, total }\n }\n\n @FieldResolver(type => Domain)\n async domain(@Root() productCombination: ProductCombination): Promise<Domain> {\n return await getRepository(Domain).findOneBy({ id: productCombination.domainId })\n }\n\n @FieldResolver(type => User)\n async updater(@Root() productCombination: ProductCombination): Promise<User> {\n return await getRepository(User).findOneBy({ id: productCombination.updaterId })\n }\n\n @FieldResolver(type => User)\n async creator(@Root() productCombination: ProductCombination): Promise<User> {\n return await getRepository(User).findOneBy({ id: productCombination.creatorId })\n }\n}\n"]}
@@ -0,0 +1,20 @@
1
+ import { ObjectRef } from '@things-factory/shell';
2
+ import { ProductCombination } from './product-combination';
3
+ export declare class NewProductCombination {
4
+ name: string;
5
+ description?: string;
6
+ status?: string;
7
+ }
8
+ export declare class ProductCombinationPatch {
9
+ id?: string;
10
+ name?: string;
11
+ description?: string;
12
+ status?: string;
13
+ product?: ObjectRef;
14
+ productDetail?: ObjectRef;
15
+ cuFlag?: string;
16
+ }
17
+ export declare class ProductCombinationList {
18
+ items: ProductCombination[];
19
+ total: number;
20
+ }
@@ -7,6 +7,7 @@ const shell_1 = require("@things-factory/shell");
7
7
  const product_combination_1 = require("./product-combination");
8
8
  let NewProductCombination = class NewProductCombination {
9
9
  };
10
+ exports.NewProductCombination = NewProductCombination;
10
11
  tslib_1.__decorate([
11
12
  (0, type_graphql_1.Field)(),
12
13
  tslib_1.__metadata("design:type", String)
@@ -19,12 +20,12 @@ tslib_1.__decorate([
19
20
  (0, type_graphql_1.Field)(type => product_combination_1.ProductCombinationStatus, { nullable: true }),
20
21
  tslib_1.__metadata("design:type", String)
21
22
  ], NewProductCombination.prototype, "status", void 0);
22
- NewProductCombination = tslib_1.__decorate([
23
+ exports.NewProductCombination = NewProductCombination = tslib_1.__decorate([
23
24
  (0, type_graphql_1.InputType)()
24
25
  ], NewProductCombination);
25
- exports.NewProductCombination = NewProductCombination;
26
26
  let ProductCombinationPatch = class ProductCombinationPatch {
27
27
  };
28
+ exports.ProductCombinationPatch = ProductCombinationPatch;
28
29
  tslib_1.__decorate([
29
30
  (0, type_graphql_1.Field)(type => type_graphql_1.ID, { nullable: true }),
30
31
  tslib_1.__metadata("design:type", String)
@@ -53,12 +54,12 @@ tslib_1.__decorate([
53
54
  (0, type_graphql_1.Field)({ nullable: true }),
54
55
  tslib_1.__metadata("design:type", String)
55
56
  ], ProductCombinationPatch.prototype, "cuFlag", void 0);
56
- ProductCombinationPatch = tslib_1.__decorate([
57
+ exports.ProductCombinationPatch = ProductCombinationPatch = tslib_1.__decorate([
57
58
  (0, type_graphql_1.InputType)()
58
59
  ], ProductCombinationPatch);
59
- exports.ProductCombinationPatch = ProductCombinationPatch;
60
60
  let ProductCombinationList = class ProductCombinationList {
61
61
  };
62
+ exports.ProductCombinationList = ProductCombinationList;
62
63
  tslib_1.__decorate([
63
64
  (0, type_graphql_1.Field)(type => [product_combination_1.ProductCombination]),
64
65
  tslib_1.__metadata("design:type", Array)
@@ -67,8 +68,7 @@ tslib_1.__decorate([
67
68
  (0, type_graphql_1.Field)(type => type_graphql_1.Int),
68
69
  tslib_1.__metadata("design:type", Number)
69
70
  ], ProductCombinationList.prototype, "total", void 0);
70
- ProductCombinationList = tslib_1.__decorate([
71
+ exports.ProductCombinationList = ProductCombinationList = tslib_1.__decorate([
71
72
  (0, type_graphql_1.ObjectType)()
72
73
  ], ProductCombinationList);
73
- exports.ProductCombinationList = ProductCombinationList;
74
74
  //# sourceMappingURL=product-combination-type.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"product-combination-type.js","sourceRoot":"","sources":["../../../server/service/product-combination/product-combination-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAoE;AAEpE,iDAAiD;AAEjD,+DAAoF;AAG7E,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;CASjC,CAAA;AARC;IAAC,IAAA,oBAAK,GAAE;;mDACI;AAEZ;IAAC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,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B","sourcesContent":["import { Field, ID, InputType, Int, ObjectType } from 'type-graphql'\n\nimport { ObjectRef } from '@things-factory/shell'\n\nimport { ProductCombination, ProductCombinationStatus } from './product-combination'\n\n@InputType()\nexport class NewProductCombination {\n @Field()\n name: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field(type => ProductCombinationStatus, { nullable: true })\n status?: string\n}\n\n@InputType()\nexport class ProductCombinationPatch {\n @Field(type => ID, { nullable: true })\n id?: string\n\n @Field({ nullable: true })\n name?: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field({ nullable: true })\n status?: string\n\n @Field({ nullable: true })\n product?: ObjectRef\n\n @Field({ nullable: true })\n productDetail?: ObjectRef\n\n @Field({ nullable: true })\n cuFlag?: string\n}\n\n@ObjectType()\nexport class ProductCombinationList {\n @Field(type => [ProductCombination])\n items: ProductCombination[]\n\n @Field(type => Int)\n total: number\n}\n"]}
1
+ {"version":3,"file":"product-combination-type.js","sourceRoot":"","sources":["../../../server/service/product-combination/product-combination-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAoE;AAEpE,iDAAiD;AAEjD,+DAAoF;AAG7E,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;CASjC,CAAA;AATY,sDAAqB;AAEhC;IADC,IAAA,oBAAK,GAAE;;mDACI;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0DACN;AAGpB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,8CAAwB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDAC7C;gCARJ,qBAAqB;IADjC,IAAA,wBAAS,GAAE;GACC,qBAAqB,CASjC;AAGM,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;CAqBnC,CAAA;AArBY,0DAAuB;AAElC;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDAC3B;AAGX;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDACb;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4DACN;AAGpB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uDACX;AAGf;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCAChB,iBAAS;wDAAA;AAGnB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACV,iBAAS;8DAAA;AAGzB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uDACX;kCApBJ,uBAAuB;IADnC,IAAA,wBAAS,GAAE;GACC,uBAAuB,CAqBnC;AAGM,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;CAMlC,CAAA;AANY,wDAAsB;AAEjC;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,wCAAkB,CAAC,CAAC;;qDACT;AAG3B;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;qDACN;iCALF,sBAAsB;IADlC,IAAA,yBAAU,GAAE;GACA,sBAAsB,CAMlC","sourcesContent":["import { Field, ID, InputType, Int, ObjectType } from 'type-graphql'\n\nimport { ObjectRef } from '@things-factory/shell'\n\nimport { ProductCombination, ProductCombinationStatus } from './product-combination'\n\n@InputType()\nexport class NewProductCombination {\n @Field()\n name: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field(type => ProductCombinationStatus, { nullable: true })\n status?: string\n}\n\n@InputType()\nexport class ProductCombinationPatch {\n @Field(type => ID, { nullable: true })\n id?: string\n\n @Field({ nullable: true })\n name?: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field({ nullable: true })\n status?: string\n\n @Field({ nullable: true })\n product?: ObjectRef\n\n @Field({ nullable: true })\n productDetail?: ObjectRef\n\n @Field({ nullable: true })\n cuFlag?: string\n}\n\n@ObjectType()\nexport class ProductCombinationList {\n @Field(type => [ProductCombination])\n items: ProductCombination[]\n\n @Field(type => Int)\n total: number\n}\n"]}
@@ -0,0 +1,33 @@
1
+ import { User } from '@things-factory/auth-base';
2
+ import { Domain } from '@things-factory/shell';
3
+ import { ProductCombinationSetting } from '../product-combination-setting/product-combination-setting';
4
+ import { ProductDetail } from '../product-detail/product-detail';
5
+ import { Product } from '../product/product';
6
+ export declare enum ProductCombinationStatus {
7
+ ACTIVE = "ACTIVE",
8
+ ACTIVATED = "ACTIVATED",
9
+ DELETED = "DELETED",
10
+ INACTIVE = "INACTIVE"
11
+ }
12
+ export declare class ProductCombination {
13
+ readonly id: string;
14
+ domain?: Domain;
15
+ domainId?: string;
16
+ name: string;
17
+ productCombinationSettings?: ProductCombinationSetting[];
18
+ product?: Product;
19
+ productId?: string;
20
+ productDetail?: ProductDetail;
21
+ productDetailId?: string;
22
+ description?: string;
23
+ deletedAt: Date;
24
+ deletedBy: User;
25
+ deletedById?: string;
26
+ status?: string;
27
+ createdAt?: Date;
28
+ updatedAt?: Date;
29
+ creator?: User;
30
+ creatorId?: string;
31
+ updater?: User;
32
+ updaterId?: string;
33
+ }
@@ -15,13 +15,14 @@ var ProductCombinationStatus;
15
15
  ProductCombinationStatus["ACTIVATED"] = "ACTIVATED";
16
16
  ProductCombinationStatus["DELETED"] = "DELETED";
17
17
  ProductCombinationStatus["INACTIVE"] = "INACTIVE";
18
- })(ProductCombinationStatus = exports.ProductCombinationStatus || (exports.ProductCombinationStatus = {}));
18
+ })(ProductCombinationStatus || (exports.ProductCombinationStatus = ProductCombinationStatus = {}));
19
19
  (0, type_graphql_1.registerEnumType)(ProductCombinationStatus, {
20
20
  name: 'ProductCombinationStatus',
21
21
  description: 'status enumeration of a productCombination'
22
22
  });
23
23
  let ProductCombination = class ProductCombination {
24
24
  };
25
+ exports.ProductCombination = ProductCombination;
25
26
  tslib_1.__decorate([
26
27
  (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
27
28
  (0, type_graphql_1.Field)(type => type_graphql_1.ID),
@@ -115,10 +116,9 @@ tslib_1.__decorate([
115
116
  (0, typeorm_1.RelationId)((productCombination) => productCombination.updater),
116
117
  tslib_1.__metadata("design:type", String)
117
118
  ], ProductCombination.prototype, "updaterId", void 0);
118
- ProductCombination = tslib_1.__decorate([
119
+ exports.ProductCombination = ProductCombination = tslib_1.__decorate([
119
120
  (0, typeorm_1.Entity)(),
120
121
  (0, typeorm_1.Index)('ix_product_combination_0', (productCombination) => [productCombination.domain, productCombination.id], { unique: true }),
121
122
  (0, type_graphql_1.ObjectType)({ description: 'Entity for ProductCombination' })
122
123
  ], ProductCombination);
123
- exports.ProductCombination = ProductCombination;
124
124
  //# sourceMappingURL=product-combination.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"product-combination.js","sourceRoot":"","sources":["../../../server/service/product-combination/product-combination.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAUgB;AAEhB,yDAAgD;AAChD,iDAA8C;AAE9C,4GAAsG;AACtG,qEAAgE;AAChE,gDAA4C;AAE5C,IAAY,wBAKX;AALD,WAAY,wBAAwB;IAClC,6CAAiB,CAAA;IACjB,mDAAuB,CAAA;IACvB,+CAAmB,CAAA;IACnB,iDAAqB,CAAA;AACvB,CAAC,EALW,wBAAwB,GAAxB,gCAAwB,KAAxB,gCAAwB,QAKnC;AAED,IAAA,+BAAgB,EAAC,wBAAwB,EAAE;IACzC,IAAI,EAAE,0BAA0B;IAChC,WAAW,EAAE,4CAA4C;CAC1D,CAAC,CAAA;AASK,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;CA4E9B,CAAA;AA3EC;IAAC,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,CAAC;;8CACC;AAEnB;IAAC,IAAA,mBAA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A,oBAAU,EAAC,CAAC,kBAAsC,EAAE,EAAE,CAAC,kBAAkB,CAAC,OAAO,CAAC;;qDACjE;AA3EP,kBAAkB;IAP9B,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EACJ,0BAA0B,EAC1B,CAAC,kBAAsC,EAAE,EAAE,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE,kBAAkB,CAAC,EAAE,CAAC,EAC9F,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB;IACA,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,+BAA+B,EAAE,CAAC;GAChD,kBAAkB,CA4E9B;AA5EY,gDAAkB","sourcesContent":["import { Field, ID, ObjectType, registerEnumType } from 'type-graphql'\nimport {\n Column,\n CreateDateColumn,\n Entity,\n Index,\n ManyToOne,\n OneToMany,\n PrimaryGeneratedColumn,\n RelationId,\n UpdateDateColumn\n} from 'typeorm'\n\nimport { User } from '@things-factory/auth-base'\nimport { Domain } from '@things-factory/shell'\n\nimport { ProductCombinationSetting } from '../product-combination-setting/product-combination-setting'\nimport { ProductDetail } from '../product-detail/product-detail'\nimport { Product } from '../product/product'\n\nexport enum ProductCombinationStatus {\n ACTIVE = 'ACTIVE',\n ACTIVATED = 'ACTIVATED',\n DELETED = 'DELETED',\n INACTIVE = 'INACTIVE'\n}\n\nregisterEnumType(ProductCombinationStatus, {\n name: 'ProductCombinationStatus',\n description: 'status enumeration of a productCombination'\n})\n\n@Entity()\n@Index(\n 'ix_product_combination_0',\n (productCombination: ProductCombination) => [productCombination.domain, productCombination.id],\n { unique: true }\n)\n@ObjectType({ description: 'Entity for ProductCombination' })\nexport class ProductCombination {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @ManyToOne(type => Domain)\n @Field({ nullable: true })\n domain?: Domain\n\n @RelationId((productCombination: ProductCombination) => productCombination.domain)\n domainId?: string\n\n @Column()\n @Field()\n name: string\n\n @OneToMany(\n type => ProductCombinationSetting,\n productCombinationSetting => productCombinationSetting.productCombination\n )\n @Field(type => [ProductCombinationSetting], { nullable: true })\n productCombinationSettings?: ProductCombinationSetting[]\n\n @ManyToOne(type => Product)\n @Field(type => Product)\n product?: Product\n\n @RelationId((productCombination: ProductCombination) => productCombination.product)\n productId?: string\n\n @ManyToOne(type => ProductDetail, { nullable: false })\n @Field(type => ProductDetail)\n productDetail?: ProductDetail\n\n @RelationId((productCombination: ProductCombination) => productCombination.productDetail)\n productDetailId?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n description?: string\n\n @Column({ nullable: true })\n deletedAt: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field({ nullable: true })\n deletedBy: User\n\n @RelationId((productCombination: ProductCombination) => productCombination.deletedBy)\n deletedById?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n status?: string\n\n @CreateDateColumn()\n @Field({ nullable: true })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true })\n updatedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field({ nullable: true })\n creator?: User\n\n @RelationId((productCombination: ProductCombination) => productCombination.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field({ nullable: true })\n updater?: User\n\n @RelationId((productCombination: ProductCombination) => productCombination.updater)\n updaterId?: string\n}\n"]}
1
+ {"version":3,"file":"product-combination.js","sourceRoot":"","sources":["../../../server/service/product-combination/product-combination.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAUgB;AAEhB,yDAAgD;AAChD,iDAA8C;AAE9C,4GAAsG;AACtG,qEAAgE;AAChE,gDAA4C;AAE5C,IAAY,wBAKX;AALD,WAAY,wBAAwB;IAClC,6CAAiB,CAAA;IACjB,mDAAuB,CAAA;IACvB,+CAAmB,CAAA;IACnB,iDAAqB,CAAA;AACvB,CAAC,EALW,wBAAwB,wCAAxB,wBAAwB,QAKnC;AAED,IAAA,+BAAgB,EAAC,wBAAwB,EAAE;IACzC,IAAI,EAAE,0BAA0B;IACh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CAAC,kBAAkB,CAAC,OAAO,CAAC;;qDACjE;AAIlB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC3C,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCAChB,gBAAI;mDAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,kBAAsC,EAAE,EAAE,CAAC,kBAAkB,CAAC,OAAO,CAAC;;qDACjE;6BA3EP,kBAAkB;IAP9B,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EACJ,0BAA0B,EAC1B,CAAC,kBAAsC,EAAE,EAAE,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE,kBAAkB,CAAC,EAAE,CAAC,EAC9F,EAAE,MAAM,EAAE,IAAI,EAAE,CACjB;IACA,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,+BAA+B,EAAE,CAAC;GAChD,kBAAkB,CA4E9B","sourcesContent":["import { Field, ID, ObjectType, registerEnumType } from 'type-graphql'\nimport {\n Column,\n CreateDateColumn,\n Entity,\n Index,\n ManyToOne,\n OneToMany,\n PrimaryGeneratedColumn,\n RelationId,\n UpdateDateColumn\n} from 'typeorm'\n\nimport { User } from '@things-factory/auth-base'\nimport { Domain } from '@things-factory/shell'\n\nimport { ProductCombinationSetting } from '../product-combination-setting/product-combination-setting'\nimport { ProductDetail } from '../product-detail/product-detail'\nimport { Product } from '../product/product'\n\nexport enum ProductCombinationStatus {\n ACTIVE = 'ACTIVE',\n ACTIVATED = 'ACTIVATED',\n DELETED = 'DELETED',\n INACTIVE = 'INACTIVE'\n}\n\nregisterEnumType(ProductCombinationStatus, {\n name: 'ProductCombinationStatus',\n description: 'status enumeration of a productCombination'\n})\n\n@Entity()\n@Index(\n 'ix_product_combination_0',\n (productCombination: ProductCombination) => [productCombination.domain, productCombination.id],\n { unique: true }\n)\n@ObjectType({ description: 'Entity for ProductCombination' })\nexport class ProductCombination {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @ManyToOne(type => Domain)\n @Field({ nullable: true })\n domain?: Domain\n\n @RelationId((productCombination: ProductCombination) => productCombination.domain)\n domainId?: string\n\n @Column()\n @Field()\n name: string\n\n @OneToMany(\n type => ProductCombinationSetting,\n productCombinationSetting => productCombinationSetting.productCombination\n )\n @Field(type => [ProductCombinationSetting], { nullable: true })\n productCombinationSettings?: ProductCombinationSetting[]\n\n @ManyToOne(type => Product)\n @Field(type => Product)\n product?: Product\n\n @RelationId((productCombination: ProductCombination) => productCombination.product)\n productId?: string\n\n @ManyToOne(type => ProductDetail, { nullable: false })\n @Field(type => ProductDetail)\n productDetail?: ProductDetail\n\n @RelationId((productCombination: ProductCombination) => productCombination.productDetail)\n productDetailId?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n description?: string\n\n @Column({ nullable: true })\n deletedAt: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field({ nullable: true })\n deletedBy: User\n\n @RelationId((productCombination: ProductCombination) => productCombination.deletedBy)\n deletedById?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n status?: string\n\n @CreateDateColumn()\n @Field({ nullable: true })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true })\n updatedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field({ nullable: true })\n creator?: User\n\n @RelationId((productCombination: ProductCombination) => productCombination.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field({ nullable: true })\n updater?: User\n\n @RelationId((productCombination: ProductCombination) => productCombination.updater)\n updaterId?: string\n}\n"]}
@@ -0,0 +1,5 @@
1
+ import { ProductCombinationSetting } from './product-combination-setting';
2
+ import { ProductCombinationSettingQuery } from './product-combination-setting-query';
3
+ import { ProductCombinationSettingMutation } from './product-combination-setting-mutation';
4
+ export declare const entities: (typeof ProductCombinationSetting)[];
5
+ export declare const resolvers: (typeof ProductCombinationSettingQuery | typeof ProductCombinationSettingMutation)[];
@@ -0,0 +1,11 @@
1
+ import { ProductCombinationSetting } from './product-combination-setting';
2
+ import { NewProductCombinationSetting, ProductCombinationSettingPatch } from './product-combination-setting-type';
3
+ export declare class ProductCombinationSettingMutation {
4
+ createProductCombinationSetting(productCombinationSetting: NewProductCombinationSetting, context: ResolverContext): Promise<ProductCombinationSetting>;
5
+ updateProductCombinationSetting(id: string, patch: ProductCombinationSettingPatch, context: ResolverContext): Promise<ProductCombinationSetting>;
6
+ updateMultipleProductCombinationSetting(patches: ProductCombinationSettingPatch[], context: ResolverContext): Promise<ProductCombinationSetting[]>;
7
+ deleteProductCombinationSetting(id: string, context: ResolverContext): Promise<boolean>;
8
+ deleteProductCombinationSettings(ids: string[], context: ResolverContext): Promise<boolean>;
9
+ linkProductCombination(productCombinationId: string, patches: ProductCombinationSettingPatch[], context: ResolverContext): Promise<boolean>;
10
+ }
11
+ export declare function updateMultipleProductCombinationSetting(patches: any, context: ResolverContext): Promise<any[]>;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateMultipleProductCombinationSetting = exports.ProductCombinationSettingMutation = void 0;
3
+ exports.ProductCombinationSettingMutation = void 0;
4
+ exports.updateMultipleProductCombinationSetting = updateMultipleProductCombinationSetting;
4
5
  const tslib_1 = require("tslib");
5
6
  const type_graphql_1 = require("type-graphql");
6
7
  const typeorm_1 = require("typeorm");
@@ -120,6 +121,7 @@ let ProductCombinationSettingMutation = class ProductCombinationSettingMutation
120
121
  }
121
122
  }
122
123
  };
124
+ exports.ProductCombinationSettingMutation = ProductCombinationSettingMutation;
123
125
  tslib_1.__decorate([
124
126
  (0, type_graphql_1.Directive)('@transaction'),
125
127
  (0, type_graphql_1.Mutation)(returns => product_combination_setting_1.ProductCombinationSetting, { description: 'To create new ProductCombinationSetting' }),
@@ -178,10 +180,9 @@ tslib_1.__decorate([
178
180
  tslib_1.__metadata("design:paramtypes", [String, Array, Object]),
179
181
  tslib_1.__metadata("design:returntype", Promise)
180
182
  ], ProductCombinationSettingMutation.prototype, "linkProductCombination", null);
181
- ProductCombinationSettingMutation = tslib_1.__decorate([
183
+ exports.ProductCombinationSettingMutation = ProductCombinationSettingMutation = tslib_1.__decorate([
182
184
  (0, type_graphql_1.Resolver)(product_combination_setting_1.ProductCombinationSetting)
183
185
  ], ProductCombinationSettingMutation);
184
- exports.ProductCombinationSettingMutation = ProductCombinationSettingMutation;
185
186
  async function updateMultipleProductCombinationSetting(patches, context) {
186
187
  const { domain, user, tx } = context.state;
187
188
  let results = [];
@@ -205,5 +206,4 @@ async function updateMultipleProductCombinationSetting(patches, context) {
205
206
  }
206
207
  return results;
207
208
  }
208
- exports.updateMultipleProductCombinationSetting = updateMultipleProductCombinationSetting;
209
209
  //# sourceMappingURL=product-combination-setting-mutation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"product-combination-setting-mutation.js","sourceRoot":"","sources":["../../../server/service/product-combination-setting/product-combination-setting-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AACtE,qCAAgD;AAEhD,+EAAyE;AACzE,yFAAiH;AAEjH,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,uDAAuD,CAAC,CAAA;AAGhF,IAAM,iCAAiC,GAAvC,MAAM,iCAAiC;IAGtC,AAAN,KAAK,CAAC,+BAA+B,CACD,yBAAuD,EAClF,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,OAAO,MAAM,EAAE,CAAC,aAAa,CAAC,uDAAyB,CAAC,CAAC,IAAI,iCACvD,yBAAiC,KACrC,MAAM,EACN,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,IAAI,IACb,CAAA;IACJ,CAAC;IAIK,AAAN,KAAK,CAAC,+BAA+B,CACxB,EAAU,EACP,KAAqC,EAC5C,OAAwB;QAE/B,MA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c,CAAC,CAAC,CAAC,CAAA;YACnC,MAAM,yBAAyB,GAAG,MAAM,6BAA6B,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC,CAAA;YAErG,MAAM,MAAM,GAAG,MAAM,6BAA6B,CAAC,IAAI,+CAClD,yBAAyB,GACzB,SAAS,KACZ,OAAO,EAAE,IAAI,IACb,CAAA;YAEF,OAAO,CAAC,IAAI,iCAAM,MAAM,KAAE,MAAM,EAAE,GAAG,IAAG,CAAA;SACzC;KACF;IAED,OAAO,OAAO,CAAA;AAChB,CAAC;AAvCD,0FAuCC","sourcesContent":["import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'\nimport { In, SelectQueryBuilder } from 'typeorm'\n\nimport { ProductCombinationSetting } from './product-combination-setting'\nimport { NewProductCombinationSetting, ProductCombinationSettingPatch } from './product-combination-setting-type'\n\nconst debug = require('debug')('things-factory:product-base:productCombinationSetting')\n\n@Resolver(ProductCombinationSetting)\nexport class ProductCombinationSettingMutation {\n @Directive('@transaction')\n @Mutation(returns => ProductCombinationSetting, { description: 'To create new ProductCombinationSetting' })\n async createProductCombinationSetting(\n @Arg('productCombinationSetting') productCombinationSetting: NewProductCombinationSetting,\n @Ctx() context: ResolverContext\n ): Promise<ProductCombinationSetting> {\n const { domain, user, tx } = context.state\n\n return await tx.getRepository(ProductCombinationSetting).save({\n ...(productCombinationSetting as any),\n domain,\n creator: user,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => ProductCombinationSetting, { description: 'To modify ProductCombinationSetting information' })\n async updateProductCombinationSetting(\n @Arg('id') id: string,\n @Arg('patch') patch: ProductCombinationSettingPatch,\n @Ctx() context: ResolverContext\n ): Promise<ProductCombinationSetting> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(ProductCombinationSetting)\n const productCombinationSetting = await repository.findOne({\n where: { id }\n })\n\n return await repository.save({\n ...productCombinationSetting,\n ...patch,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => [ProductCombinationSetting], {\n description: \"To modify multiple ProductCombinationSettings' information\"\n })\n async updateMultipleProductCombinationSetting(\n @Arg('patches', type => [ProductCombinationSettingPatch]) patches: ProductCombinationSettingPatch[],\n @Ctx() context: ResolverContext\n ): Promise<ProductCombinationSetting[]> {\n const { domain, user, tx } = context.state\n\n let results = []\n const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')\n const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')\n const productCombinationSettingRepo = tx.getRepository(ProductCombinationSetting)\n\n if (_createRecords.length > 0) {\n for (let i = 0; i < _createRecords.length; i++) {\n const newRecord = _createRecords[i]\n\n const result = await productCombinationSettingRepo.save({\n ...newRecord,\n domain,\n creator: user,\n updater: user\n })\n\n results.push({ ...result, cuFlag: '+' })\n }\n }\n\n if (_updateRecords.length > 0) {\n for (let i = 0; i < _updateRecords.length; i++) {\n const newRecord = _updateRecords[i]\n const productCombinationSetting = await productCombinationSettingRepo.findOneBy({ id: newRecord.id })\n\n const result = await productCombinationSettingRepo.save({\n ...productCombinationSetting,\n ...newRecord,\n updater: user\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete ProductCombinationSetting' })\n async deleteProductCombinationSetting(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(ProductCombinationSetting).delete({ id })\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple productCombinationSettings' })\n async deleteProductCombinationSettings(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(ProductCombinationSetting).delete({\n id: In(ids)\n })\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To link product combination for kitting process' })\n async linkProductCombination(\n @Arg('productCombinationId', type => String) productCombinationId: string,\n @Arg('patches', type => [ProductCombinationSettingPatch]) patches: ProductCombinationSettingPatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n try {\n const { domain, tx } = context.state\n\n const qb: SelectQueryBuilder<ProductCombinationSetting> = tx\n .getRepository(ProductCombinationSetting)\n .createQueryBuilder('pbs')\n .innerJoinAndSelect('pbs.product', 'prd')\n .innerJoinAndSelect('pbs.productDetail', 'pd')\n .innerJoinAndSelect('pbs.productCombination', 'pc')\n .where('pc.id = :productCombinationId', { productCombinationId })\n .andWhere('pc.domain_id = :domainId', { domainId: domain.id })\n\n const existingCombinationLink = await qb.getMany()\n\n let newCombinationLink: ProductCombinationSetting[] = patches.reduce((acc, curr) => {\n if (\n !existingCombinationLink.find(\n item => item.product.id === curr.product.id && item.productDetail.id === curr.productDetail.id\n )\n ) {\n acc.push({\n productCombination: { id: productCombinationId },\n product: { id: curr.product.id },\n productDetail: { id: curr.productDetail.id },\n qty: curr.qty,\n cuFlag: '+'\n })\n }\n // check if there is existing bundle link but changes in bundle qty\n else if (\n existingCombinationLink.find(\n item =>\n item.product.id === curr.product.id &&\n item.productDetail.id === curr.productDetail.id &&\n item.qty !== curr.qty\n )\n ) {\n acc.push({\n id: curr.id,\n productCombination: { id: productCombinationId },\n product: { id: curr.product.id },\n productDetail: { id: curr.productDetail.id },\n qty: curr.qty,\n cuFlag: 'M'\n })\n }\n return acc\n }, [])\n\n let removeCombinationLink: ProductCombinationSetting[] = existingCombinationLink.reduce((acc, curr) => {\n if (\n !patches.find(item => item.product.id == curr.product.id && item.productDetail.id == curr.productDetail.id)\n ) {\n acc.push({\n id: curr.id,\n productCombination: { id: productCombinationId },\n product: { id: curr.product.id },\n productDetail: { id: curr.productDetail.id },\n qty: curr.qty\n })\n }\n return acc\n }, [])\n\n if (newCombinationLink.length > 0) {\n await updateMultipleProductCombinationSetting(newCombinationLink, context)\n }\n\n if (removeCombinationLink.length > 0) {\n await tx.getRepository(ProductCombinationSetting).delete({\n id: In(removeCombinationLink.map(combinationLink => combinationLink.id))\n })\n }\n\n return true\n } catch (error) {\n debug('link-product-combination', error)\n throw error\n }\n }\n}\n\nexport async function updateMultipleProductCombinationSetting(patches: any, context: ResolverContext) {\n const { domain, user, tx } = context.state\n\n let results = []\n const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')\n const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')\n const productCombinationSettingRepo = tx.getRepository(ProductCombinationSetting)\n\n if (_createRecords.length > 0) {\n for (let i = 0; i < _createRecords.length; i++) {\n const newRecord = _createRecords[i]\n\n const result = await productCombinationSettingRepo.save({\n ...newRecord,\n domain,\n creator: user,\n updater: user\n })\n\n results.push({ ...result, cuFlag: '+' })\n }\n }\n\n if (_updateRecords.length > 0) {\n for (let i = 0; i < _updateRecords.length; i++) {\n const newRecord = _updateRecords[i]\n const productCombinationSetting = await productCombinationSettingRepo.findOneBy({ id: newRecord.id })\n\n const result = await productCombinationSettingRepo.save({\n ...productCombinationSetting,\n ...newRecord,\n updater: user\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n}\n"]}
1
+ {"version":3,"file":"product-combination-setting-mutation.js","sourceRoot":"","sources":["../../../server/service/product-combination-setting/product-combination-setting-mutation.ts"],"names":[],"mappings":";;;AAgNA,0FAuCC;;AAvPD,+CAAsE;AACtE,qCAAgD;AAEhD,+EAAyE;AACzE,yFAAiH;AAEjH,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,uDAAuD,CAAC,CAAA;AAGhF,IAAM,iCAAiC,GAAvC,MAAM,iCAAiC;IAGtC,AAAN,KAAK,CAAC,+BAA+B,CACD,yBAAuD,EAClF,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAE1C,OAAO,MAAM,EAAE,CAAC,aAAa,C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A6B,CAAC,IAAI,iCAClD,SAAS,KACZ,MAAM,EACN,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,IAAI,IACb,CAAA;YAEF,OAAO,CAAC,IAAI,iCAAM,MAAM,KAAE,MAAM,EAAE,GAAG,IAAG,CAAA;QAC1C,CAAC;IACH,CAAC;IAED,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC9B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC/C,MAAM,SAAS,GAAG,cAAc,CAAC,CAAC,CAAC,CAAA;YACnC,MAAM,yBAAyB,GAAG,MAAM,6BAA6B,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC,CAAA;YAErG,MAAM,MAAM,GAAG,MAAM,6BAA6B,CAAC,IAAI,+CAClD,yBAAyB,GACzB,SAAS,KACZ,OAAO,EAAE,IAAI,IACb,CAAA;YAEF,OAAO,CAAC,IAAI,iCAAM,MAAM,KAAE,MAAM,EAAE,GAAG,IAAG,CAAA;QAC1C,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAA;AAChB,CAAC","sourcesContent":["import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'\nimport { In, SelectQueryBuilder } from 'typeorm'\n\nimport { ProductCombinationSetting } from './product-combination-setting'\nimport { NewProductCombinationSetting, ProductCombinationSettingPatch } from './product-combination-setting-type'\n\nconst debug = require('debug')('things-factory:product-base:productCombinationSetting')\n\n@Resolver(ProductCombinationSetting)\nexport class ProductCombinationSettingMutation {\n @Directive('@transaction')\n @Mutation(returns => ProductCombinationSetting, { description: 'To create new ProductCombinationSetting' })\n async createProductCombinationSetting(\n @Arg('productCombinationSetting') productCombinationSetting: NewProductCombinationSetting,\n @Ctx() context: ResolverContext\n ): Promise<ProductCombinationSetting> {\n const { domain, user, tx } = context.state\n\n return await tx.getRepository(ProductCombinationSetting).save({\n ...(productCombinationSetting as any),\n domain,\n creator: user,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => ProductCombinationSetting, { description: 'To modify ProductCombinationSetting information' })\n async updateProductCombinationSetting(\n @Arg('id') id: string,\n @Arg('patch') patch: ProductCombinationSettingPatch,\n @Ctx() context: ResolverContext\n ): Promise<ProductCombinationSetting> {\n const { domain, user, tx } = context.state\n\n const repository = tx.getRepository(ProductCombinationSetting)\n const productCombinationSetting = await repository.findOne({\n where: { id }\n })\n\n return await repository.save({\n ...productCombinationSetting,\n ...patch,\n updater: user\n })\n }\n\n @Directive('@transaction')\n @Mutation(returns => [ProductCombinationSetting], {\n description: \"To modify multiple ProductCombinationSettings' information\"\n })\n async updateMultipleProductCombinationSetting(\n @Arg('patches', type => [ProductCombinationSettingPatch]) patches: ProductCombinationSettingPatch[],\n @Ctx() context: ResolverContext\n ): Promise<ProductCombinationSetting[]> {\n const { domain, user, tx } = context.state\n\n let results = []\n const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')\n const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')\n const productCombinationSettingRepo = tx.getRepository(ProductCombinationSetting)\n\n if (_createRecords.length > 0) {\n for (let i = 0; i < _createRecords.length; i++) {\n const newRecord = _createRecords[i]\n\n const result = await productCombinationSettingRepo.save({\n ...newRecord,\n domain,\n creator: user,\n updater: user\n })\n\n results.push({ ...result, cuFlag: '+' })\n }\n }\n\n if (_updateRecords.length > 0) {\n for (let i = 0; i < _updateRecords.length; i++) {\n const newRecord = _updateRecords[i]\n const productCombinationSetting = await productCombinationSettingRepo.findOneBy({ id: newRecord.id })\n\n const result = await productCombinationSettingRepo.save({\n ...productCombinationSetting,\n ...newRecord,\n updater: user\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete ProductCombinationSetting' })\n async deleteProductCombinationSetting(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(ProductCombinationSetting).delete({ id })\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To delete multiple productCombinationSettings' })\n async deleteProductCombinationSettings(\n @Arg('ids', type => [String]) ids: string[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n const { domain, tx } = context.state\n\n await tx.getRepository(ProductCombinationSetting).delete({\n id: In(ids)\n })\n\n return true\n }\n\n @Directive('@transaction')\n @Mutation(returns => Boolean, { description: 'To link product combination for kitting process' })\n async linkProductCombination(\n @Arg('productCombinationId', type => String) productCombinationId: string,\n @Arg('patches', type => [ProductCombinationSettingPatch]) patches: ProductCombinationSettingPatch[],\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n try {\n const { domain, tx } = context.state\n\n const qb: SelectQueryBuilder<ProductCombinationSetting> = tx\n .getRepository(ProductCombinationSetting)\n .createQueryBuilder('pbs')\n .innerJoinAndSelect('pbs.product', 'prd')\n .innerJoinAndSelect('pbs.productDetail', 'pd')\n .innerJoinAndSelect('pbs.productCombination', 'pc')\n .where('pc.id = :productCombinationId', { productCombinationId })\n .andWhere('pc.domain_id = :domainId', { domainId: domain.id })\n\n const existingCombinationLink = await qb.getMany()\n\n let newCombinationLink: ProductCombinationSetting[] = patches.reduce((acc, curr) => {\n if (\n !existingCombinationLink.find(\n item => item.product.id === curr.product.id && item.productDetail.id === curr.productDetail.id\n )\n ) {\n acc.push({\n productCombination: { id: productCombinationId },\n product: { id: curr.product.id },\n productDetail: { id: curr.productDetail.id },\n qty: curr.qty,\n cuFlag: '+'\n })\n }\n // check if there is existing bundle link but changes in bundle qty\n else if (\n existingCombinationLink.find(\n item =>\n item.product.id === curr.product.id &&\n item.productDetail.id === curr.productDetail.id &&\n item.qty !== curr.qty\n )\n ) {\n acc.push({\n id: curr.id,\n productCombination: { id: productCombinationId },\n product: { id: curr.product.id },\n productDetail: { id: curr.productDetail.id },\n qty: curr.qty,\n cuFlag: 'M'\n })\n }\n return acc\n }, [])\n\n let removeCombinationLink: ProductCombinationSetting[] = existingCombinationLink.reduce((acc, curr) => {\n if (\n !patches.find(item => item.product.id == curr.product.id && item.productDetail.id == curr.productDetail.id)\n ) {\n acc.push({\n id: curr.id,\n productCombination: { id: productCombinationId },\n product: { id: curr.product.id },\n productDetail: { id: curr.productDetail.id },\n qty: curr.qty\n })\n }\n return acc\n }, [])\n\n if (newCombinationLink.length > 0) {\n await updateMultipleProductCombinationSetting(newCombinationLink, context)\n }\n\n if (removeCombinationLink.length > 0) {\n await tx.getRepository(ProductCombinationSetting).delete({\n id: In(removeCombinationLink.map(combinationLink => combinationLink.id))\n })\n }\n\n return true\n } catch (error) {\n debug('link-product-combination', error)\n throw error\n }\n }\n}\n\nexport async function updateMultipleProductCombinationSetting(patches: any, context: ResolverContext) {\n const { domain, user, tx } = context.state\n\n let results = []\n const _createRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === '+')\n const _updateRecords = patches.filter((patch: any) => patch.cuFlag.toUpperCase() === 'M')\n const productCombinationSettingRepo = tx.getRepository(ProductCombinationSetting)\n\n if (_createRecords.length > 0) {\n for (let i = 0; i < _createRecords.length; i++) {\n const newRecord = _createRecords[i]\n\n const result = await productCombinationSettingRepo.save({\n ...newRecord,\n domain,\n creator: user,\n updater: user\n })\n\n results.push({ ...result, cuFlag: '+' })\n }\n }\n\n if (_updateRecords.length > 0) {\n for (let i = 0; i < _updateRecords.length; i++) {\n const newRecord = _updateRecords[i]\n const productCombinationSetting = await productCombinationSettingRepo.findOneBy({ id: newRecord.id })\n\n const result = await productCombinationSettingRepo.save({\n ...productCombinationSetting,\n ...newRecord,\n updater: user\n })\n\n results.push({ ...result, cuFlag: 'M' })\n }\n }\n\n return results\n}\n"]}
@@ -0,0 +1,14 @@
1
+ import { ListParam } from '@things-factory/shell';
2
+ import { ProductCombination } from '../product-combination/product-combination';
3
+ import { ProductDetail } from '../product-detail/product-detail';
4
+ import { Product } from '../product/product';
5
+ import { ProductCombinationSetting } from './product-combination-setting';
6
+ import { ProductCombinationSettingList } from './product-combination-setting-type';
7
+ export declare class ProductCombinationSettingQuery {
8
+ productCombinationSetting(productCombinationId: string, context: ResolverContext): Promise<ProductCombinationSetting[]>;
9
+ productCombinationSettings(params: ListParam, context: ResolverContext): Promise<ProductCombinationSettingList>;
10
+ productCombinationSets(params: ListParam, context: ResolverContext): Promise<ProductCombinationSettingList>;
11
+ product(productCombinationSetting: ProductCombinationSetting): Promise<Product>;
12
+ productDetail(productCombinationSetting: ProductCombinationSetting): Promise<ProductDetail>;
13
+ productCombination(productCombinationSetting: ProductCombinationSetting): Promise<ProductCombination>;
14
+ }
@@ -117,6 +117,7 @@ let ProductCombinationSettingQuery = class ProductCombinationSettingQuery {
117
117
  return await (0, shell_1.getRepository)(product_combination_1.ProductCombination).findOneBy({ id: productCombinationSetting.productCombinationId });
118
118
  }
119
119
  };
120
+ exports.ProductCombinationSettingQuery = ProductCombinationSettingQuery;
120
121
  tslib_1.__decorate([
121
122
  (0, type_graphql_1.Query)(returns => product_combination_setting_1.ProductCombinationSetting, { description: 'To fetch a ProductCombinationSetting' }),
122
123
  tslib_1.__param(0, (0, type_graphql_1.Arg)('productCombinationId')),
@@ -162,8 +163,7 @@ tslib_1.__decorate([
162
163
  tslib_1.__metadata("design:paramtypes", [product_combination_setting_1.ProductCombinationSetting]),
163
164
  tslib_1.__metadata("design:returntype", Promise)
164
165
  ], ProductCombinationSettingQuery.prototype, "productCombination", null);
165
- ProductCombinationSettingQuery = tslib_1.__decorate([
166
+ exports.ProductCombinationSettingQuery = ProductCombinationSettingQuery = tslib_1.__decorate([
166
167
  (0, type_graphql_1.Resolver)(product_combination_setting_1.ProductCombinationSetting)
167
168
  ], ProductCombinationSettingQuery);
168
- exports.ProductCombinationSettingQuery = ProductCombinationSettingQuery;
169
169
  //# sourceMappingURL=product-combination-setting-query.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"product-combination-setting-query.js","sourceRoot":"","sources":["../../../server/service/product-combination-setting/product-combination-setting-query.ts"],"names":[],"mappings":";;;;AAAA,+CAAmF;AACnF,qCAAsD;AAEtD,uDAAmD;AACnD,iDAAuH;AAEvH,oFAA+E;AAC/E,qEAAgE;AAChE,gDAA4C;AAC5C,+EAAyE;AACzE,yFAAkF;AAG3E,IAAM,8BAA8B,GAApC,MAAM,8BAA8B;IAEnC,AAAN,KAAK,CAAC,yBAAyB,CACA,oBAA4B,EAClD,OAAwB;QAE/B,MAAM,kBAAkB,GAAuB,MAAM,IAAA,qBAAa,EAAC,wCAAkB,CAAC,CAAC,OAAO,CAAC;YAC7F,KAAK,EAAE,EAAE,EAAE,EAAE,oBAAoB,EAAE;YACnC,SAAS,EAAE,CAAC,2BAA2B,CAAC;SACzC,CAAC,CAAA;QAEF,MAAM,0BAA0B,GAAgC,kBAAkB,CAAC,0BAA0B,CAAA;QAE7G,OAAO,0BAA0B,CAAA;IACnC,CAAC;IAGK,AAAN,KAAK,CAAC,0BAA0B,CACtB,MAAiB,EAClB,OAAwB;QAE/B,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAEhC,MAAM,eAAe,GAAG,IAAA,yBAAiB,EAAC,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,CAAA;QAC7D,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,MAAM,IAAA,qBAAa,EAAC,uDAAyB,CAAC,CAAC,YAAY,CAAC,eAAe,CAAC,CAAA;QAEnG,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAA;IACzB,CAAC;IAGK,AAAN,KAAK,CAAC,sBAAsB,CAClB,MAAiB,EAClB,OAAwB;;QAE/B,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAChC,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAA;QACnC,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,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Resolver, Query, Resolver, Root } from 'type-graphql'\nimport { Brackets, SelectQueryBuilder } from 'typeorm'\n\nimport { Bizplace } from '@things-factory/biz-base'\nimport { buildCondition, buildQuery, convertListParams, Domain, getRepository, ListParam } from '@things-factory/shell'\n\nimport { ProductCombination } from '../product-combination/product-combination'\nimport { ProductDetail } from '../product-detail/product-detail'\nimport { Product } from '../product/product'\nimport { ProductCombinationSetting } from './product-combination-setting'\nimport { ProductCombinationSettingList } from './product-combination-setting-type'\n\n@Resolver(ProductCombinationSetting)\nexport class ProductCombinationSettingQuery {\n @Query(returns => ProductCombinationSetting, { description: 'To fetch a ProductCombinationSetting' })\n async productCombinationSetting(\n @Arg('productCombinationId') productCombinationId: string,\n @Ctx() context: ResolverContext\n ): Promise<ProductCombinationSetting[]> {\n const productCombination: ProductCombination = await getRepository(ProductCombination).findOne({\n where: { id: productCombinationId },\n relations: ['productCombinationSetting']\n })\n\n const productCombinationSettings: ProductCombinationSetting[] = productCombination.productCombinationSettings\n\n return productCombinationSettings\n }\n\n @Query(returns => ProductCombinationSettingList, { description: 'To fetch multiple ProductCombinationSettings' })\n async productCombinationSettings(\n @Args() params: ListParam,\n @Ctx() context: ResolverContext\n ): Promise<ProductCombinationSettingList> {\n const { domain } = context.state\n\n const convertedParams = convertListParams(params, { domain })\n const [items, total] = await getRepository(ProductCombinationSetting).findAndCount(convertedParams)\n\n return { items, total }\n }\n\n @Query(returns => ProductCombinationSettingList, { description: 'To fetch a set of product combinations' })\n async productCombinationSets(\n @Args() params: ListParam,\n @Ctx() context: ResolverContext\n ): Promise<ProductCombinationSettingList> {\n const { domain } = context.state\n const page = params.pagination.page\n const limit = params.pagination.limit\n\n const filters = params.filters.filter(\n x => x.name !== 'product_info' && x.name !== 'productCombinationId' && x.name !== 'bizplace_id'\n )\n const bizplaceFilter = params.filters.find(x => x.name == 'bizplace_id')\n const productCombinationId = params.filters.find(x => x.name === 'productCombinationId')\n const productInfoFilter = params.filters.find(x => x.name === 'product_info')\n const productInfoColumns = ['sku', 'name', 'description']\n params.filters = [...filters]\n\n params.sortings = [\n { name: 'prd.sku' },\n { name: 'prdDet.gtin' },\n ...params.sortings.map(sorting => {\n const name = sorting.name.replace('product', '').toLowerCase()\n return {\n ...sorting,\n name\n }\n })\n ]\n\n if (bizplaceFilter?.value) {\n const bizplaceId: string = bizplaceFilter.value\n\n const foundBizplace: Bizplace = await getRepository(Bizplace).findOne({\n where: { id: bizplaceId } /* CONFIRMME regarding TYPEORM - migrated correctly ? */,\n relations: ['company', 'company.domain']\n })\n\n if (foundBizplace) {\n const companyDomain: Domain = foundBizplace.company?.domain\n const companyBizplace: Bizplace = await getRepository(Bizplace).findOne({\n where: { domain: { id: companyDomain.id } }\n })\n\n const bizplaceIds = [companyBizplace.id, foundBizplace.id]\n params.filters = [...filters, { name: 'bizplace_id', operator: 'in', value: [...new Set(bizplaceIds)] }]\n }\n } else {\n let bizplace: Bizplace = await getRepository(Bizplace).findOne({ where: { domain: { id: domain.id } } })\n params.filters = [...filters, { name: 'bizplace_id', operator: 'in', value: [bizplace.id] }]\n }\n\n const qb: SelectQueryBuilder<Product> = getRepository(Product).createQueryBuilder('prd')\n buildQuery(qb, params, context, {\n domainRef: false\n })\n\n qb.innerJoinAndSelect('product_details', 'prdDet', 'prdDet.product_id = prd.id')\n qb.leftJoinAndSelect(\n 'product_combination_settings',\n 'pcs',\n `pcs.product_id = prd.id and pcs.product_detail_id = prdDet.id ${\n productCombinationId && productCombinationId.operator === 'noteq' ? 'and pcs.product_detail_id = null' : ''\n }`\n )\n qb.leftJoinAndSelect('pcs.productCombination', 'pc')\n\n if (productInfoFilter) {\n qb.andWhere(\n new Brackets(qb2 => {\n productInfoColumns.forEach(filter => {\n const condition = buildCondition(\n qb.alias,\n filter,\n productInfoFilter.operator,\n productInfoFilter.value,\n productInfoFilter.relation,\n Object.keys(qb.getParameters()).length\n )\n\n qb2.orWhere(condition.clause, condition.parameters)\n })\n })\n )\n }\n\n if (productCombinationId && productCombinationId.operator === 'eq') {\n qb.andWhere('pc.id = :combinationId::uuid', {\n combinationId: productCombinationId.value\n })\n }\n\n let productCombinationSets = await qb\n .offset((page - 1) * limit)\n .limit(limit)\n .getRawMany()\n\n const items = productCombinationSets.map(item => {\n return {\n id: item.pcs_id,\n productDetailId: item.prdDet_id,\n gtin: item.prdDet_gtin,\n packingType: item.prdDet_packing_type,\n packingSize: item.prdDet_packing_size,\n productId: item.prd_id,\n productSku: item.prd_sku,\n productName: item.prd_name,\n productDescription: item.prd_description,\n productType: item.prd_type,\n combinationId: item.pc_id,\n qty: item.pcs_qty\n }\n })\n\n const total = await qb.getCount()\n\n return { items, total }\n }\n\n @FieldResolver(type => Product)\n async product(@Root() productCombinationSetting: ProductCombinationSetting): Promise<Product> {\n return await getRepository(Product).findOneBy({ id: productCombinationSetting.productId })\n }\n\n @FieldResolver(type => ProductDetail)\n async productDetail(@Root() productCombinationSetting: ProductCombinationSetting): Promise<ProductDetail> {\n return await getRepository(ProductDetail).findOneBy({ id: productCombinationSetting.productDetailId })\n }\n\n @FieldResolver(type => ProductCombination)\n async productCombination(@Root() productCombinationSetting: ProductCombinationSetting): Promise<ProductCombination> {\n return await getRepository(ProductCombination).findOneBy({ id: productCombinationSetting.productCombinationId })\n }\n}\n"]}
1
+ {"version":3,"file":"product-combination-setting-query.js","sourceRoot":"","sources":["../../../server/service/product-combination-setting/product-combination-setting-query.ts"],"names":[],"mappings":";;;;AAAA,+CAAmF;AACnF,qCAAsD;AAEtD,uDAAmD;AACnD,iDAAuH;AAEvH,oFAA+E;AAC/E,qEAAgE;AAChE,gDAA4C;AAC5C,+EAAyE;AACzE,yFAAkF;AAG3E,IAAM,8BAA8B,GAApC,MAAM,8BAA8B;IAEnC,AAAN,KAAK,CAAC,yBAAyB,CACA,oBAA4B,EAClD,OAAwB;QAE/B,MAAM,kBAAkB,GAAuB,MAAM,IAAA,qBAAa,EAAC,wCAAkB,CAAC,CAAC,OAAO,CAAC;YAC7F,KAAK,EAAE,EAAE,EA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AAE,WAAW,EAAE,8CAA8C,EAAE,CAAC;IAE9G,mBAAA,IAAA,mBAAI,GAAE,CAAA;IACN,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CADU,iBAAS;;gFAS1B;AAGK;IADL,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,gEAA6B,EAAE,EAAE,WAAW,EAAE,wCAAwC,EAAE,CAAC;IAExG,mBAAA,IAAA,mBAAI,GAAE,CAAA;IACN,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CADU,iBAAS;;4EAmH1B;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAO,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAA4B,uDAAyB;;6DAEzE;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,8BAAa,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAA4B,uDAAyB;;mEAE/E;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,wCAAkB,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAA4B,uDAAyB;;wEAEpF;yCAjKU,8BAA8B;IAD1C,IAAA,uBAAQ,EAAC,uDAAyB,CAAC;GACvB,8BAA8B,CAkK1C","sourcesContent":["import { Arg, Args, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graphql'\nimport { Brackets, SelectQueryBuilder } from 'typeorm'\n\nimport { Bizplace } from '@things-factory/biz-base'\nimport { buildCondition, buildQuery, convertListParams, Domain, getRepository, ListParam } from '@things-factory/shell'\n\nimport { ProductCombination } from '../product-combination/product-combination'\nimport { ProductDetail } from '../product-detail/product-detail'\nimport { Product } from '../product/product'\nimport { ProductCombinationSetting } from './product-combination-setting'\nimport { ProductCombinationSettingList } from './product-combination-setting-type'\n\n@Resolver(ProductCombinationSetting)\nexport class ProductCombinationSettingQuery {\n @Query(returns => ProductCombinationSetting, { description: 'To fetch a ProductCombinationSetting' })\n async productCombinationSetting(\n @Arg('productCombinationId') productCombinationId: string,\n @Ctx() context: ResolverContext\n ): Promise<ProductCombinationSetting[]> {\n const productCombination: ProductCombination = await getRepository(ProductCombination).findOne({\n where: { id: productCombinationId },\n relations: ['productCombinationSetting']\n })\n\n const productCombinationSettings: ProductCombinationSetting[] = productCombination.productCombinationSettings\n\n return productCombinationSettings\n }\n\n @Query(returns => ProductCombinationSettingList, { description: 'To fetch multiple ProductCombinationSettings' })\n async productCombinationSettings(\n @Args() params: ListParam,\n @Ctx() context: ResolverContext\n ): Promise<ProductCombinationSettingList> {\n const { domain } = context.state\n\n const convertedParams = convertListParams(params, { domain })\n const [items, total] = await getRepository(ProductCombinationSetting).findAndCount(convertedParams)\n\n return { items, total }\n }\n\n @Query(returns => ProductCombinationSettingList, { description: 'To fetch a set of product combinations' })\n async productCombinationSets(\n @Args() params: ListParam,\n @Ctx() context: ResolverContext\n ): Promise<ProductCombinationSettingList> {\n const { domain } = context.state\n const page = params.pagination.page\n const limit = params.pagination.limit\n\n const filters = params.filters.filter(\n x => x.name !== 'product_info' && x.name !== 'productCombinationId' && x.name !== 'bizplace_id'\n )\n const bizplaceFilter = params.filters.find(x => x.name == 'bizplace_id')\n const productCombinationId = params.filters.find(x => x.name === 'productCombinationId')\n const productInfoFilter = params.filters.find(x => x.name === 'product_info')\n const productInfoColumns = ['sku', 'name', 'description']\n params.filters = [...filters]\n\n params.sortings = [\n { name: 'prd.sku' },\n { name: 'prdDet.gtin' },\n ...params.sortings.map(sorting => {\n const name = sorting.name.replace('product', '').toLowerCase()\n return {\n ...sorting,\n name\n }\n })\n ]\n\n if (bizplaceFilter?.value) {\n const bizplaceId: string = bizplaceFilter.value\n\n const foundBizplace: Bizplace = await getRepository(Bizplace).findOne({\n where: { id: bizplaceId } /* CONFIRMME regarding TYPEORM - migrated correctly ? */,\n relations: ['company', 'company.domain']\n })\n\n if (foundBizplace) {\n const companyDomain: Domain = foundBizplace.company?.domain\n const companyBizplace: Bizplace = await getRepository(Bizplace).findOne({\n where: { domain: { id: companyDomain.id } }\n })\n\n const bizplaceIds = [companyBizplace.id, foundBizplace.id]\n params.filters = [...filters, { name: 'bizplace_id', operator: 'in', value: [...new Set(bizplaceIds)] }]\n }\n } else {\n let bizplace: Bizplace = await getRepository(Bizplace).findOne({ where: { domain: { id: domain.id } } })\n params.filters = [...filters, { name: 'bizplace_id', operator: 'in', value: [bizplace.id] }]\n }\n\n const qb: SelectQueryBuilder<Product> = getRepository(Product).createQueryBuilder('prd')\n buildQuery(qb, params, context, {\n domainRef: false\n })\n\n qb.innerJoinAndSelect('product_details', 'prdDet', 'prdDet.product_id = prd.id')\n qb.leftJoinAndSelect(\n 'product_combination_settings',\n 'pcs',\n `pcs.product_id = prd.id and pcs.product_detail_id = prdDet.id ${\n productCombinationId && productCombinationId.operator === 'noteq' ? 'and pcs.product_detail_id = null' : ''\n }`\n )\n qb.leftJoinAndSelect('pcs.productCombination', 'pc')\n\n if (productInfoFilter) {\n qb.andWhere(\n new Brackets(qb2 => {\n productInfoColumns.forEach(filter => {\n const condition = buildCondition(\n qb.alias,\n filter,\n productInfoFilter.operator,\n productInfoFilter.value,\n productInfoFilter.relation,\n Object.keys(qb.getParameters()).length\n )\n\n qb2.orWhere(condition.clause, condition.parameters)\n })\n })\n )\n }\n\n if (productCombinationId && productCombinationId.operator === 'eq') {\n qb.andWhere('pc.id = :combinationId::uuid', {\n combinationId: productCombinationId.value\n })\n }\n\n let productCombinationSets = await qb\n .offset((page - 1) * limit)\n .limit(limit)\n .getRawMany()\n\n const items = productCombinationSets.map(item => {\n return {\n id: item.pcs_id,\n productDetailId: item.prdDet_id,\n gtin: item.prdDet_gtin,\n packingType: item.prdDet_packing_type,\n packingSize: item.prdDet_packing_size,\n productId: item.prd_id,\n productSku: item.prd_sku,\n productName: item.prd_name,\n productDescription: item.prd_description,\n productType: item.prd_type,\n combinationId: item.pc_id,\n qty: item.pcs_qty\n }\n })\n\n const total = await qb.getCount()\n\n return { items, total }\n }\n\n @FieldResolver(type => Product)\n async product(@Root() productCombinationSetting: ProductCombinationSetting): Promise<Product> {\n return await getRepository(Product).findOneBy({ id: productCombinationSetting.productId })\n }\n\n @FieldResolver(type => ProductDetail)\n async productDetail(@Root() productCombinationSetting: ProductCombinationSetting): Promise<ProductDetail> {\n return await getRepository(ProductDetail).findOneBy({ id: productCombinationSetting.productDetailId })\n }\n\n @FieldResolver(type => ProductCombination)\n async productCombination(@Root() productCombinationSetting: ProductCombinationSetting): Promise<ProductCombination> {\n return await getRepository(ProductCombination).findOneBy({ id: productCombinationSetting.productCombinationId })\n }\n}\n"]}
@@ -0,0 +1,18 @@
1
+ import { ObjectRef } from '@things-factory/shell';
2
+ import { ProductCombinationSetting } from './product-combination-setting';
3
+ export declare class NewProductCombinationSetting {
4
+ name: string;
5
+ description?: string;
6
+ }
7
+ export declare class ProductCombinationSettingPatch {
8
+ id?: string;
9
+ product?: ObjectRef;
10
+ productDetail?: ObjectRef;
11
+ productCombination?: ObjectRef;
12
+ qty: number;
13
+ cuFlag?: string;
14
+ }
15
+ export declare class ProductCombinationSettingList {
16
+ items: ProductCombinationSetting[];
17
+ total: number;
18
+ }