@things-factory/product-base 7.0.1-beta.14 → 7.0.1-beta.22

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 (29) hide show
  1. package/dist-server/service/product/product-query.js +8 -5
  2. package/dist-server/service/product/product-query.js.map +1 -1
  3. package/dist-server/service/product-bundle/product-bundle-query.js +2 -2
  4. package/dist-server/service/product-bundle/product-bundle-query.js.map +1 -1
  5. package/dist-server/service/product-bundle-setting/product-bundle-setting-query.js +2 -2
  6. package/dist-server/service/product-bundle-setting/product-bundle-setting-query.js.map +1 -1
  7. package/dist-server/service/product-combination/product-combination-query.js +1 -1
  8. package/dist-server/service/product-combination/product-combination-query.js.map +1 -1
  9. package/dist-server/service/product-combination/product-combination.js +2 -2
  10. package/dist-server/service/product-combination/product-combination.js.map +1 -1
  11. package/dist-server/service/product-combination-setting/product-combination-setting-query.js +2 -2
  12. package/dist-server/service/product-combination-setting/product-combination-setting-query.js.map +1 -1
  13. package/dist-server/service/product-detail-bizplace-setting/product-detail-bizplace-setting-query.js +1 -1
  14. package/dist-server/service/product-detail-bizplace-setting/product-detail-bizplace-setting-query.js.map +1 -1
  15. package/dist-server/service/product-set/product-set-mutation.d.ts +1 -19
  16. package/dist-server/service/product-set/product-set-mutation.js.map +1 -1
  17. package/dist-server/service/product-set/product-set-query.js +2 -2
  18. package/dist-server/service/product-set/product-set-query.js.map +1 -1
  19. package/dist-server/tsconfig.tsbuildinfo +1 -1
  20. package/package.json +5 -5
  21. package/server/service/product/product-query.ts +25 -6
  22. package/server/service/product-bundle/product-bundle-query.ts +5 -2
  23. package/server/service/product-bundle-setting/product-bundle-setting-query.ts +2 -2
  24. package/server/service/product-combination/product-combination-query.ts +1 -1
  25. package/server/service/product-combination/product-combination.ts +2 -2
  26. package/server/service/product-combination-setting/product-combination-setting-query.ts +2 -2
  27. package/server/service/product-detail-bizplace-setting/product-detail-bizplace-setting-query.ts +1 -1
  28. package/server/service/product-set/product-set-mutation.ts +5 -1
  29. package/server/service/product-set/product-set-query.ts +8 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/product-base",
3
- "version": "7.0.1-beta.14",
3
+ "version": "7.0.1-beta.22",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -24,9 +24,9 @@
24
24
  "migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
25
25
  },
26
26
  "dependencies": {
27
- "@things-factory/biz-base": "^7.0.1-beta.14",
28
- "@things-factory/env": "^7.0.1-beta.6",
29
- "@things-factory/routing-base": "^7.0.1-beta.14"
27
+ "@things-factory/biz-base": "^7.0.1-beta.22",
28
+ "@things-factory/env": "^7.0.1-beta.18",
29
+ "@things-factory/routing-base": "^7.0.1-beta.22"
30
30
  },
31
- "gitHead": "f98cf5cb94295657c43465d39cf55162f5566c59"
31
+ "gitHead": "60c6bc4d55359465636a549687fc3e3f03d44a18"
32
32
  }
@@ -3,7 +3,14 @@ import { Brackets, In, SelectQueryBuilder } from 'typeorm'
3
3
 
4
4
  import { Attachment } from '@things-factory/attachment-base'
5
5
  import { User } from '@things-factory/auth-base'
6
- import { Bizplace, getCompaniesBizplaces, getCompanyBizplace, getMyBizplace, getPartnersCompanyBizplaces, getPermittedBizplaceIds } from '@things-factory/biz-base'
6
+ import {
7
+ Bizplace,
8
+ getCompaniesBizplaces,
9
+ getCompanyBizplace,
10
+ getMyBizplace,
11
+ getPartnersCompanyBizplaces,
12
+ getPermittedBizplaceIds
13
+ } from '@things-factory/biz-base'
7
14
  import { logger } from '@things-factory/env'
8
15
  import { buildCondition, Domain, getQueryBuilderFromListParams, getRepository, ListParam } from '@things-factory/shell'
9
16
 
