@things-factory/biz-base 5.0.7 → 5.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-server/index.js +4 -17
- package/dist-server/index.js.map +1 -1
- package/dist-server/middlewares/index.js.map +1 -1
- package/dist-server/migrations/index.js.map +1 -1
- package/dist-server/service/biz-option/biz-option-mutation.js +27 -38
- package/dist-server/service/biz-option/biz-option-mutation.js.map +1 -1
- package/dist-server/service/biz-option/biz-option-query.js +14 -25
- package/dist-server/service/biz-option/biz-option-query.js.map +1 -1
- package/dist-server/service/biz-option/biz-option-types.js +24 -32
- package/dist-server/service/biz-option/biz-option-types.js.map +1 -1
- package/dist-server/service/biz-option/biz-option.js +22 -30
- package/dist-server/service/biz-option/biz-option.js.map +1 -1
- package/dist-server/service/biz-option/index.js.map +1 -1
- package/dist-server/service/biz-option-detail/biz-option-detail-mutation.js +27 -38
- package/dist-server/service/biz-option-detail/biz-option-detail-mutation.js.map +1 -1
- package/dist-server/service/biz-option-detail/biz-option-detail-query.js +13 -24
- package/dist-server/service/biz-option-detail/biz-option-detail-query.js.map +1 -1
- package/dist-server/service/biz-option-detail/biz-option-detail-types.js +20 -28
- package/dist-server/service/biz-option-detail/biz-option-detail-types.js.map +1 -1
- package/dist-server/service/biz-option-detail/biz-option-detail.js +20 -28
- package/dist-server/service/biz-option-detail/biz-option-detail.js.map +1 -1
- package/dist-server/service/biz-option-detail/index.js.map +1 -1
- package/dist-server/service/bizplace/bizplace-mutation.js +38 -49
- package/dist-server/service/bizplace/bizplace-mutation.js.map +1 -1
- package/dist-server/service/bizplace/bizplace-query.js +65 -76
- package/dist-server/service/bizplace/bizplace-query.js.map +1 -1
- package/dist-server/service/bizplace/bizplace-types.js +53 -61
- package/dist-server/service/bizplace/bizplace-types.js.map +1 -1
- package/dist-server/service/bizplace/bizplace.js +33 -41
- package/dist-server/service/bizplace/bizplace.js.map +1 -1
- package/dist-server/service/bizplace/index.js.map +1 -1
- package/dist-server/service/company/company-mutation.js +32 -43
- package/dist-server/service/company/company-mutation.js.map +1 -1
- package/dist-server/service/company/company-query.js +23 -38
- package/dist-server/service/company/company-query.js.map +1 -1
- package/dist-server/service/company/company-types.js +42 -50
- package/dist-server/service/company/company-types.js.map +1 -1
- package/dist-server/service/company/company.js +38 -46
- package/dist-server/service/company/company.js.map +1 -1
- package/dist-server/service/company/index.js.map +1 -1
- package/dist-server/service/contact-point/contact-point-mutation.js +33 -44
- package/dist-server/service/contact-point/contact-point-mutation.js.map +1 -1
- package/dist-server/service/contact-point/contact-point-query.js +14 -25
- package/dist-server/service/contact-point/contact-point-query.js.map +1 -1
- package/dist-server/service/contact-point/contact-point-types.js +80 -88
- package/dist-server/service/contact-point/contact-point-types.js.map +1 -1
- package/dist-server/service/contact-point/contact-point.js +48 -56
- package/dist-server/service/contact-point/contact-point.js.map +1 -1
- package/dist-server/service/contact-point/index.js.map +1 -1
- package/dist-server/service/index.js +13 -26
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/service/worker/index.js.map +1 -1
- package/dist-server/service/worker/worker-mutation.js +32 -43
- package/dist-server/service/worker/worker-mutation.js.map +1 -1
- package/dist-server/service/worker/worker-query.js +14 -25
- package/dist-server/service/worker/worker-query.js.map +1 -1
- package/dist-server/service/worker/worker-types.js +28 -36
- package/dist-server/service/worker/worker-types.js.map +1 -1
- package/dist-server/service/worker/worker.js +22 -30
- package/dist-server/service/worker/worker.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -0
- package/dist-server/utils/get-permitted-bizplaces.js.map +1 -1
- package/dist-server/utils/index.js +2 -15
- package/dist-server/utils/index.js.map +1 -1
- package/package.json +3 -3
- package/server/service/bizplace/bizplace-query.ts +28 -27
- package/server/service/company/company-query.ts +0 -5
- package/server/service/contact-point/contact-point-mutation.ts +1 -1
- package/server/utils/get-permitted-bizplaces.ts +3 -3
|
@@ -9,10 +9,11 @@ import {
|
|
|
9
9
|
getPartnerBizplaceIds,
|
|
10
10
|
getPartnersBizplaces,
|
|
11
11
|
getPartnersCompanyBizplaces,
|
|
12
|
-
getPermittedBizplaceIds
|
|
12
|
+
getPermittedBizplaceIds,
|
|
13
|
+
getUserBizplaces
|
|
13
14
|
} from '../../utils'
|
|
14
15
|
import { Bizplace } from './bizplace'
|
|
15
|
-
import { BizplaceList
|
|
16
|
+
import { BizplaceList } from './bizplace-types'
|
|
16
17
|
|
|
17
18
|
@Resolver(Bizplace)
|
|
18
19
|
export class BizplaceQuery {
|
|
@@ -40,32 +41,32 @@ export class BizplaceQuery {
|
|
|
40
41
|
})
|
|
41
42
|
}
|
|
42
43
|
|
|
44
|
+
/* TODO make it work */
|
|
43
45
|
@Directive('@privilege(category: "bizplace", privilege: "query", domainOwnerGranted: true)')
|
|
44
|
-
@Query(returns => [
|
|
45
|
-
async userBizplaces(@Arg('email') email: string, @Ctx() context: any): Promise<
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
relations: ['bizplaces']
|
|
53
|
-
}
|
|
54
|
-
)
|
|
55
|
-
const bizplaces = await getRepository(Bizplace).find({ domain: context.state.domain })
|
|
56
|
-
const userBizplaces = user.bizplaces
|
|
57
|
-
return bizplaces.map((bizplace: Bizplace) => {
|
|
58
|
-
return {
|
|
59
|
-
id: bizplace.id,
|
|
60
|
-
name: bizplace.name,
|
|
61
|
-
description: bizplace.description,
|
|
62
|
-
userBizplaceId: userBizplaces
|
|
63
|
-
.map(userBiz => userBiz.bizplace.id)
|
|
64
|
-
.slice(0, 1)
|
|
65
|
-
.shift(),
|
|
66
|
-
assigned: userBizplaces.filter((userBizplace: Bizplace) => userBizplace.id === bizplace.id).length > 0
|
|
67
|
-
}
|
|
46
|
+
@Query(returns => [Bizplace])
|
|
47
|
+
async userBizplaces(@Arg('email') email: string, @Ctx() context: any): Promise<Bizplace[]> {
|
|
48
|
+
const { domain } = context.state
|
|
49
|
+
|
|
50
|
+
const user: User = await getRepository(User).findOne({
|
|
51
|
+
email: email != '' ? email : context.state.user.email
|
|
68
52
|
})
|
|
53
|
+
|
|
54
|
+
return await getUserBizplaces(user)
|
|
55
|
+
|
|
56
|
+
// const bizplaces = await getRepository(Bizplace).find({ domain })
|
|
57
|
+
// // const userBizplaces = user.bizplaces
|
|
58
|
+
// return bizplaces.map((bizplace: Bizplace) => {
|
|
59
|
+
// return {
|
|
60
|
+
// id: bizplace.id,
|
|
61
|
+
// name: bizplace.name,
|
|
62
|
+
// description: bizplace.description,
|
|
63
|
+
// userBizplaceId: userBizplaces
|
|
64
|
+
// .map(userBiz => userBiz.bizplace.id)
|
|
65
|
+
// .slice(0, 1)
|
|
66
|
+
// .shift(),
|
|
67
|
+
// assigned: userBizplaces.filter((userBizplace: Bizplace) => userBizplace.id === bizplace.id).length > 0
|
|
68
|
+
// }
|
|
69
|
+
// })
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
@Directive('@privilege(category: "bizplace", privilege: "query", domainOwnerGranted: true)')
|
|
@@ -214,7 +215,7 @@ export async function bizplaceUsers(
|
|
|
214
215
|
const [items, total] = await userRepo.findAndCount({
|
|
215
216
|
...params,
|
|
216
217
|
where: {
|
|
217
|
-
...params.where,
|
|
218
|
+
...(params.where as any),
|
|
218
219
|
id: In(userIds)
|
|
219
220
|
}
|
|
220
221
|
})
|
|
@@ -9,15 +9,12 @@ import { BizplaceList } from '../bizplace/bizplace-types'
|
|
|
9
9
|
import { Company } from './company'
|
|
10
10
|
import { CompanyList } from './company-types'
|
|
11
11
|
|
|
12
|
-
const debug = require('debug')('things-factory:biz-base:company-resolver')
|
|
13
|
-
|
|
14
12
|
@Resolver(Company)
|
|
15
13
|
export class CompanyQuery {
|
|
16
14
|
@Directive('@privilege(category: "company", privilege: "query", domainOwnerGranted: true)')
|
|
17
15
|
@Query(returns => Company)
|
|
18
16
|
async company(@Ctx() context: any): Promise<Company> {
|
|
19
17
|
const { domain } = context.state
|
|
20
|
-
debug('company', domain?.subdomain)
|
|
21
18
|
|
|
22
19
|
const foundCompany: Company | null = await getRepository(Company).findOne({
|
|
23
20
|
domain
|
|
@@ -44,7 +41,6 @@ export class CompanyQuery {
|
|
|
44
41
|
@Query(returns => BizplaceList)
|
|
45
42
|
async companyBizplaces(@Ctx() context: any): Promise<BizplaceList> {
|
|
46
43
|
const { domain, user } = context.state
|
|
47
|
-
debug('companyBizplaces', domain?.subdomain)
|
|
48
44
|
|
|
49
45
|
const userDomains: Domain[] = await getUserDomains(user)
|
|
50
46
|
const company: Company = await getRepository(Company).findOne({
|
|
@@ -63,7 +59,6 @@ export class CompanyQuery {
|
|
|
63
59
|
@Query(returns => UserList)
|
|
64
60
|
async companyUsers(@Ctx() context: any): Promise<UserList> {
|
|
65
61
|
const { domain } = context.state
|
|
66
|
-
debug('companyUsers', domain?.subdomain)
|
|
67
62
|
|
|
68
63
|
const items: User[] = await getDomainUsers(domain)
|
|
69
64
|
|
|
@@ -16,7 +16,7 @@ export class ContactPointMutation {
|
|
|
16
16
|
@Arg('contactPoint') contactPoint: NewContactPoint,
|
|
17
17
|
@Ctx() context: any
|
|
18
18
|
): Promise<ContactPoint> {
|
|
19
|
-
return await createContactPoint(contactPoint, context)
|
|
19
|
+
return await createContactPoint(contactPoint as any, context)
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
@Directive('@privilege(category: "contact_point", privilege: "mutation")')
|
|
@@ -78,7 +78,7 @@ export async function getOutletBizplace(outletId: string, tx?: EntityManager) {
|
|
|
78
78
|
export async function getCompanyBizplace(
|
|
79
79
|
domain: Domain,
|
|
80
80
|
user: User,
|
|
81
|
-
customerBizplaceId
|
|
81
|
+
customerBizplaceId?: string,
|
|
82
82
|
tx?: EntityManager
|
|
83
83
|
): Promise<Bizplace> {
|
|
84
84
|
const bizplaceRepo = tx ? tx.getRepository(Bizplace) : getRepository(Bizplace)
|
|
@@ -145,7 +145,7 @@ export async function getPartnerBizplaceIds(domain: Domain, user: User, tx?: Ent
|
|
|
145
145
|
})
|
|
146
146
|
|
|
147
147
|
for (let partner of partners) {
|
|
148
|
-
partnerBizplaces.push(partner.partnerBizplace)
|
|
148
|
+
partnerBizplaces.push((partner as any).partnerBizplace)
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
return partnerBizplaces.map((bizplace: Bizplace) => bizplace.id || null)
|
|
@@ -286,7 +286,7 @@ export async function getCustomerBizplaces(domain: Domain, tx?: EntityManager):
|
|
|
286
286
|
})
|
|
287
287
|
}
|
|
288
288
|
|
|
289
|
-
export async function getSubdomainBizplace(subdomain:
|
|
289
|
+
export async function getSubdomainBizplace(subdomain: string, tx?: EntityManager): Promise<Bizplace> {
|
|
290
290
|
const domainRepo = tx ? tx.getRepository(Domain) : getRepository(Domain)
|
|
291
291
|
|
|
292
292
|
const domain: Domain = await domainRepo.findOne({
|