@@ -53,7 +60,7 @@ export class ProductQuery {
53
60
 
54
61
  @Directive('@privilege(category: "order", privilege: "query", domainOwnerGranted: true)')
55
62
  @Query(returns => ProductList)
56
- async products(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<ProductList> {
63
+ async products(@Args(type => ListParam) params: ListParam, @Ctx() context: ResolverContext): Promise<ProductList> {
57
64
  const { domain, user } = context.state
58
65
  const { domains }: { domains: Domain[] } = user as any /* TODO clarify this */
59
66
  let bizplaces: Bizplace[]
@@ -94,7 +101,10 @@ export class ProductQuery {
94
101
 
95
102
  @Directive('@privilege(category: "order", privilege: "query", domainOwnerGranted: true)')
96
103
  @Query(returns => ProductList)
97
- async myBizplaceProducts(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<ProductList> {
104
+ async myBizplaceProducts(
105
+ @Args(type => ListParam) params: ListParam,
106
+ @Ctx() context: ResolverContext
107
+ ): Promise<ProductList> {
98
108
  try {
99
109
  const { domain, user }: { domain: Domain; user: User } = context.state
100
110
  const bizplaceFilter = params.filters.find(filter => filter.name === 'bizplace_id')
@@ -106,7 +116,10 @@ export class ProductQuery {
106
116
 
107
117
  const qb: SelectQueryBuilder<Product> = buildCustomConditions(params, context, bizplaces)
108
118
 
109
- let [items, total] = await qb.leftJoinAndSelect('Product.productDetails', 'ProductDetails').leftJoinAndSelect('Product.routing', 'Routing').getManyAndCount()
119
+ let [items, total] = await qb
120
+ .leftJoinAndSelect('Product.productDetails', 'ProductDetails')
121
+ .leftJoinAndSelect('Product.routing', 'Routing')
122
+ .getManyAndCount()
110
123
 
111
124
  items = items.map(itm => {
112
125
  let defaultProductDetail = itm.productDetails.find(itm => itm.isDefault)
@@ -125,7 +138,10 @@ export class ProductQuery {
125
138
 
126
139
  @Directive('@privilege(category: "order", privilege: "query", domainOwnerGranted: true)')
127
140
  @Query(returns => ProductList)
128
- async productsByBizplace(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<ProductList> {
141
+ async productsByBizplace(
142
+ @Args(type => ListParam) params: ListParam,
143
+ @Ctx() context: ResolverContext
144
+ ): Promise<ProductList> {
129
145
  const { domain, user } = context.state
130
146
  const bizplaceFilter = params.filters.find(x => x.name == 'bizplace')
131
147
 
@@ -173,7 +189,10 @@ export class ProductQuery {
173
189
  * */
174
190
  @Directive('@privilege(category: "order", privilege: "query", domainOwnerGranted: true)')
175
191
  @Query(returns => ProductList)
176
- async pureProductsByBizplace(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<ProductList> {
192
+ async pureProductsByBizplace(
193
+ @Args(type => ListParam) params: ListParam,
194
+ @Ctx() context: ResolverContext
195
+ ): Promise<ProductList> {
177
196
  const { domain, user } = context.state
178
197
  const bizplaceFilter = params.filters.find(x => x.name == 'bizplace')
179
198
 
@@ -13,7 +13,7 @@ import { ProductBundleList } from './product-bundle-types'
13
13
  export class ProductBundleQuery {
14
14
  @Query(returns => ProductBundleList)
15
15
  async myBizplaceProductBundles(
16
- @Args() params: ListParam,
16
+ @Args(type => ListParam) params: ListParam,
17
17
  @Ctx() context: ResolverContext
18
18
  ): Promise<ProductBundleList> {
19
19
  const { domain } = context.state
@@ -65,7 +65,10 @@ export class ProductBundleQuery {
65
65
  }
66
66
 
67
67
  @Query(returns => ProductBundleList)
68
- async productBundles(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<ProductBundleList> {
68
+ async productBundles(
69
+ @Args(type => ListParam) params: ListParam,
70
+ @Ctx() context: ResolverContext
71
+ ): Promise<ProductBundleList> {
69
72
  const convertedParams = convertListParams(params)
70
73
  const [items, total] = await getRepository(ProductBundle).findAndCount({
71
74
  ...convertedParams
@@ -12,7 +12,7 @@ import { ProductBundleSettingList } from './product-bundle-setting-types'
12
12
  export class ProductBundleSettingQuery {
13
13
  @Query(returns => ProductBundleSettingList)
14
14
  async productBundleSettings(
15
- @Args() params: ListParam,
15
+ @Args(type => ListParam) params: ListParam,
16
16
  @Ctx() context: ResolverContext
17
17
  ): Promise<ProductBundleSettingList> {
18
18
  const convertedParams = convertListParams(params)
@@ -25,7 +25,7 @@ export class ProductBundleSettingQuery {
25
25
 
26
26
  @Query(returns => ProductBundleSettingList)
27
27
  async productBundleSets(
28
- @Args() params: ListParam,
28
+ @Args(type => ListParam) params: ListParam,
29
29
  @Ctx() context: ResolverContext
30
30
  ): Promise<ProductBundleSettingList> {
31
31
  const { domain } = context.state
@@ -19,7 +19,7 @@ export class ProductCombinationQuery {
19
19
 
20
20
  @Query(returns => ProductCombinationList, { description: 'To fetch multiple ProductCombinations' })
21
21
  async productCombinations(
22
- @Args() params: ListParam,
22
+ @Args(type => ListParam) params: ListParam,
23
23
  @Ctx() context: ResolverContext
24
24
  ): Promise<ProductCombinationList> {
25
25
  const convertedParams = convertListParams(params)
@@ -101,14 +101,14 @@ export class ProductCombination {
101
101
  updatedAt?: Date
102
102
 
103
103
  @ManyToOne(type => User, { nullable: true })
104
- @Field({ nullable: true })
104
+ @Field(type => User, { nullable: true })
105
105
  creator?: User
106
106
 
107
107
  @RelationId((productCombination: ProductCombination) => productCombination.creator)
108
108
  creatorId?: string
109
109
 
110
110
  @ManyToOne(type => User, { nullable: true })
111
- @Field({ nullable: true })
111
+ @Field(type => User, { nullable: true })
112
112
  updater?: User
113
113
 
114
114
  @RelationId((productCombination: ProductCombination) => productCombination.updater)
@@ -29,7 +29,7 @@ export class ProductCombinationSettingQuery {
29
29
 
30
30
  @Query(returns => ProductCombinationSettingList, { description: 'To fetch multiple ProductCombinationSettings' })
31
31
  async productCombinationSettings(
32
- @Args() params: ListParam,
32
+ @Args(type => ListParam) params: ListParam,
33
33
  @Ctx() context: ResolverContext
34
34
  ): Promise<ProductCombinationSettingList> {
35
35
  const { domain } = context.state
@@ -42,7 +42,7 @@ export class ProductCombinationSettingQuery {
42
42
 
43
43
  @Query(returns => ProductCombinationSettingList, { description: 'To fetch a set of product combinations' })
44
44
  async productCombinationSets(
45
- @Args() params: ListParam,
45
+ @Args(type => ListParam) params: ListParam,
46
46
  @Ctx() context: ResolverContext
47
47
  ): Promise<ProductCombinationSettingList> {
48
48
  const { domain } = context.state
@@ -24,7 +24,7 @@ export class ProductDetailBizplaceSettingQuery {
24
24
 
25
25
  @Query(returns => ProductDetailBizplaceSettingList)
26
26
  async productDetailBizplaceSettings(
27
- @Args() params: ListParam,
27
+ @Args(type => ListParam) params: ListParam,
28
28
  @Ctx() context: ResolverContext
29
29
  ): Promise<ProductDetailBizplaceSettingList> {
30
30
  const { domain, user: updater }: { domain: Domain; user: User } = context.state
@@ -130,7 +130,11 @@ export async function createProductSet(productSet: NewProductSet, context: Resol
130
130
  })
131
131
  }
132
132
 
133
- export async function updateProductSet(id: string, patch: ProductSetPatch, context: ResolverContext) {
133
+ export async function updateProductSet(
134
+ id: string,
135
+ patch: ProductSetPatch,
136
+ context: ResolverContext
137
+ ): Promise<ProductSet> {
134
138
  const { user, tx } = context.state
135
139
 
136
140
  const bizplaceRepo: Repository<Bizplace> = tx.getRepository(Bizplace)
@@ -12,7 +12,10 @@ import { ProductSetList } from './product-set-types'
12
12
  export class ProductSetQuery {
13
13
  @Directive('@privilege(category: "order", privilege: "query", domainOwnerGranted: true)')
14
14
  @Query(returns => ProductSetList)
15
- async myBizplaceProductSets(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<ProductSetList> {
15
+ async myBizplaceProductSets(
16
+ @Args(type => ListParam) params: ListParam,
17
+ @Ctx() context: ResolverContext
18
+ ): Promise<ProductSetList> {
16
19
  const { domain, user } = context.state
17
20
  const qb: SelectQueryBuilder<ProductSet> = getRepository(ProductSet).createQueryBuilder()
18
21
 
@@ -59,7 +62,10 @@ export class ProductSetQuery {
59
62
 
60
63
  @Directive('@privilege(category: "order", privilege: "query", domainOwnerGranted: true)')
61
64
  @Query(returns => ProductSetList)
62
- async productSets(@Args() params: ListParam, @Ctx() context: ResolverContext): Promise<ProductSetList> {
65
+ async productSets(
66
+ @Args(type => ListParam) params: ListParam,
67
+ @Ctx() context: ResolverContext
68
+ ): Promise<ProductSetList> {
63
69
  const { domain, user } = context.state
64
70
 
65
71
  if (!params.filters.find((filter: any) => filter.name === 'bizplace_id')) {